diff --git a/.github/workflows/delete.yml b/.github/workflows/delete.yml index 4acc0f2..dd6a7c7 100644 --- a/.github/workflows/delete.yml +++ b/.github/workflows/delete.yml @@ -9,24 +9,23 @@ on: tag_pattern: description: 'Wildcard pattern for Docker tags to delete' required: true - default: "^branch-name.*" + default: "branch-name" jobs: find-images: 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 - 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 -R -s '. | split("\n") | .[0:-1] | . + ["scyllaridae"]') + jq -c -R -s '. | split("\n") | .[0:-1] | . + ["scyllaridae"]') echo "images=$images" >> $GITHUB_OUTPUT delete-docker-tags: @@ -36,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 @@ -44,7 +44,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/.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: 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)