diff --git a/.github/workflows/.container.template.j2 b/.github/workflows/.container.template.j2 index e5c1b21..1f4f72f 100644 --- a/.github/workflows/.container.template.j2 +++ b/.github/workflows/.container.template.j2 @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/almalinux-containers.yml b/.github/workflows/almalinux-containers.yml index 3b5ae16..274f1a2 100644 --- a/.github/workflows/almalinux-containers.yml +++ b/.github/workflows/almalinux-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/amazonlinux-containers.yml b/.github/workflows/amazonlinux-containers.yml index b2f37dd..aafe282 100644 --- a/.github/workflows/amazonlinux-containers.yml +++ b/.github/workflows/amazonlinux-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/archlinux-containers.yml b/.github/workflows/archlinux-containers.yml index fb929c6..83b38f6 100644 --- a/.github/workflows/archlinux-containers.yml +++ b/.github/workflows/archlinux-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/busybox-containers.yml b/.github/workflows/busybox-containers.yml index 3e2cdb3..d1861f0 100644 --- a/.github/workflows/busybox-containers.yml +++ b/.github/workflows/busybox-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/centos-containers.yml b/.github/workflows/centos-containers.yml index 627b6a4..47bc058 100644 --- a/.github/workflows/centos-containers.yml +++ b/.github/workflows/centos-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/centos-stream-containers.yml b/.github/workflows/centos-stream-containers.yml index e9ede28..8c810e2 100644 --- a/.github/workflows/centos-stream-containers.yml +++ b/.github/workflows/centos-stream-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/consul-containers.yml b/.github/workflows/consul-containers.yml index 8fbf101..a50d3a6 100644 --- a/.github/workflows/consul-containers.yml +++ b/.github/workflows/consul-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/debian-containers.yml b/.github/workflows/debian-containers.yml index 8f0d881..b12e6c3 100644 --- a/.github/workflows/debian-containers.yml +++ b/.github/workflows/debian-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/etcd-v2-containers.yml b/.github/workflows/etcd-v2-containers.yml index a8614b9..44b7a70 100644 --- a/.github/workflows/etcd-v2-containers.yml +++ b/.github/workflows/etcd-v2-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/etcd-v3-containers.yml b/.github/workflows/etcd-v3-containers.yml index 59ae7dc..1ed9384 100644 --- a/.github/workflows/etcd-v3-containers.yml +++ b/.github/workflows/etcd-v3-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/fedora-containers.yml b/.github/workflows/fedora-containers.yml index bed55b6..ffdbaaa 100644 --- a/.github/workflows/fedora-containers.yml +++ b/.github/workflows/fedora-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/mariadb-containers.yml b/.github/workflows/mariadb-containers.yml index f55d95d..0ea8336 100644 --- a/.github/workflows/mariadb-containers.yml +++ b/.github/workflows/mariadb-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/mysql-server-containers.yml b/.github/workflows/mysql-server-containers.yml index 1aa8647..0fd5192 100644 --- a/.github/workflows/mysql-server-containers.yml +++ b/.github/workflows/mysql-server-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/openldap-minion-containers.yml b/.github/workflows/openldap-minion-containers.yml index 915e13f..4712a76 100644 --- a/.github/workflows/openldap-minion-containers.yml +++ b/.github/workflows/openldap-minion-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/opensuse-containers.yml b/.github/workflows/opensuse-containers.yml index 84a08e9..2eeea4f 100644 --- a/.github/workflows/opensuse-containers.yml +++ b/.github/workflows/opensuse-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/packaging-containers.yml b/.github/workflows/packaging-containers.yml index 9cf7177..e0d0af3 100644 --- a/.github/workflows/packaging-containers.yml +++ b/.github/workflows/packaging-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/percona-containers.yml b/.github/workflows/percona-containers.yml index 703c2fa..ee9818f 100644 --- a/.github/workflows/percona-containers.yml +++ b/.github/workflows/percona-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/photon-containers.yml b/.github/workflows/photon-containers.yml index 06703f1..0bd2e91 100644 --- a/.github/workflows/photon-containers.yml +++ b/.github/workflows/photon-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/python-containers.yml b/.github/workflows/python-containers.yml index 6904d3c..9cd8c4d 100644 --- a/.github/workflows/python-containers.yml +++ b/.github/workflows/python-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/rabbitmq-containers.yml b/.github/workflows/rabbitmq-containers.yml index 129f9f5..88dbd30 100644 --- a/.github/workflows/rabbitmq-containers.yml +++ b/.github/workflows/rabbitmq-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/redis-containers.yml b/.github/workflows/redis-containers.yml index 78a1669..ca6da3b 100644 --- a/.github/workflows/redis-containers.yml +++ b/.github/workflows/redis-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/salt-containers.yml b/.github/workflows/salt-containers.yml index 34fea45..714be7b 100644 --- a/.github/workflows/salt-containers.yml +++ b/.github/workflows/salt-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/salt-gitfs-http-containers.yml b/.github/workflows/salt-gitfs-http-containers.yml index 15589ad..faa4dfc 100644 --- a/.github/workflows/salt-gitfs-http-containers.yml +++ b/.github/workflows/salt-gitfs-http-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/ssh-minion-containers.yml b/.github/workflows/ssh-minion-containers.yml index 8ed056e..c63fcb5 100644 --- a/.github/workflows/ssh-minion-containers.yml +++ b/.github/workflows/ssh-minion-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/tinyproxy-containers.yml b/.github/workflows/tinyproxy-containers.yml index f159c4f..22bad99 100644 --- a/.github/workflows/tinyproxy-containers.yml +++ b/.github/workflows/tinyproxy-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/ubuntu-containers.yml b/.github/workflows/ubuntu-containers.yml index 5ce042c..798bea0 100644 --- a/.github/workflows/ubuntu-containers.yml +++ b/.github/workflows/ubuntu-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/vault-containers.yml b/.github/workflows/vault-containers.yml index b46afa8..7954242 100644 --- a/.github/workflows/vault-containers.yml +++ b/.github/workflows/vault-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/virt-minion-containers.yml b/.github/workflows/virt-minion-containers.yml index 05fbfb1..4249b38 100644 --- a/.github/workflows/virt-minion-containers.yml +++ b/.github/workflows/virt-minion-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/.github/workflows/zookeeper-containers.yml b/.github/workflows/zookeeper-containers.yml index 9d98d3e..11f3838 100644 --- a/.github/workflows/zookeeper-containers.yml +++ b/.github/workflows/zookeeper-containers.yml @@ -64,10 +64,10 @@ jobs: run: | inv containers.matrix --from-workflow ${{ env.PATH_IN_REPO }} - mirror-image: + build: runs-on: ubuntu-latest needs: matrix-generator - name: "${{ matrix.dockerinfo.name }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + name: "${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" strategy: fail-fast: false max-parallel: 10 @@ -100,14 +100,18 @@ jobs: run: | t=$(shuf -i 5-30 -n 1); echo "Sleeping $t seconds"; sleep $t - - name: "Setup DockerFile" - run: | - echo " " >> ./${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.source=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.url=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.documentation=\"https://github.com/${GITHUB_REPOSITORY}/\"" >> ${{matrix.dockerinfo.file}} - echo "LABEL org.opencontainers.image.vendor=\"Unofficial Docker Hub Mirror\"" >> ${{matrix.dockerinfo.file}} - cat ./${{matrix.dockerinfo.file}} + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} + tags: | + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" - name: "Docker QEMU" uses: docker/setup-qemu-action@v3 @@ -133,10 +137,76 @@ jobs: - name: "Build & Publish" uses: docker/build-push-action@v5 + id: build with: file: ${{ matrix.dockerinfo.file }} context: ${{ env.PATH_IN_REPO }} platforms: ${{ matrix.dockerinfo.platform }} push: ${{ github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + outputs: type=image,name=${{ github.repository }}/${{ matrix.dockerinfo.name }},push-by-digest=true,name-canonical=true,push=${{ + github.repository == 'saltstack/salt-ci-containers' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' ) }} + + - name: Export digest + run: | + mkdir -p /tmp/digests + digest="${{ steps.build.outputs.digest }}" + touch "/tmp/digests/${digest#sha256:}" + + - name: Upload digest + uses: actions/upload-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests/* + if-no-files-found: error + retention-days: 1 + + merge: + runs-on: ubuntu-latest + name: "Merge ${{ matrix.dockerinfo.name }}:${{ matrix.dockerinfo.tag }}${{ matrix.dockerinfo.platform && format(' ({0})', matrix.dockerinfo.platform) || ''}}" + strategy: + fail-fast: false + max-parallel: 10 + matrix: + dockerinfo: ${{ fromJson(needs.matrix-generator.outputs.dockerinfo) }} + needs: + - matrix-generator + - build + steps: + - name: Download digests + uses: actions/download-artifact@v3 + with: + name: digests-${{ matrix.dockerinfo.name }}-${{ matrix.dockerinfo.tag }} + path: /tmp/digests + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ github.repository }}/${{ matrix.dockerinfo.name }} tags: | - ghcr.io/${{ github.repository }}/${{ matrix.dockerinfo.name }} + type=semver,pattern={{version}},value=${{ matrix.dockerinfo.tag }} + flavor: | + latest=false + labels: | + org.opencontainers.image.source="https://github.com/${GITHUB_REPOSITORY}/" + + - name: "Log into GitHub Container Registry" + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Create manifest list and push + working-directory: /tmp/digests + run: | + docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ + $(printf '${{ github.repository }}/${{ matrix.dockerinfo.name }}@sha256:%s ' *) + + - name: Inspect image + run: | + docker buildx imagetools inspect ${{ github.repository }}/${{ matrix.dockerinfo.name }}:${{ steps.meta.outputs.version }} diff --git a/tasks/containers.py b/tasks/containers.py index 9641a9e..df96d0b 100644 --- a/tasks/containers.py +++ b/tasks/containers.py @@ -204,7 +204,8 @@ def matrix(ctx, image, from_workflow=False, build_platforms=None): continue output.append( { - "name": f"{details['name']}:{fpath.stem}", + "name": details["name"], + "tag": fpath.stem, "platform": platform, "file": str(fpath.relative_to(utils.REPO_ROOT)), "source_container": source_container, @@ -215,7 +216,8 @@ def matrix(ctx, image, from_workflow=False, build_platforms=None): # This is because the buildx inspect did not return anything output.append( { - "name": f"{details['name']}:{fpath.stem}", + "name": details["name"], + "tag": fpath.stem, "file": str(fpath.relative_to(utils.REPO_ROOT)), "source_container": source_container, "platform": "",