From ee7d27f0f1d658a4c5a39f1d1ecb386cea62d5a0 Mon Sep 17 00:00:00 2001 From: Craig Knudsen Date: Thu, 28 Sep 2023 14:58:23 -0400 Subject: [PATCH 1/4] Still trying to get old dev images deleted --- .github/workflows/docker-dev.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-dev.yml b/.github/workflows/docker-dev.yml index 2028dc49b..759ba6c96 100644 --- a/.github/workflows/docker-dev.yml +++ b/.github/workflows/docker-dev.yml @@ -40,12 +40,12 @@ jobs: - name: Cleanup Old Images env: DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} - DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }} DOCKER_HUB_REPO: ${{ secrets.DOCKER_HUB_USERNAME }}/webcalendar + DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} # Updated line KEEP_LAST_N_IMAGES: 5 run: | # Get list of tags - RESPONSE=$(curl -s -u $DOCKER_HUB_USERNAME:$DOCKER_HUB_PASSWORD -o /tmp/response.json -w "%{http_code}" https://hub.docker.com/v2/repositories/$DOCKER_HUB_REPO/tags/?page_size=100) + RESPONSE=$(curl -s -u $DOCKER_HUB_USERNAME:$DOCKER_HUB_ACCESS_TOKEN -o /tmp/response.json -w "%{http_code}" https://hub.docker.com/v2/repositories/$DOCKER_HUB_REPO/tags/?page_size=100) # Check HTTP Status Code if [ "$RESPONSE" -ne 200 ]; then @@ -67,7 +67,7 @@ jobs: if [ $COUNTER -ge $KEEP_LAST_N_IMAGES ] then echo "Deleting tag $TAG" - curl -X DELETE -u $DOCKER_HUB_USERNAME:$DOCKER_HUB_PASSWORD https://hub.docker.com/v2/repositories/$DOCKER_HUB_REPO/tags/$TAG/ + curl -X DELETE -u $DOCKER_HUB_USERNAME:$DOCKER_HUB_ACCESS_TOKEN https://hub.docker.com/v2/repositories/$DOCKER_HUB_REPO/tags/$TAG/ else echo "Keeping tag $TAG" fi From 81e1aa900a3f85785f8f69063c8a08a5fcc80b44 Mon Sep 17 00:00:00 2001 From: Craig Knudsen Date: Thu, 28 Sep 2023 15:57:55 -0400 Subject: [PATCH 2/4] Still trying to get old dev images deleted - 2 --- .github/workflows/docker-dev.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-dev.yml b/.github/workflows/docker-dev.yml index 759ba6c96..9d29ac315 100644 --- a/.github/workflows/docker-dev.yml +++ b/.github/workflows/docker-dev.yml @@ -67,7 +67,9 @@ jobs: if [ $COUNTER -ge $KEEP_LAST_N_IMAGES ] then echo "Deleting tag $TAG" - curl -X DELETE -u $DOCKER_HUB_USERNAME:$DOCKER_HUB_ACCESS_TOKEN https://hub.docker.com/v2/repositories/$DOCKER_HUB_REPO/tags/$TAG/ + AUTH_HEADER="Authorization: Basic $(echo -n $DOCKER_HUB_USERNAME:$DOCKER_HUB_ACCESS_TOKEN | base64)" + curl -X DELETE -H "$AUTH_HEADER" https://hub.docker.com/v2/repositories/$DOCKER_HUB_REPO/tags/$TAG/ + #curl -X DELETE -u $DOCKER_HUB_USERNAME:$DOCKER_HUB_ACCESS_TOKEN https://hub.docker.com/v2/repositories/$DOCKER_HUB_REPO/tags/$TAG/ else echo "Keeping tag $TAG" fi From 15aba16b16883145823bae2ad35e25c5bf3e8aca Mon Sep 17 00:00:00 2001 From: Craig Knudsen Date: Thu, 28 Sep 2023 16:20:07 -0400 Subject: [PATCH 3/4] Added action debug --- .github/workflows/docker-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-dev.yml b/.github/workflows/docker-dev.yml index 9d29ac315..75d63f2db 100644 --- a/.github/workflows/docker-dev.yml +++ b/.github/workflows/docker-dev.yml @@ -68,7 +68,7 @@ jobs: then echo "Deleting tag $TAG" AUTH_HEADER="Authorization: Basic $(echo -n $DOCKER_HUB_USERNAME:$DOCKER_HUB_ACCESS_TOKEN | base64)" - curl -X DELETE -H "$AUTH_HEADER" https://hub.docker.com/v2/repositories/$DOCKER_HUB_REPO/tags/$TAG/ + curl -i -X DELETE -u -H "$AUTH_HEADER" https://hub.docker.com/v2/repositories/$DOCKER_HUB_REPO/tags/$TAG/ #curl -X DELETE -u $DOCKER_HUB_USERNAME:$DOCKER_HUB_ACCESS_TOKEN https://hub.docker.com/v2/repositories/$DOCKER_HUB_REPO/tags/$TAG/ else echo "Keeping tag $TAG" From 2f61e94c07eac5bec1197bc99f87826617cf0499 Mon Sep 17 00:00:00 2001 From: Craig Knudsen Date: Fri, 29 Sep 2023 09:38:32 -0400 Subject: [PATCH 4/4] Trying to fix old image cleanup --- .github/workflows/docker-dev.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker-dev.yml b/.github/workflows/docker-dev.yml index 75d63f2db..bbd9dd150 100644 --- a/.github/workflows/docker-dev.yml +++ b/.github/workflows/docker-dev.yml @@ -41,7 +41,8 @@ jobs: env: DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} DOCKER_HUB_REPO: ${{ secrets.DOCKER_HUB_USERNAME }}/webcalendar - DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} # Updated line + DOCKER_HUB_ACCESS_TOKEN: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} + DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }} KEEP_LAST_N_IMAGES: 5 run: | # Get list of tags @@ -67,9 +68,7 @@ jobs: if [ $COUNTER -ge $KEEP_LAST_N_IMAGES ] then echo "Deleting tag $TAG" - AUTH_HEADER="Authorization: Basic $(echo -n $DOCKER_HUB_USERNAME:$DOCKER_HUB_ACCESS_TOKEN | base64)" - curl -i -X DELETE -u -H "$AUTH_HEADER" https://hub.docker.com/v2/repositories/$DOCKER_HUB_REPO/tags/$TAG/ - #curl -X DELETE -u $DOCKER_HUB_USERNAME:$DOCKER_HUB_ACCESS_TOKEN https://hub.docker.com/v2/repositories/$DOCKER_HUB_REPO/tags/$TAG/ + curl -i -X DELETE -u $DOCKER_HUB_USERNAME:$DOCKER_HUB_PASSWORD https://hub.docker.com/v2/repositories/$DOCKER_HUB_REPO/tags/$TAG/ else echo "Keeping tag $TAG" fi