Add ability to provide token for private repo for requirements_git in container build (#15831) (#6830)

Add ability to provide auth to private repo for requirements_git
This commit is contained in:
Hao Liu
2025-02-12 15:00:37 -05:00
committed by GitHub
parent 63bb4d66ef
commit 397fb297bf
8 changed files with 38 additions and 0 deletions

View File

@@ -3,6 +3,7 @@ name: CI
env:
LC_ALL: "C.UTF-8" # prevent ERROR: Ansible could not initialize the preferred locale: unsupported locale setting
CI_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CI_PRIVATE_GITHUB_TOKEN: ${{ secrets.PRIVATE_GITHUB_TOKEN }}
DEV_DOCKER_OWNER: ${{ github.repository_owner }}
COMPOSE_TAG: ${{ github.base_ref || 'devel' }}
on:
@@ -46,6 +47,7 @@ jobs:
uses: ./.github/actions/awx_devel_image
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
private-github-token: ${{ secrets.PRIVATE_GITHUB_TOKEN }}
- name: Run check ${{ matrix.tests.name }}
run: AWX_DOCKER_CMD='${{ matrix.tests.command }}' make docker-runner
@@ -67,6 +69,7 @@ jobs:
with:
build-ui: false
github-token: ${{ secrets.GITHUB_TOKEN }}
private-github-token: ${{ secrets.PRIVATE_GITHUB_TOKEN }}
- name: Run smoke test
run: ansible-playbook tools/docker-compose/ansible/smoke-test.yml -v
@@ -103,6 +106,12 @@ jobs:
run: |
python3 -m pip install docker
- name: Add Private github token to requirements_git.credentials.txt
shell: bash
working-directory: awx
run: echo "https://x-access-token:${{ env.CI_PRIVATE_GITHUB_TOKEN }}@github.com" >> requirements/requirements_git.credentials.txt
if: ${{ env.CI_PRIVATE_GITHUB_TOKEN != '' }}
- name: Build AWX image
working-directory: awx
run: |
@@ -208,6 +217,7 @@ jobs:
with:
build-ui: false
github-token: ${{ secrets.GITHUB_TOKEN }}
private-github-token: ${{ secrets.PRIVATE_GITHUB_TOKEN }}
- name: Install dependencies for running tests
run: |

View File

@@ -3,6 +3,7 @@ name: Build/Push Development Images
env:
LC_ALL: "C.UTF-8" # prevent ERROR: Ansible could not initialize the preferred locale: unsupported locale setting
DOCKER_CACHE: "--no-cache" # using the cache will not rebuild git requirements and other things
CI_PRIVATE_GITHUB_TOKEN: ${{ secrets.PRIVATE_GITHUB_TOKEN }}
on:
workflow_dispatch:
push:
@@ -85,6 +86,11 @@ jobs:
make ui-next
if: matrix.build-targets.image-name == 'awx'
- name: Add private GitHub token to requirements_git.credentials.txt
shell: bash
run: echo "https://x-access-token:${{ secrets.PRIVATE_GITHUB_TOKEN }}@github.com"" >> requirements/requirements_git.credentials.txt
if: ${{ env.CI_PRIVATE_GITHUB_TOKEN != '' }}
- name: Build and push AWX devel images
run: |
make ${{ matrix.build-targets.make-target }}