-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build arm containers with new github actions arm runner (PP-2139) #2280
Merged
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9173a3c
Try running with new arm based runner
jonathangreen 5457906
Fix up some comments
jonathangreen de23853
Cleanup more comments
jonathangreen a7b47bf
roll back docker-compose changes
jonathangreen a110c6c
Update another comment
jonathangreen b76b858
Use ubuntu 24.04 image everywhere
jonathangreen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,13 @@ on: | |
schedule: | ||
# Every Monday at 6:22am Eastern Time | ||
- cron: '22 10 * * 1' | ||
push: | ||
# Build base image when the Dockerfile or the workflow file changes | ||
branches: | ||
- main | ||
paths: | ||
- .github/workflows/build-base-image.yml | ||
- docker/Dockerfile.baseimage | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We now update the base image on pushes to |
||
workflow_dispatch: | ||
# Allow us to manually trigger build | ||
|
||
|
@@ -12,18 +19,28 @@ concurrency: | |
cancel-in-progress: true | ||
|
||
jobs: | ||
docker-build-baseimage: | ||
name: Build Base Image | ||
# Some issue with the ubuntu-latest image is causing gcc to segfault with building | ||
# an emulated arm64 target. Downgrading to 22.04 seems to fix this. | ||
# See https://github.com/actions/runner-images/issues/11471 | ||
# runs-on: ubuntu-latest | ||
runs-on: ubuntu-22.04 | ||
build: | ||
name: Build Base Image (${{ matrix.arch.name }}) | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
arch: | ||
- name: "amd64" | ||
runner: "ubuntu-22.04" | ||
- name: "arm64" | ||
runner: "ubuntu-22.04-arm" | ||
|
||
runs-on: ${{ matrix.arch.runner }} | ||
|
||
timeout-minutes: 120 | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
outputs: | ||
repo: ${{ steps.ghcr-repo.outputs.baseimage }} | ||
meta: ${{ steps.meta.outputs.json }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
|
@@ -33,9 +50,6 @@ jobs: | |
- name: Disable network offload | ||
run: sudo ethtool -K eth0 tx off rx off | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
|
@@ -46,11 +60,19 @@ jobs: | |
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set GHCR repos | ||
# Docker doesn't support uppercase letters in repo names, so we need to lowercase the owner | ||
id: ghcr-repo | ||
run: | | ||
baseimage="ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/circ-baseimage" | ||
echo "$baseimage" | ||
echo "baseimage=$baseimage" >> "$GITHUB_OUTPUT" | ||
|
||
- name: Generate tags for image | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ghcr.io/${{ github.repository_owner }}/circ-baseimage | ||
images: ${{ steps.ghcr-repo.outputs.baseimage }} | ||
# Generate tags for the image | ||
# We use the following tags: | ||
# - The date in YYYYww format, which is the year and week number. 202052 is the last week of 2020. | ||
|
@@ -60,13 +82,59 @@ jobs: | |
type=raw,value=latest | ||
|
||
- name: Build base image | ||
id: build | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
file: ./docker/Dockerfile.baseimage | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
push: true | ||
target: baseimage | ||
cache-to: type=inline | ||
platforms: linux/amd64, linux/arm64 | ||
outputs: type=image,"name=${{ steps.ghcr-repo.outputs.baseimage }}",push-by-digest=true,name-canonical=true,push=true | ||
|
||
- name: Export digests | ||
run: | | ||
mkdir -p ${{ runner.temp }}/digests | ||
digest="${{ steps.build.outputs.digest }}" | ||
touch "${{ runner.temp }}/digests/${digest#sha256:}" | ||
|
||
- name: Upload digests | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: digests-${{ matrix.arch.name }} | ||
path: ${{ runner.temp }}/digests/* | ||
if-no-files-found: error | ||
retention-days: 1 | ||
|
||
push: | ||
name: Tag & Push Images | ||
runs-on: ubuntu-22.04 | ||
needs: [build] | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Download digests | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: ${{ runner.temp }}/digests | ||
pattern: digests-* | ||
merge-multiple: true | ||
|
||
- 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.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Create manifest & push images | ||
working-directory: ${{ runner.temp }}/digests | ||
run: > | ||
docker buildx imagetools create | ||
$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< '${{ needs.build.outputs.meta }}') | ||
$(printf '${{ needs.build.outputs.repo }}@sha256:%s ' *) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be broken out to a separate PR if we want. Our action to install poetry didn't take into account the runners architecture before, so it tried to use the same cache for both intel and arm, causing poetry installs to fail on whichever platform wasn't in the cache.
This adds the platform to the cache key, so it will work with new arm based runners.