From 54c7e45dccf3607a507fef625f982a53c5627f16 Mon Sep 17 00:00:00 2001 From: Joe Corall Date: Sat, 16 Nov 2024 09:21:56 -0500 Subject: [PATCH 1/6] fixup delete --- .github/workflows/delete.yml | 2 +- .github/workflows/lint-test-build.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/delete.yml b/.github/workflows/delete.yml index 6a5a62a..1abafaa 100644 --- a/.github/workflows/delete.yml +++ b/.github/workflows/delete.yml @@ -26,7 +26,7 @@ jobs: dockerFiles=$(find examples -name Dockerfile | jq -c --raw-input --slurp 'split("\n")| .[0:-1]') images=$(echo "$dockerFiles" | jq -r '.[]' | \ awk -F'/' '{print "scyllaridae-" $2}' | \ - jq -R -s '. | split("\n") | .[0:-1] | . + ["scyllaridae"]') + jq -c -R -s '. | split("\n") | .[0:-1] | . + ["scyllaridae"]') echo "images=$images" >> $GITHUB_OUTPUT delete-docker-tags: diff --git a/.github/workflows/lint-test-build.yml b/.github/workflows/lint-test-build.yml index 01b1660..13d0878 100644 --- a/.github/workflows/lint-test-build.yml +++ b/.github/workflows/lint-test-build.yml @@ -4,6 +4,7 @@ on: paths-ignore: - '**/*.md' - 'ci/**' + - '.github/workflows/delete.yml' tags: - '*' branches: From eba460ab9ac7ffc74ce4a005a7360a367a8e40e4 Mon Sep 17 00:00:00 2001 From: Joe Corall Date: Sat, 16 Nov 2024 09:24:08 -0500 Subject: [PATCH 2/6] Update delete.yml --- .github/workflows/delete.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/delete.yml b/.github/workflows/delete.yml index 1abafaa..bd8829f 100644 --- a/.github/workflows/delete.yml +++ b/.github/workflows/delete.yml @@ -16,7 +16,7 @@ jobs: name: Find docker images needing deleted runs-on: ubuntu-latest outputs: - dockerFiles: ${{ steps.images.outputs.images }} + images: ${{ steps.images.outputs.images }} steps: - uses: actions/checkout@v4 From 68af573abfabd894ed6347e5c1c8775b5349618a Mon Sep 17 00:00:00 2001 From: Joe Corall Date: Sat, 16 Nov 2024 09:25:41 -0500 Subject: [PATCH 3/6] Update delete.yml --- .github/workflows/delete.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/delete.yml b/.github/workflows/delete.yml index bd8829f..741c03b 100644 --- a/.github/workflows/delete.yml +++ b/.github/workflows/delete.yml @@ -23,8 +23,7 @@ jobs: - name: Find docker files id: images run: | - dockerFiles=$(find examples -name Dockerfile | jq -c --raw-input --slurp 'split("\n")| .[0:-1]') - images=$(echo "$dockerFiles" | jq -r '.[]' | \ + images=$(find examples -name Dockerfile | jq -c --raw-input --slurp 'split("\n")| .[0:-1]' | jq -r '.[]' | \ awk -F'/' '{print "scyllaridae-" $2}' | \ jq -c -R -s '. | split("\n") | .[0:-1] | . + ["scyllaridae"]') echo "images=$images" >> $GITHUB_OUTPUT From f07bd3b0e29b8451ee087ae590b3c4b5173da5df Mon Sep 17 00:00:00 2001 From: Joe Corall Date: Sat, 16 Nov 2024 09:27:38 -0500 Subject: [PATCH 4/6] Update delete.yml --- .github/workflows/delete.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/delete.yml b/.github/workflows/delete.yml index 741c03b..6e17ad9 100644 --- a/.github/workflows/delete.yml +++ b/.github/workflows/delete.yml @@ -9,7 +9,7 @@ on: tag_pattern: description: 'Wildcard pattern for Docker tags to delete' required: true - default: "^branch-name.*" + default: "branch-name" jobs: find-images: From 9149b8b3c557877fa72a9800b127fff9b5f84b6a Mon Sep 17 00:00:00 2001 From: Joe Corall Date: Sat, 16 Nov 2024 09:32:47 -0500 Subject: [PATCH 5/6] DOCKER_PASSWORD --- .github/workflows/delete.yml | 2 +- ci/delete-tags.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/delete.yml b/.github/workflows/delete.yml index 14bceef..60cc060 100644 --- a/.github/workflows/delete.yml +++ b/.github/workflows/delete.yml @@ -43,7 +43,7 @@ jobs: run: ./ci/delete-tags.sh env: DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} - DOCKER_ACCESS_TOKEN: ${{ secrets.DOCKER_ACCESS_TOKEN }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} DOCKER_REPOSITORY: "lehighlts" DOCKER_IMAGE: ${{ matrix.image }} TAG_PATTERN: "^${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag_pattern || github.ref_name }}.*" diff --git a/ci/delete-tags.sh b/ci/delete-tags.sh index d117540..bf655a4 100755 --- a/ci/delete-tags.sh +++ b/ci/delete-tags.sh @@ -9,7 +9,7 @@ fi echo "Deleting tags matching pattern '$TAG_PATTERN' in repository ${DOCKER_IMAGE}" -curl -s -o response.json -u "${DOCKER_USERNAME}:${DOCKER_ACCESS_TOKEN}" "https://hub.docker.com/v2/repositories/${DOCKER_REPOSITORY}/${DOCKER_IMAGE}/tags?page_size=100" +curl -s -o response.json -u "${DOCKER_USERNAME}:${DOCKER_PASSWORD}" "https://hub.docker.com/v2/repositories/${DOCKER_REPOSITORY}/${DOCKER_IMAGE}/tags?page_size=100" TAGS=$(jq -r '.results[].name' response.json) if [ -z "$TAGS" ] || [ "$TAGS" = "null" ]; then echo "No tags found or failed to retrieve tags." @@ -18,7 +18,7 @@ fi curl -s -o token.json -XPOST \ -H "Content-Type: application/json" \ - -d '{"username": "'"${DOCKER_USERNAME}"'", "password": "'"${DOCKER_ACCESS_TOKEN}"'"}' \ + -d '{"username": "'"${DOCKER_USERNAME}"'", "password": "'"${DOCKER_PASSWORD}"'"}' \ "https://hub.docker.com/v2/users/login" TOKEN=$(jq -r .token token.json) From f8366540646fb4c019d7d058350aacae08eab151 Mon Sep 17 00:00:00 2001 From: Joe Corall Date: Sat, 16 Nov 2024 09:36:50 -0500 Subject: [PATCH 6/6] allow images with no tags let others succeed --- .github/workflows/delete.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/delete.yml b/.github/workflows/delete.yml index 60cc060..dd6a7c7 100644 --- a/.github/workflows/delete.yml +++ b/.github/workflows/delete.yml @@ -35,6 +35,7 @@ jobs: matrix: image: ${{ fromJson(needs.find-images.outputs.images )}} max-parallel: 1 # go easy on the dockerhub API + fail-fast: false steps: - name: checkout uses: actions/checkout@v4