Skip to content

Conversation

rajathagasthya
Copy link

@rajathagasthya rajathagasthya commented Oct 21, 2025

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 requring emulation.
  3. Removes explicit use if buildx for docker build. Buildx is now the default builder in Docker. Also removes the related QEMU setup.

@rajathagasthya rajathagasthya force-pushed the native-docker-builds branch 3 times, most recently from 00a1898 to 2665f5f Compare October 21, 2025 18:43
@rajathagasthya rajathagasthya marked this pull request as ready for review October 21, 2025 18:44
@rajathagasthya rajathagasthya marked this pull request as draft October 21, 2025 18:44
@tariq1890
Copy link
Contributor

/ok to test 2665f5f

@rajathagasthya rajathagasthya force-pushed the native-docker-builds branch 2 times, most recently from 71bdb75 to 0e40f7f Compare October 21, 2025 19:18
@rajathagasthya rajathagasthya marked this pull request as ready for review October 21, 2025 20:10
Copy link
Contributor

@tariq1890 tariq1890 left a 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

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]>

jobs:
build:
build-amd64:
Copy link
Member

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

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}

?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants