|
20 | 20 | version: |
21 | 21 | required: true |
22 | 22 | type: string |
23 | | - build_multi_arch_images: |
24 | | - required: true |
25 | | - type: string |
26 | 23 |
|
27 | 24 | jobs: |
28 | | - build: |
| 25 | + build-amd64: |
29 | 26 | runs-on: linux-amd64-cpu4 |
30 | 27 | permissions: |
31 | 28 | contents: read |
|
54 | 51 | IMAGE_NAME: ghcr.io/nvidia/k8s-device-plugin |
55 | 52 | VERSION: ${{ inputs.version }} |
56 | 53 | PUSH_ON_BUILD: true |
57 | | - BUILD_MULTI_ARCH_IMAGES: ${{ inputs.build_multi_arch_images }} |
58 | 54 | GOPROXY: ${{ steps.setup-go-proxy.outputs.goproxy-url }} |
| 55 | + DOCKER_BUILD_PLATFORM_OPTIONS: "--platform=linux/amd64" |
59 | 56 | run: | |
60 | 57 | echo "${VERSION}" |
61 | 58 | make -f deployments/container/Makefile build |
| 59 | +
|
| 60 | + build-arm64: |
| 61 | + runs-on: linux-arm64-cpu4 |
| 62 | + permissions: |
| 63 | + contents: read |
| 64 | + id-token: write |
| 65 | + packages: write |
| 66 | + steps: |
| 67 | + - uses: actions/checkout@v5 |
| 68 | + name: Check out code |
| 69 | + - name: Set up QEMU |
| 70 | + uses: docker/setup-qemu-action@v3 |
| 71 | + with: |
| 72 | + image: tonistiigi/binfmt:master |
| 73 | + - name: Set up Docker Buildx |
| 74 | + uses: docker/setup-buildx-action@v3 |
| 75 | + - name: Login to GitHub Container Registry |
| 76 | + uses: docker/login-action@v3 |
| 77 | + with: |
| 78 | + registry: ghcr.io |
| 79 | + username: ${{ github.actor }} |
| 80 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 81 | + - name: Setup Go Proxy |
| 82 | + id: setup-go-proxy |
| 83 | + uses: nv-gha-runners/setup-artifactory-go-proxy@main |
| 84 | + - name: Build image |
| 85 | + env: |
| 86 | + IMAGE_NAME: ghcr.io/nvidia/k8s-device-plugin |
| 87 | + VERSION: ${{ inputs.version }} |
| 88 | + PUSH_ON_BUILD: true |
| 89 | + GOPROXY: ${{ steps.setup-go-proxy.outputs.goproxy-url }} |
| 90 | + DOCKER_BUILD_PLATFORM_OPTIONS: "--platform=linux/arm64" |
| 91 | + run: | |
| 92 | + echo "${VERSION}" |
| 93 | + make -f deployments/container/Makefile build |
| 94 | +
|
| 95 | + build-multi-arch-images: |
| 96 | + needs: [ build-arm64, build-amd64 ] |
| 97 | + runs-on: ubuntu-latest |
| 98 | + steps: |
| 99 | + - uses: actions/checkout@v5 |
| 100 | + name: Check out code |
| 101 | + - name: Calculate build vars |
| 102 | + id: vars |
| 103 | + run: | |
| 104 | + echo "COMMIT_SHORT_SHA=${GITHUB_SHA:0:8}" >> $GITHUB_ENV |
| 105 | + echo "LOWERCASE_REPO_OWNER=$(echo "${GITHUB_REPOSITORY_OWNER}" | awk '{print tolower($0)}')" >> $GITHUB_ENV |
| 106 | + - name: Login to GitHub Container Registry |
| 107 | + uses: docker/login-action@v3 |
| 108 | + with: |
| 109 | + registry: ghcr.io |
| 110 | + username: ${{ github.actor }} |
| 111 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 112 | + - name: Build Manifest |
| 113 | + env: |
| 114 | + IMAGE_ARM: ghcr.io/nvidia/k8s-device-plugin:${{ inputs.version }}-arm64 |
| 115 | + IMAGE_AMD: ghcr.io/nvidia/k8s-device-plugin:${{ inputs.version }}-amd64 |
| 116 | + MULTIARCH_IMAGE: ghcr.io/nvidia/k8s-device-plugin:${{ inputs.version }} |
| 117 | + run: | |
| 118 | + docker manifest create \ |
| 119 | + ${MULTIARCH_IMAGE} \ |
| 120 | + ${IMAGE_AMD} \ |
| 121 | + ${IMAGE_ARM} |
| 122 | + docker manifest push ${MULTIARCH_IMAGE} |
0 commit comments