From 9886a9f6ff82aafddbee3b808a901254b27e70c6 Mon Sep 17 00:00:00 2001 From: Shizun Ge Date: Fri, 19 Jan 2024 22:11:31 -0800 Subject: [PATCH] keep more dev images and push images used in test to a different package. --- .github/workflows/on-pull-request.yml | 8 ++++---- .github/workflows/on-push.yml | 21 ++++++++++++++++----- .github/workflows/on-release.yml | 8 ++++---- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/.github/workflows/on-pull-request.yml b/.github/workflows/on-pull-request.yml index 616c520..d3ec26f 100644 --- a/.github/workflows/on-pull-request.yml +++ b/.github/workflows/on-pull-request.yml @@ -51,7 +51,7 @@ jobs: - name: Run tests run: | export GANTRY_TEST_ENABLE_TESTS="${{ matrix.test_suit }}" - ./tests/run_all_tests.sh "${{ github.repository }}" "ghcr.io" "${{ github.repository_owner }}" "${{ github.token }}" + ./tests/run_all_tests.sh "${{ github.repository }}-for-test" "ghcr.io" "${{ github.repository_owner }}" "${{ github.token }}" clean-ghcr-tests: name: Delete old tests container images @@ -62,7 +62,7 @@ jobs: - name: Delete old test images uses: snok/container-retention-policy@v2 with: - image-names: gantry + image-names: gantry-for-test # leave some margins in case multiple actions run in parallel cut-off: 5 minutes ago UTC account-type: personal @@ -74,11 +74,11 @@ jobs: - name: Delete untagged images uses: snok/container-retention-policy@v2 with: - image-names: gantry + image-names: gantry-for-test cut-off: 1 second ago UTC account-type: personal token: ${{ secrets.TOKEN_DELETE_GHCR_IMAGES }} keep-at-least: 0 untagged-only: True skip-tags: latest, development - dry-run: False \ No newline at end of file + dry-run: False diff --git a/.github/workflows/on-push.yml b/.github/workflows/on-push.yml index e97fb11..41adce2 100644 --- a/.github/workflows/on-push.yml +++ b/.github/workflows/on-push.yml @@ -58,7 +58,7 @@ jobs: - name: Run tests run: | export GANTRY_TEST_ENABLE_TESTS="${{ matrix.test_suit }}" - ./tests/run_all_tests.sh "${{ github.repository }}" "ghcr.io" "${{ github.repository_owner }}" "${{ github.token }}" + ./tests/run_all_tests.sh "${{ github.repository }}-for-test" "ghcr.io" "${{ github.repository_owner }}" "${{ github.token }}" build_and_push: name: Build and push Docker image @@ -109,7 +109,7 @@ jobs: # echo "Start running tests" # export GANTRY_TEST_CONTAINER_REPO_TAG="${{ github.repository }}:${{ steps.git.outputs.image_tag }}" # export GANTRY_TEST_ENABLE_TESTS="new_image" - # ./tests/run_all_tests.sh "${{ github.repository }}" "ghcr.io" "${{ github.repository_owner }}" "${{ github.token }}" + # ./tests/run_all_tests.sh "${{ github.repository }}-for-test" "ghcr.io" "${{ github.repository_owner }}" "${{ github.token }}" # echo "Done running tests" clean-ghcr-dev: @@ -122,13 +122,24 @@ jobs: uses: snok/container-retention-policy@v2 with: image-names: gantry - cut-off: One day ago UTC + cut-off: One month ago UTC account-type: personal token: ${{ secrets.TOKEN_DELETE_GHCR_IMAGES }} keep-at-least: 5 skip-tags: latest, development filter-tags: "dev-*" dry-run: False + - name: Delete untagged images + uses: snok/container-retention-policy@v2 + with: + image-names: gantry + cut-off: 1 second ago UTC + account-type: personal + token: ${{ secrets.TOKEN_DELETE_GHCR_IMAGES }} + keep-at-least: 0 + untagged-only: True + skip-tags: latest, development + dry-run: False clean-ghcr-tests: name: Delete old tests container images @@ -139,7 +150,7 @@ jobs: - name: Delete old test images uses: snok/container-retention-policy@v2 with: - image-names: gantry + image-names: gantry-for-test # leave some margins in case multiple actions run in parallel cut-off: 5 minutes ago UTC account-type: personal @@ -151,7 +162,7 @@ jobs: - name: Delete untagged images uses: snok/container-retention-policy@v2 with: - image-names: gantry + image-names: gantry-for-test cut-off: 1 second ago UTC account-type: personal token: ${{ secrets.TOKEN_DELETE_GHCR_IMAGES }} diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index efd891c..52f90b6 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -53,7 +53,7 @@ jobs: - name: Run tests run: | export GANTRY_TEST_ENABLE_TESTS="${{ matrix.test_suit }}" - ./tests/run_all_tests.sh "${{ github.repository }}" "ghcr.io" "${{ github.repository_owner }}" "${{ github.token }}" + ./tests/run_all_tests.sh "${{ github.repository }}-for-test" "ghcr.io" "${{ github.repository_owner }}" "${{ github.token }}" build_and_push: name: Build and push Docker image @@ -102,7 +102,7 @@ jobs: # echo "Start running tests" # export GANTRY_TEST_CONTAINER_REPO_TAG="${{ github.repository }}:${{ steps.git.outputs.image_tag }}" # export GANTRY_TEST_ENABLE_TESTS="new_image" - # ./tests/run_all_tests.sh "${{ github.repository }}" "ghcr.io" "${{ github.repository_owner }}" "${{ github.token }}" + # ./tests/run_all_tests.sh "${{ github.repository }}-for-test" "ghcr.io" "${{ github.repository_owner }}" "${{ github.token }}" # echo "Done running tests" clean-ghcr-tests: @@ -114,7 +114,7 @@ jobs: - name: Delete old test images uses: snok/container-retention-policy@v2 with: - image-names: gantry + image-names: gantry-for-test # leave some margins in case multiple actions run in parallel cut-off: 5 minutes ago UTC account-type: personal @@ -126,7 +126,7 @@ jobs: - name: Delete untagged images uses: snok/container-retention-policy@v2 with: - image-names: gantry + image-names: gantry-for-test cut-off: 1 second ago UTC account-type: personal token: ${{ secrets.TOKEN_DELETE_GHCR_IMAGES }}