-
Notifications
You must be signed in to change notification settings - Fork 744
Build multiarch images on native GitHub runners #1468
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
base: main
Are you sure you want to change the base?
Conversation
00a1898
to
2665f5f
Compare
/ok to test 2665f5f |
71bdb75
to
0e40f7f
Compare
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.
LGTM. Thanks @rajathagasthya !
Let's get @elezar's review before merging
0e40f7f
to
004e511
Compare
This commit makes the following changes: 1. Builds multiarch images for non-release commits/PRs, in addition to released versions. 2. Runs the docker build for an arch on the respective GitHub runner (e.g. a linux/amd64 docker image will be built on a linux/amd64 runner). This native build reduces build times due to not requiring emulation. 3. Removes explicit use if buildx for docker build. Buildx is now the default builder in Docker. Also removes the related QEMU setup. Signed-off-by: Rajath Agasthya <[email protected]>
004e511
to
9e6896c
Compare
|
||
jobs: | ||
build: | ||
build-amd64: |
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.
Is using a matrix strategy possible, or is not possible to use the target to define the runs-on
?
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.
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.
Something like:
diff --git a/.github/workflows/image.yaml b/.github/workflows/image.yaml
index 4cb7ce784..1937ddffd 100644
--- a/.github/workflows/image.yaml
+++ b/.github/workflows/image.yaml
@@ -22,8 +22,13 @@ on:
type: string
jobs:
- build-amd64:
- runs-on: linux-amd64-cpu4
+ build:
+ strategy:
+ matrix:
+ arch:
+ - amd64
+ - arm64
+ runs-on: linux-${{ matrix.arch }}-cpu4
permissions:
contents: read
id-token: write
@@ -43,45 +48,16 @@ jobs:
- name: Build image
env:
IMAGE_NAME: ghcr.io/nvidia/k8s-device-plugin
- VERSION: ${{ inputs.version }}-amd64
+ VERSION: ${{ inputs.version }}-${{ matrix.arch }}
PUSH_ON_BUILD: true
GOPROXY: ${{ steps.setup-go-proxy.outputs.goproxy-url }}
- DOCKER_BUILD_PLATFORM_OPTIONS: "--platform=linux/amd64"
+ DOCKER_BUILD_PLATFORM_OPTIONS: "--platform=linux/${{ matrix.arch }}"
run: |
echo "${VERSION}"
make -f deployments/container/Makefile build
- build-arm64:
- runs-on: linux-arm64-cpu4
- permissions:
- contents: read
- id-token: write
- packages: write
- steps:
- - uses: actions/checkout@v5
- name: Check out code
- - name: Login to GitHub Container Registry
- uses: docker/login-action@v3
- with:
- registry: ghcr.io
- username: ${{ github.actor }}
- password: ${{ secrets.GITHUB_TOKEN }}
- - name: Setup Go Proxy
- id: setup-go-proxy
- uses: nv-gha-runners/setup-artifactory-go-proxy@main
- - name: Build image
- env:
- IMAGE_NAME: ghcr.io/nvidia/k8s-device-plugin
- VERSION: ${{ inputs.version }}-arm64
- PUSH_ON_BUILD: true
- GOPROXY: ${{ steps.setup-go-proxy.outputs.goproxy-url }}
- DOCKER_BUILD_PLATFORM_OPTIONS: "--platform=linux/arm64"
- run: |
- echo "${VERSION}"
- make -f deployments/container/Makefile build
-
- build-multi-arch-images:
- needs: [ build-arm64, build-amd64 ]
+ create-manifest:
+ needs: [ build ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
@@ -94,12 +70,10 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Manifest
env:
- IMAGE_ARM: ghcr.io/nvidia/k8s-device-plugin:${{ inputs.version }}-arm64
- IMAGE_AMD: ghcr.io/nvidia/k8s-device-plugin:${{ inputs.version }}-amd64
MULTIARCH_IMAGE: ghcr.io/nvidia/k8s-device-plugin:${{ inputs.version }}
run: |
docker manifest create \
${MULTIARCH_IMAGE} \
- ${IMAGE_AMD} \
- ${IMAGE_ARM}
+ ghcr.io/nvidia/k8s-device-plugin:${{ inputs.version }}-amd64 \
+ ghcr.io/nvidia/k8s-device-plugin:${{ inputs.version }}-arm64
docker manifest push ${MULTIARCH_IMAGE}
?
This commit makes the following changes: