From 8f9344f3cfb1d36519b0d74e318ed97450dc7b06 Mon Sep 17 00:00:00 2001 From: Pedro Algarvio Date: Fri, 24 Nov 2023 16:45:38 +0000 Subject: [PATCH] Switch to python-tools-scripts Signed-off-by: Pedro Algarvio --- .github/workflows/.container.template.j2 | 16 +++-- .github/workflows/almalinux-containers.yml | 16 +++-- .github/workflows/amazonlinux-containers.yml | 16 +++-- .github/workflows/archlinux-containers.yml | 16 +++-- .github/workflows/busybox-containers.yml | 16 +++-- .github/workflows/centos-containers.yml | 16 +++-- .../workflows/centos-stream-containers.yml | 16 +++-- .github/workflows/consul-containers.yml | 16 +++-- .github/workflows/debian-containers.yml | 16 +++-- .github/workflows/etcd-v2-containers.yml | 16 +++-- .github/workflows/etcd-v3-containers.yml | 16 +++-- .github/workflows/fedora-containers.yml | 16 +++-- .github/workflows/mariadb-containers.yml | 16 +++-- .github/workflows/mysql-server-containers.yml | 16 +++-- .../workflows/openldap-minion-containers.yml | 16 +++-- .github/workflows/opensuse-containers.yml | 16 +++-- .github/workflows/packaging-containers.yml | 16 +++-- .github/workflows/percona-containers.yml | 16 +++-- .github/workflows/photon-containers.yml | 16 +++-- .github/workflows/python-containers.yml | 16 +++-- .github/workflows/rabbitmq-containers.yml | 16 +++-- .github/workflows/redis-containers.yml | 16 +++-- .github/workflows/salt-containers.yml | 16 +++-- .../workflows/salt-gitfs-http-containers.yml | 16 +++-- .github/workflows/ssh-minion-containers.yml | 16 +++-- .github/workflows/tinyproxy-containers.yml | 16 +++-- .github/workflows/ubuntu-containers.yml | 16 +++-- .github/workflows/vault-containers.yml | 16 +++-- .github/workflows/virt-minion-containers.yml | 16 +++-- .github/workflows/zookeeper-containers.yml | 16 +++-- requirements.in | 1 + requirements.txt | 24 ++++++++ tools/__init__.py | 1 + tools/ci.py | 58 +++++++++++++++++++ 34 files changed, 444 insertions(+), 120 deletions(-) create mode 100644 tools/ci.py diff --git a/.github/workflows/.container.template.j2 b/.github/workflows/.container.template.j2 index 1960ebb..cb91e14 100644 --- a/.github/workflows/.container.template.j2 +++ b/.github/workflows/.container.template.j2 @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/almalinux-containers.yml b/.github/workflows/almalinux-containers.yml index 7276a84..149dc41 100644 --- a/.github/workflows/almalinux-containers.yml +++ b/.github/workflows/almalinux-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/amazonlinux-containers.yml b/.github/workflows/amazonlinux-containers.yml index a703254..3e62115 100644 --- a/.github/workflows/amazonlinux-containers.yml +++ b/.github/workflows/amazonlinux-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/archlinux-containers.yml b/.github/workflows/archlinux-containers.yml index 2a00df8..42da43c 100644 --- a/.github/workflows/archlinux-containers.yml +++ b/.github/workflows/archlinux-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/busybox-containers.yml b/.github/workflows/busybox-containers.yml index 790ff60..1f90e56 100644 --- a/.github/workflows/busybox-containers.yml +++ b/.github/workflows/busybox-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/centos-containers.yml b/.github/workflows/centos-containers.yml index 0e4f7ea..8b1bbbf 100644 --- a/.github/workflows/centos-containers.yml +++ b/.github/workflows/centos-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/centos-stream-containers.yml b/.github/workflows/centos-stream-containers.yml index 4eca397..32515c4 100644 --- a/.github/workflows/centos-stream-containers.yml +++ b/.github/workflows/centos-stream-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/consul-containers.yml b/.github/workflows/consul-containers.yml index 24ef688..0e03e95 100644 --- a/.github/workflows/consul-containers.yml +++ b/.github/workflows/consul-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/debian-containers.yml b/.github/workflows/debian-containers.yml index 9ebc9d4..0a98db6 100644 --- a/.github/workflows/debian-containers.yml +++ b/.github/workflows/debian-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/etcd-v2-containers.yml b/.github/workflows/etcd-v2-containers.yml index dd3a3b0..c8b893f 100644 --- a/.github/workflows/etcd-v2-containers.yml +++ b/.github/workflows/etcd-v2-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/etcd-v3-containers.yml b/.github/workflows/etcd-v3-containers.yml index 83c481a..dca1c63 100644 --- a/.github/workflows/etcd-v3-containers.yml +++ b/.github/workflows/etcd-v3-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/fedora-containers.yml b/.github/workflows/fedora-containers.yml index f8b10dc..5f380ab 100644 --- a/.github/workflows/fedora-containers.yml +++ b/.github/workflows/fedora-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/mariadb-containers.yml b/.github/workflows/mariadb-containers.yml index f06d082..f63e841 100644 --- a/.github/workflows/mariadb-containers.yml +++ b/.github/workflows/mariadb-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/mysql-server-containers.yml b/.github/workflows/mysql-server-containers.yml index bf84186..595a45d 100644 --- a/.github/workflows/mysql-server-containers.yml +++ b/.github/workflows/mysql-server-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/openldap-minion-containers.yml b/.github/workflows/openldap-minion-containers.yml index 84c1900..4fa23ae 100644 --- a/.github/workflows/openldap-minion-containers.yml +++ b/.github/workflows/openldap-minion-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/opensuse-containers.yml b/.github/workflows/opensuse-containers.yml index cdf3241..b66cf5b 100644 --- a/.github/workflows/opensuse-containers.yml +++ b/.github/workflows/opensuse-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/packaging-containers.yml b/.github/workflows/packaging-containers.yml index 77a4736..4177b57 100644 --- a/.github/workflows/packaging-containers.yml +++ b/.github/workflows/packaging-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/percona-containers.yml b/.github/workflows/percona-containers.yml index c29e849..f359022 100644 --- a/.github/workflows/percona-containers.yml +++ b/.github/workflows/percona-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/photon-containers.yml b/.github/workflows/photon-containers.yml index 59c2d9a..a5d1f02 100644 --- a/.github/workflows/photon-containers.yml +++ b/.github/workflows/photon-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/python-containers.yml b/.github/workflows/python-containers.yml index ced7e1e..054e5b9 100644 --- a/.github/workflows/python-containers.yml +++ b/.github/workflows/python-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/rabbitmq-containers.yml b/.github/workflows/rabbitmq-containers.yml index fee728a..b0a39a1 100644 --- a/.github/workflows/rabbitmq-containers.yml +++ b/.github/workflows/rabbitmq-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/redis-containers.yml b/.github/workflows/redis-containers.yml index c53ee0d..ffbd077 100644 --- a/.github/workflows/redis-containers.yml +++ b/.github/workflows/redis-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/salt-containers.yml b/.github/workflows/salt-containers.yml index 0f6b057..0815711 100644 --- a/.github/workflows/salt-containers.yml +++ b/.github/workflows/salt-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/salt-gitfs-http-containers.yml b/.github/workflows/salt-gitfs-http-containers.yml index 10fca9d..e47c535 100644 --- a/.github/workflows/salt-gitfs-http-containers.yml +++ b/.github/workflows/salt-gitfs-http-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/ssh-minion-containers.yml b/.github/workflows/ssh-minion-containers.yml index 3512108..72e5ad3 100644 --- a/.github/workflows/ssh-minion-containers.yml +++ b/.github/workflows/ssh-minion-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/tinyproxy-containers.yml b/.github/workflows/tinyproxy-containers.yml index e8e0e30..8cfab1a 100644 --- a/.github/workflows/tinyproxy-containers.yml +++ b/.github/workflows/tinyproxy-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/ubuntu-containers.yml b/.github/workflows/ubuntu-containers.yml index bbba123..67e9198 100644 --- a/.github/workflows/ubuntu-containers.yml +++ b/.github/workflows/ubuntu-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/vault-containers.yml b/.github/workflows/vault-containers.yml index 6530e33..dba9123 100644 --- a/.github/workflows/vault-containers.yml +++ b/.github/workflows/vault-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/virt-minion-containers.yml b/.github/workflows/virt-minion-containers.yml index 4714159..ef76f6f 100644 --- a/.github/workflows/virt-minion-containers.yml +++ b/.github/workflows/virt-minion-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/.github/workflows/zookeeper-containers.yml b/.github/workflows/zookeeper-containers.yml index 02c0dd8..7491918 100644 --- a/.github/workflows/zookeeper-containers.yml +++ b/.github/workflows/zookeeper-containers.yml @@ -147,7 +147,7 @@ jobs: if: ${{ github.repository == 'saltstack/salt-ci-containers' && contains(fromJSON('["push", "schedule", "workflow_dispatch"]'), github.event_name) }} run: | mkdir -p /tmp/digests - touch /tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ":" -f 2) + touch "/tmp/digests/$(echo ${{ steps.build.outputs.digest }} | cut -d ':' -f 2)" ls -lah /tmp/digests - name: Upload digest @@ -190,6 +190,15 @@ jobs: name: digests-${{ needs.matrix-generator.outputs.name }}-${{ matrix.tag }} path: /tmp/digests + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install Requirements + run: | + python -m pip install -r requirements.txt + - name: Show digests run: | tree -a /tmp/digests @@ -218,9 +227,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests - run: | # shellcheck disable=SC2046 - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf 'ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }}@sha256:%s ' *) + run: + tools ci create-manifest-list-and-push ghcr.io/${{ github.repository }}/${{ needs.matrix-generator.outputs.name }} /tmp/digests - name: Inspect image run: | diff --git a/requirements.in b/requirements.in index b8a77c7..01f0b61 100644 --- a/requirements.in +++ b/requirements.in @@ -2,3 +2,4 @@ invoke blessings pyyaml jinja2 +python-tools-scripts diff --git a/requirements.txt b/requirements.txt index a3f0743..2162ae1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,15 +4,39 @@ # # pip-compile --output-file=requirements.txt requirements.in # +attrs==23.1.0 + # via python-tools-scripts blessings==1.7 # via -r requirements.in +certifi==2023.11.17 + # via requests +charset-normalizer==3.3.2 + # via requests +idna==3.4 + # via requests invoke==1.7.1 # via -r requirements.in jinja2==3.1.2 # via -r requirements.in +markdown-it-py==3.0.0 + # via rich markupsafe==2.1.1 # via jinja2 +mdurl==0.1.2 + # via markdown-it-py +pygments==2.17.2 + # via rich +python-tools-scripts==0.18.4 + # via -r requirements.in pyyaml==6.0 # via -r requirements.in +requests==2.31.0 + # via python-tools-scripts +rich==13.7.0 + # via python-tools-scripts six==1.16.0 # via blessings +typing-extensions==4.8.0 + # via python-tools-scripts +urllib3==2.1.0 + # via requests diff --git a/tools/__init__.py b/tools/__init__.py index daa4996..360643e 100644 --- a/tools/__init__.py +++ b/tools/__init__.py @@ -4,6 +4,7 @@ import ptscripts +ptscripts.register_tools_module("tools.ci") ptscripts.register_tools_module("tools.pre_commit") for name in ("boto3", "botocore", "urllib3"): diff --git a/tools/ci.py b/tools/ci.py new file mode 100644 index 0000000..a5deee8 --- /dev/null +++ b/tools/ci.py @@ -0,0 +1,58 @@ +""" +These commands are used by pre-commit. +""" +# pylint: disable=resource-leakage,broad-except,3rd-party-module-not-gated +from __future__ import annotations + +import json +import logging +import os +import pathlib +import shutil + +from ptscripts import command_group +from ptscripts import Context + +log = logging.getLogger(__name__) + +# Define the command group +cgroup = command_group(name="ci", help="CI Related Commands", description=__doc__) + + +@cgroup.command( + name="create-manifest-list-and-push", + arguments={ + "container": { + "help": "Container name", + }, + "digests": { + "help": "Digests path", + }, + }, +) +def create_manifest_list_and_push(ctx: Context, container: str, digests: pathlib.Path): + """ + Create manifest list and push. + """ + docker = shutil.which("docker") + if not docker: + ctx.warn("Could not find the 'docker' binary") + ctx.exit(0) + cmdline = [docker, "buildx", "imagetools" "create"] + if "DOCKER_METADATA_OUTPUT_JSON" not in os.environ: + ctx.error("The 'DOCKER_METADATA_OUTPUT_JSON' environment variable is not set") + ctx.exit(1) + + try: + data = json.loads(os.environ["DOCKER_METADATA_OUTPUT_JSON"]) + except ValueError: + ctx.error("Failed to load JSON from the 'DOCKER_METADATA_OUTPUT_JSON' environment variable") + ctx.exit(1) + + for tag in data["tags"]: + cmdline.append(tag) + + for fpath in digests.iterdir(): + cmdline.append(f"{container}@sha256:{fpath.name}") + + ctx.run(*cmdline)