From 8c349f453c233562325da6620a4e3adcb3d2df26 Mon Sep 17 00:00:00 2001 From: Brennan Kinney <5098581+polarathene@users.noreply.github.com> Date: Fri, 23 May 2025 19:01:51 +1200 Subject: [PATCH 1/3] ci: `stable.yml` - Make `check_stable.py` a dep --- .github/workflows/stable.yml | 54 +++++++++++++----------------------- 1 file changed, 20 insertions(+), 34 deletions(-) diff --git a/.github/workflows/stable.yml b/.github/workflows/stable.yml index a302cd7..d57d171 100644 --- a/.github/workflows/stable.yml +++ b/.github/workflows/stable.yml @@ -17,8 +17,28 @@ env: REGISTRY_IMAGE: clux/muslrust jobs: + check-stable: + name: 'Check if workflow should continue' + outputs: + CONTINUE_BUILD: ${{ steps.check-stable-tag.outputs.CONTINUE_BUILD }} + runs-on: 'ubuntu-latest' + - uses: actions/checkout@v4 + - name: 'Check if we need a new stable' + id: check-stable-tag + shell: bash + run: | + pip3 install --user toml + if python3 check_stable.py; then + echo 'Stable tag missing; running all build steps' + echo 'CONTINUE_BUILD=YES' >> "${GITHUB_OUTPUT}" + else + echo 'Stable tag found; skipping all build steps' + fi + build: name: 'Stable Build' + needs: [check-stable] + if: ${{ needs.check-stable.outputs.CONTINUE_BUILD == 'YES' }} runs-on: 'ubuntu-latest' strategy: fail-fast: false @@ -41,18 +61,6 @@ jobs: username: clux password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Check if we need a new stable - id: stablecheck - shell: bash - run: | - pip3 install --user toml - if python3 check_stable.py; then - echo "Stable tag missing; running all build steps" - echo "BUILD=YES" >> $GITHUB_OUTPUT - else - echo "Stable tag found; skipping all build steps" - fi - - name: Prepare run: | platform=${{ matrix.platform }} @@ -82,10 +90,8 @@ jobs: tags: rustmusl-temp build-args: | CHANNEL=stable - if: ${{ steps.stablecheck.outputs.BUILD }} - name: Run tests - if: ${{ steps.stablecheck.outputs.BUILD }} shell: bash run: | docker buildx build --platform ${{ matrix.platform }} --output type=docker -t test-runner - < Dockerfile.test-runner @@ -98,7 +104,6 @@ jobs: # only identifiable by their digest and it appears docker does not let us select an image that way. # Not the most elegant, but it works. - name: Store tag info - if: ${{ steps.stablecheck.outputs.BUILD }} shell: bash run: | mkdir -p /tmp/tags @@ -111,7 +116,6 @@ jobs: echo $RUST_VER > /tmp/tags/rust-ver - name: Tag and push - if: ${{ steps.stablecheck.outputs.BUILD }} shell: bash run: | RUST_DATE=$(cat /tmp/tags/rust-date) @@ -125,7 +129,6 @@ jobs: # TODO: want to do this, but need digest, which might not be trivial to get outside build-push-action # - name: Attest docker.io - # if: ${{ steps.stablecheck.outputs.BUILD }} # uses: actions/attest-build-provenance@v2.3.0 # with: # subject-name: docker.io/${{ env.REGISTRY_IMAGE }} @@ -133,7 +136,6 @@ jobs: # push-to-registry: true - name: Upload tags - if: ${{ steps.stablecheck.outputs.BUILD }} uses: actions/upload-artifact@v4 with: name: tags-${{matrix.arch}} @@ -148,21 +150,7 @@ jobs: needs: - build steps: - - uses: actions/checkout@v4 - - name: Check if we need a new stable - id: stablecheck - shell: bash - run: | - pip3 install --user toml - if python3 check_stable.py; then - echo "Stable tag missing; running all build steps" - echo "BUILD=YES" >> $GITHUB_OUTPUT - else - echo "Stable tag found; skipping all build steps" - fi - - name: Download tags - if: ${{ steps.stablecheck.outputs.BUILD }} uses: actions/download-artifact@v4 with: path: /tmp/tags @@ -185,7 +173,6 @@ jobs: password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Create manifest list and push multi-platform images - if: ${{ steps.stablecheck.outputs.BUILD }} run: | RUST_DATE=$(cat /tmp/tags/rust-date) RUST_CHANNEL=$(cat /tmp/tags/rust-channel) @@ -198,6 +185,5 @@ jobs: done - name: Inspect image - if: ${{ steps.stablecheck.outputs.BUILD }} run: | docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:latest From 6d5f5578ca07e9459180f2fb341639ab29feb788 Mon Sep 17 00:00:00 2001 From: Brennan Kinney <5098581+polarathene@users.noreply.github.com> Date: Fri, 23 May 2025 20:03:09 +1200 Subject: [PATCH 2/3] ci: `stable.yml` - Refactor adding tags --- .github/workflows/stable.yml | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/stable.yml b/.github/workflows/stable.yml index d57d171..e8a5c7b 100644 --- a/.github/workflows/stable.yml +++ b/.github/workflows/stable.yml @@ -22,6 +22,7 @@ jobs: outputs: CONTINUE_BUILD: ${{ steps.check-stable-tag.outputs.CONTINUE_BUILD }} runs-on: 'ubuntu-latest' + steps: - uses: actions/checkout@v4 - name: 'Check if we need a new stable' id: check-stable-tag @@ -61,11 +62,6 @@ jobs: username: clux password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Prepare - run: | - platform=${{ matrix.platform }} - echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV - - name: Docker meta id: meta uses: docker/metadata-action@v5 @@ -178,11 +174,21 @@ jobs: RUST_CHANNEL=$(cat /tmp/tags/rust-channel) RUST_VER=$(cat /tmp/tags/rust-ver) - for tag in ${RUST_CHANNEL} ${RUST_CHANNEL}-${RUST_DATE} ${RUST_VER}-${RUST_CHANNEL} ${RUST_VER}-${RUST_CHANNEL}-${RUST_DATE}; do - docker buildx imagetools create -t ${{ env.REGISTRY_IMAGE }}:$tag \ - ${{ env.REGISTRY_IMAGE }}:amd64-${RUST_VER}-${RUST_CHANNEL}-${RUST_DATE} \ - ${{ env.REGISTRY_IMAGE }}:arm64-${RUST_VER}-${RUST_CHANNEL}-${RUST_DATE} - done + # The two already published image tags to associate additional tags to: + AMD64="${{ env.REGISTRY_IMAGE }}:amd64-${RUST_VER}-${RUST_CHANNEL}-${RUST_DATE}" + ARM64="${{ env.REGISTRY_IMAGE }}:arm64-${RUST_VER}-${RUST_CHANNEL}-${RUST_DATE}" + + EXTRA_TAGS=( + "${RUST_CHANNEL}" + "${RUST_CHANNEL}-${RUST_DATE}" + "${RUST_VER}-${RUST_CHANNEL}" + "${RUST_VER}-${RUST_CHANNEL}-${RUST_DATE}" + ) + + # Assign each tag to the two source image tags: + for TAG in "${EXTRA_TAGS[@]}"; do + docker buildx imagetools create --tag "${{ env.REGISTRY_IMAGE }}:${TAG}" "${AMD64}" "${ARM64}" + done - name: Inspect image run: | From 02a8f9a88d02f8845ddffbef6be470b6f55f4124 Mon Sep 17 00:00:00 2001 From: Brennan Kinney <5098581+polarathene@users.noreply.github.com> Date: Fri, 23 May 2025 20:32:34 +1200 Subject: [PATCH 3/3] ci: `stable.yml` - Use `bash` for pushing additional tags step --- .github/workflows/stable.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/stable.yml b/.github/workflows/stable.yml index e8a5c7b..cf2fee3 100644 --- a/.github/workflows/stable.yml +++ b/.github/workflows/stable.yml @@ -169,6 +169,7 @@ jobs: password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Create manifest list and push multi-platform images + shell: bash run: | RUST_DATE=$(cat /tmp/tags/rust-date) RUST_CHANNEL=$(cat /tmp/tags/rust-channel)