|
21 | 21 | version: |
22 | 22 | required: true |
23 | 23 | type: string |
24 | | - build_multi_arch_images: |
25 | | - required: true |
26 | | - type: string |
27 | 24 |
|
28 | 25 | jobs: |
29 | | - packages: |
30 | | - runs-on: ubuntu-latest |
| 26 | + amd64-packages: |
| 27 | + runs-on: linux-amd64-cpu4 |
31 | 28 | strategy: |
32 | 29 | matrix: |
33 | 30 | target: |
34 | | - - ubuntu18.04-arm64 |
35 | 31 | - ubuntu18.04-amd64 |
36 | | - - centos7-aarch64 |
37 | 32 | - centos7-x86_64 |
38 | | - ispr: |
39 | | - - ${{ github.ref_name != 'main' && !startsWith( github.ref_name, 'release-' ) }} |
40 | | - exclude: |
41 | | - - ispr: true |
42 | | - target: ubuntu18.04-arm64 |
43 | | - - ispr: true |
44 | | - target: centos7-aarch64 |
45 | 33 | fail-fast: false |
46 | 34 |
|
47 | 35 | steps: |
@@ -69,22 +57,117 @@ jobs: |
69 | 57 | name: toolkit-container-${{ matrix.target }}-${{ github.run_id }} |
70 | 58 | path: ${{ github.workspace }}/dist/* |
71 | 59 |
|
72 | | - image: |
| 60 | + arm64-packages: |
| 61 | + runs-on: linux-arm64-cpu4 |
| 62 | + strategy: |
| 63 | + matrix: |
| 64 | + target: |
| 65 | + - ubuntu18.04-arm64 |
| 66 | + - centos7-aarch64 |
| 67 | + fail-fast: false |
| 68 | + |
| 69 | + steps: |
| 70 | + - uses: actions/checkout@v6 |
| 71 | + name: Check out code |
| 72 | + |
| 73 | + - name: Set up QEMU |
| 74 | + uses: docker/setup-qemu-action@v3 |
| 75 | + with: |
| 76 | + image: tonistiigi/binfmt:master |
| 77 | + |
| 78 | + - name: Set up Docker Buildx |
| 79 | + uses: docker/setup-buildx-action@v3 |
| 80 | + |
| 81 | + - name: build ${{ matrix.target }} packages |
| 82 | + run: | |
| 83 | + sudo apt-get install -y coreutils build-essential sed git bash make |
| 84 | + echo "Building packages" |
| 85 | + ./scripts/build-packages.sh ${{ matrix.target }} |
| 86 | +
|
| 87 | + - name: 'Upload Artifacts' |
| 88 | + uses: actions/upload-artifact@v7 |
| 89 | + with: |
| 90 | + compression-level: 0 |
| 91 | + name: toolkit-container-${{ matrix.target }}-${{ github.run_id }} |
| 92 | + path: ${{ github.workspace }}/dist/* |
| 93 | + |
| 94 | + packaging-image: |
73 | 95 | runs-on: linux-amd64-cpu4 |
74 | 96 | permissions: |
75 | 97 | contents: read |
76 | 98 | id-token: write |
77 | 99 | packages: write |
| 100 | + needs: |
| 101 | + - amd64-packages |
| 102 | + - arm64-packages |
| 103 | + steps: |
| 104 | + - uses: actions/checkout@v6 |
| 105 | + name: Check out code |
| 106 | + |
| 107 | + - name: Calculate build vars |
| 108 | + id: vars |
| 109 | + run: | |
| 110 | + echo "LOWERCASE_REPO_OWNER=$(echo "${GITHUB_REPOSITORY_OWNER}" | awk '{print tolower($0)}')" >> $GITHUB_ENV |
| 111 | +
|
| 112 | + - name: Set up QEMU |
| 113 | + uses: docker/setup-qemu-action@v3 |
| 114 | + with: |
| 115 | + image: tonistiigi/binfmt:master |
| 116 | + |
| 117 | + - name: Set up Docker Buildx |
| 118 | + uses: docker/setup-buildx-action@v3 |
| 119 | + |
| 120 | + - name: Get built packages |
| 121 | + uses: actions/download-artifact@v8 |
| 122 | + with: |
| 123 | + path: ${{ github.workspace }}/dist/ |
| 124 | + pattern: toolkit-container-*-${{ github.run_id }} |
| 125 | + merge-multiple: true |
| 126 | + |
| 127 | + - name: Login to GitHub Container Registry |
| 128 | + uses: docker/login-action@v3 |
| 129 | + with: |
| 130 | + registry: ghcr.io |
| 131 | + username: ${{ github.actor }} |
| 132 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 133 | + |
| 134 | + - name: Setup Go Proxy |
| 135 | + id: setup-go-proxy |
| 136 | + uses: nv-gha-runners/setup-artifactory-go-proxy@main |
| 137 | + |
| 138 | + - name: Build image |
| 139 | + env: |
| 140 | + IMAGE_NAME: ghcr.io/${{ env.LOWERCASE_REPO_OWNER }}/container-toolkit |
| 141 | + VERSION: ${{ inputs.version }} |
| 142 | + PUSH_ON_BUILD: "true" |
| 143 | + GOPROXY: ${{ steps.setup-go-proxy.outputs.goproxy-url }} |
| 144 | + run: | |
| 145 | + echo "${VERSION}" |
| 146 | + make -f deployments/container/Makefile build-packaging |
| 147 | +
|
| 148 | + application-image: |
78 | 149 | strategy: |
79 | 150 | matrix: |
80 | | - target: |
81 | | - - application |
82 | | - - packaging |
83 | | - needs: packages |
| 151 | + arch: |
| 152 | + - amd64 |
| 153 | + - arm64 |
| 154 | + runs-on: linux-${{ matrix.arch }}-cpu4 |
| 155 | + permissions: |
| 156 | + contents: read |
| 157 | + id-token: write |
| 158 | + packages: write |
| 159 | + needs: |
| 160 | + - amd64-packages |
| 161 | + - arm64-packages |
84 | 162 | steps: |
85 | 163 | - uses: actions/checkout@v6 |
86 | 164 | name: Check out code |
87 | 165 |
|
| 166 | + - name: Calculate build vars |
| 167 | + id: vars |
| 168 | + run: | |
| 169 | + echo "LOWERCASE_REPO_OWNER=$(echo "${GITHUB_REPOSITORY_OWNER}" | awk '{print tolower($0)}')" >> $GITHUB_ENV |
| 170 | +
|
88 | 171 | - name: Set up QEMU |
89 | 172 | uses: docker/setup-qemu-action@v3 |
90 | 173 | with: |
@@ -113,11 +196,47 @@ jobs: |
113 | 196 |
|
114 | 197 | - name: Build image |
115 | 198 | env: |
116 | | - IMAGE_NAME: ghcr.io/nvidia/container-toolkit |
117 | | - VERSION: ${{ inputs.version }} |
| 199 | + IMAGE_NAME: ghcr.io/${{ env.LOWERCASE_REPO_OWNER }}/container-toolkit |
| 200 | + VERSION: ${{ inputs.version }}-${{ matrix.arch }} |
118 | 201 | PUSH_ON_BUILD: "true" |
119 | | - BUILD_MULTI_ARCH_IMAGES: ${{ inputs.build_multi_arch_images }} |
120 | 202 | GOPROXY: ${{ steps.setup-go-proxy.outputs.goproxy-url }} |
121 | 203 | run: | |
122 | 204 | echo "${VERSION}" |
123 | | - make -f deployments/container/Makefile build-${{ matrix.target }} |
| 205 | + make -f deployments/container/Makefile build-application |
| 206 | +
|
| 207 | + create-manifest: |
| 208 | + needs: |
| 209 | + - application-image |
| 210 | + runs-on: linux-amd64-cpu4 |
| 211 | + steps: |
| 212 | + - uses: actions/checkout@v6 |
| 213 | + name: Check out code |
| 214 | + |
| 215 | + - name: Calculate build vars |
| 216 | + id: vars |
| 217 | + run: | |
| 218 | + echo "LOWERCASE_REPO_OWNER=$(echo "${GITHUB_REPOSITORY_OWNER}" | awk '{print tolower($0)}')" >> $GITHUB_ENV |
| 219 | +
|
| 220 | + - name: Set up QEMU |
| 221 | + uses: docker/setup-qemu-action@v3 |
| 222 | + with: |
| 223 | + image: tonistiigi/binfmt:master |
| 224 | + |
| 225 | + - name: Set up Docker Buildx |
| 226 | + uses: docker/setup-buildx-action@v3 |
| 227 | + |
| 228 | + - name: Login to GitHub Container Registry |
| 229 | + uses: docker/login-action@v3 |
| 230 | + with: |
| 231 | + registry: ghcr.io |
| 232 | + username: ${{ github.actor }} |
| 233 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 234 | + - name: Build Manifest |
| 235 | + env: |
| 236 | + MULTIARCH_IMAGE: ghcr.io/${{ env.LOWERCASE_REPO_OWNER }}/container-toolkit:${{ inputs.version }} |
| 237 | + run: | |
| 238 | + docker manifest create \ |
| 239 | + ${MULTIARCH_IMAGE} \ |
| 240 | + ghcr.io/${{ env.LOWERCASE_REPO_OWNER }}/container-toolkit:${{ inputs.version }}-amd64 \ |
| 241 | + ghcr.io/${{ env.LOWERCASE_REPO_OWNER }}/container-toolkit:${{ inputs.version }}-arm64 |
| 242 | + docker manifest push ${MULTIARCH_IMAGE} |
0 commit comments