|
99 | 99 | run: | |
100 | 100 | echo "Container built and pushed successfully!" |
101 | 101 | echo "Image: ${{ env.REGISTRY }}/openhpc/ohpc-validate-${{ matrix.distro }}:latest" |
| 102 | +
|
| 103 | + build-3x: |
| 104 | + runs-on: ${{ matrix.runs-on }} |
| 105 | + permissions: |
| 106 | + contents: read |
| 107 | + packages: write |
| 108 | + strategy: |
| 109 | + matrix: |
| 110 | + distro: [ almalinux, openeuler, leap ] |
| 111 | + arch: [ x86_64, aarch64 ] |
| 112 | + include: |
| 113 | + - arch: x86_64 |
| 114 | + runs-on: ubuntu-24.04 |
| 115 | + - arch: aarch64 |
| 116 | + runs-on: ubuntu-24.04-arm |
| 117 | + outputs: |
| 118 | + almalinux-digest-x86_64: ${{ steps.export.outputs.almalinux-digest-x86_64 }} |
| 119 | + almalinux-digest-aarch64: ${{ steps.export.outputs.almalinux-digest-aarch64 }} |
| 120 | + openeuler-digest-x86_64: ${{ steps.export.outputs.openeuler-digest-x86_64 }} |
| 121 | + openeuler-digest-aarch64: ${{ steps.export.outputs.openeuler-digest-aarch64 }} |
| 122 | + leap-digest-x86_64: ${{ steps.export.outputs.leap-digest-x86_64 }} |
| 123 | + leap-digest-aarch64: ${{ steps.export.outputs.leap-digest-aarch64 }} |
| 124 | + steps: |
| 125 | + - name: Checkout repository |
| 126 | + uses: actions/checkout@v6 |
| 127 | + with: |
| 128 | + ref: 3.x |
| 129 | + |
| 130 | + - name: Set up Docker Buildx |
| 131 | + uses: docker/setup-buildx-action@v4 |
| 132 | + |
| 133 | + - name: Log in to Container Registry |
| 134 | + uses: docker/login-action@v4 |
| 135 | + with: |
| 136 | + registry: ${{ env.REGISTRY }} |
| 137 | + username: ${{ github.actor }} |
| 138 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 139 | + |
| 140 | + - name: Extract metadata |
| 141 | + id: meta |
| 142 | + uses: docker/metadata-action@v6 |
| 143 | + with: |
| 144 | + images: ${{ env.REGISTRY }}/openhpc/ohpc-validate-${{ matrix.distro }} |
| 145 | + tags: | |
| 146 | + type=raw,value=3.x |
| 147 | +
|
| 148 | + - name: Build and push by digest |
| 149 | + id: build |
| 150 | + uses: docker/build-push-action@v7 |
| 151 | + with: |
| 152 | + context: . |
| 153 | + file: ./tests/ci/Containerfile.ohpc-validate-${{ matrix.distro }} |
| 154 | + platforms: linux/${{ matrix.arch }} |
| 155 | + labels: ${{ steps.meta.outputs.labels }} |
| 156 | + provenance: false |
| 157 | + sbom: false |
| 158 | + outputs: type=image,name=${{ env.REGISTRY }}/openhpc/ohpc-validate-${{ matrix.distro }},push-by-digest=true,name-canonical=true,push=true |
| 159 | + |
| 160 | + - name: Export digest |
| 161 | + id: export |
| 162 | + run: | |
| 163 | + echo "${{ matrix.distro }}-digest-${{ matrix.arch }}=${{ steps.build.outputs.digest }}" >> $GITHUB_OUTPUT |
| 164 | +
|
| 165 | + publish-3x: |
| 166 | + runs-on: ubuntu-24.04 |
| 167 | + needs: build-3x |
| 168 | + permissions: |
| 169 | + contents: read |
| 170 | + packages: write |
| 171 | + strategy: |
| 172 | + matrix: |
| 173 | + distro: [ almalinux, openeuler, leap ] |
| 174 | + steps: |
| 175 | + - name: Set up Docker Buildx |
| 176 | + uses: docker/setup-buildx-action@v4 |
| 177 | + |
| 178 | + - name: Log in to Container Registry |
| 179 | + uses: docker/login-action@v4 |
| 180 | + with: |
| 181 | + registry: ${{ env.REGISTRY }} |
| 182 | + username: ${{ github.actor }} |
| 183 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 184 | + |
| 185 | + - name: Create and push manifest |
| 186 | + run: | |
| 187 | + docker buildx imagetools create \ |
| 188 | + --tag ${{ env.REGISTRY }}/openhpc/ohpc-validate-${{ matrix.distro }}:3.x \ |
| 189 | + ${{ env.REGISTRY }}/openhpc/ohpc-validate-${{ matrix.distro }}@${{ needs.build-3x.outputs[format('{0}-digest-x86_64', matrix.distro)] }} \ |
| 190 | + ${{ env.REGISTRY }}/openhpc/ohpc-validate-${{ matrix.distro }}@${{ needs.build-3x.outputs[format('{0}-digest-aarch64', matrix.distro)] }} |
| 191 | +
|
| 192 | + - name: Output image details |
| 193 | + run: | |
| 194 | + echo "Container built and pushed successfully!" |
| 195 | + echo "Image: ${{ env.REGISTRY }}/openhpc/ohpc-validate-${{ matrix.distro }}:3.x" |
0 commit comments