-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Devops: Refactor the GHA Docker build (#6396)
This should both increase speed and robustness of the build, main due to: * Not uploading image as artifacts. (this does have a side-effect that the build can't happen from forks, maybe we can workaround that) * Build multiplatform images together Co-authored-by: Jusong Yu <[email protected]>
- Loading branch information
1 parent
6291acc
commit e47932e
Showing
19 changed files
with
363 additions
and
393 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[pytest] | ||
minversion = 7.0 | ||
addopts = -ra -q | ||
addopts = -ra -q --strict-markers | ||
testpaths = | ||
tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
docker | ||
pre-commit | ||
pytest | ||
requests | ||
tabulate | ||
pytest-docker | ||
docker-compose | ||
pyyaml<=5.3.1 | ||
docker~=7.0.0 | ||
pytest~=8.2.0 | ||
requests~=2.32.0 | ||
pytest-docker~=3.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Build Docker images and upload them to ghcr.io | ||
|
||
env: | ||
BUILDKIT_PROGRESS: plain | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
runsOn: | ||
description: GitHub Actions Runner image | ||
required: true | ||
type: string | ||
platforms: | ||
description: Target platforms for the build (linux/amd64 and/or linux/arm64) | ||
required: true | ||
type: string | ||
outputs: | ||
images: | ||
description: Images identified by digests | ||
value: ${{ jobs.build.outputs.images }} | ||
|
||
jobs: | ||
build: | ||
name: ${{ inputs.platforms }} | ||
runs-on: ${{ inputs.runsOn }} | ||
timeout-minutes: 60 | ||
defaults: | ||
run: | ||
# Make sure we fail if any command in a piped command sequence fails | ||
shell: bash -e -o pipefail {0} | ||
|
||
outputs: | ||
images: ${{ steps.bake_metadata.outputs.images }} | ||
|
||
steps: | ||
|
||
- name: Checkout Repo ⚡️ | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up QEMU | ||
if: ${{ inputs.platforms != 'linux/amd64' }} | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to GitHub Container Registry 🔑 | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and upload to ghcr.io 📤 | ||
id: build | ||
uses: docker/bake-action@v4 | ||
with: | ||
push: true | ||
workdir: .docker/ | ||
# Using provenance to disable default attestation so it will build only desired images: | ||
# https://github.com/orgs/community/discussions/45969 | ||
provenance: false | ||
set: | | ||
*.platform=${{ inputs.platforms }} | ||
*.output=type=registry,push-by-digest=true,name-canonical=true | ||
*.cache-to=type=gha,scope=${{ github.workflow }},mode=max | ||
*.cache-from=type=gha,scope=${{ github.workflow }} | ||
files: | | ||
docker-bake.hcl | ||
build.json | ||
- name: Set output variables | ||
id: bake_metadata | ||
run: | | ||
.github/workflows/extract-docker-image-names.sh | tee -a "${GITHUB_OUTPUT}" | ||
env: | ||
BAKE_METADATA: ${{ steps.build.outputs.metadata }} |
Oops, something went wrong.