Skip to content

Commit

Permalink
CI: login to docker hub on BuildJet (commaai#29961)
Browse files Browse the repository at this point in the history
* CI: login to docker hub on BuildJet

* shell

* try quotes

* forward

* try this

* can't believe this is broken

* try

* fix process replay
  • Loading branch information
adeebshihadeh authored Sep 18, 2023
1 parent a450eff commit 4b7b234
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/selfdrive_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ jobs:
submodules: true
- uses: ./.github/workflows/setup-with-retry
with:
docker_hub_pat: ${{ secrets.DOCKER_HUB_PAT }}
cache_key_prefix: scons_${{ matrix.arch }}
- uses: ./.github/workflows/compile-openpilot
timeout-minutes: ${{ ((steps.restore-scons-cache.outputs.cache-hit == 'true') && 15 || 30) }} # allow more time when we missed the scons cache
Expand Down Expand Up @@ -177,6 +178,7 @@ jobs:
sudo rm -rf /Applications/ArmGNUToolchain/*/*/.fseventsd
docker_push:
name: docker push
strategy:
matrix:
arch: ${{ fromJson( (github.repository == 'commaai/openpilot') && '["x86_64", "aarch64"]' || '["x86_64"]' ) }}
Expand All @@ -194,6 +196,7 @@ jobs:
- uses: ./.github/workflows/setup-with-retry
with:
git-lfs: false
docker_hub_pat: ${{ secrets.DOCKER_HUB_PAT }}
- name: Build and push CL Docker image
if: matrix.arch == 'x86_64'
run: |
Expand Down Expand Up @@ -280,6 +283,8 @@ jobs:
with:
submodules: true
- uses: ./.github/workflows/setup-with-retry
with:
docker_hub_pat: ${{ secrets.DOCKER_HUB_PAT }}
- name: Cache test routes
id: dependency-cache
uses: actions/cache@v3
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/setup-with-retry/action.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: 'openpilot env setup, with retry on failure'

inputs:
docker_hub_pat:
description: 'Auth token for Docker Hub, required for BuildJet jobs'
required: false
default: ''
git_lfs:
description: 'Whether or not to pull the git lfs'
required: false
Expand All @@ -21,6 +25,7 @@ runs:
uses: ./.github/workflows/setup
continue-on-error: true
with:
docker_hub_pat: ${{ inputs.docker_hub_pat }}
git_lfs: ${{ inputs.git_lfs }}
cache_key_prefix: ${{ inputs.cache_key_prefix }}
is_retried: true
Expand All @@ -32,6 +37,7 @@ runs:
uses: ./.github/workflows/setup
continue-on-error: true
with:
docker_hub_pat: ${{ inputs.docker_hub_pat }}
git_lfs: ${{ inputs.git_lfs }}
cache_key_prefix: ${{ inputs.cache_key_prefix }}
is_retried: true
Expand All @@ -42,6 +48,7 @@ runs:
if: steps.setup2.outcome == 'failure'
uses: ./.github/workflows/setup
with:
docker_hub_pat: ${{ inputs.docker_hub_pat }}
git_lfs: ${{ inputs.git_lfs }}
cache_key_prefix: ${{ inputs.cache_key_prefix }}
is_retried: true
21 changes: 19 additions & 2 deletions .github/workflows/setup/action.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
name: 'openpilot env setup'

inputs:
docker_hub_pat:
description: 'Auth token for Docker Hub, required for BuildJet jobs'
required: true
default: ''
git_lfs:
description: 'Whether or not to pull the git lfs'
required: false
required: true
default: 'true'
cache_key_prefix:
description: 'Prefix for caching key'
required: false
required: true
default: 'scons_x86_64'
is_retried:
description: 'A mock param that asserts that we use the setup-with-retry instead of this action directly'
Expand All @@ -29,6 +33,19 @@ runs:
if: ${{ inputs.git_lfs == 'true' }}
run: git lfs pull

# on BuildJet runners, must be logged into DockerHub to avoid rate limiting
# https://buildjet.com/for-github-actions/docs/guides/docker
- shell: bash
if: ${{ contains(runner.name, 'buildjet') && inputs.docker_hub_pat == '' }}
run: |
echo "Need to set the Docker Hub PAT secret as an input to this action"
exit 1
- name: Login to Docker Hub
if: contains(runner.name, 'buildjet')
shell: bash
run: |
docker login -u adeebshihadeh -p ${{ inputs.docker_hub_pat }}
# build cache
- id: date
shell: bash
Expand Down

0 comments on commit 4b7b234

Please sign in to comment.