From 178bc0b7e678a3be0c79fd5b7f904f1c1a83fd7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sondre=20Lilleb=C3=B8=20Gundersen?= Date: Mon, 24 Jun 2024 19:53:04 +0200 Subject: [PATCH] chore: Update test workflow to test v3-develop branch One final test run before merging v3. --- .github/workflows/build.yml | 76 ++++++++++++++++++++++++++++++------- 1 file changed, 62 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fb4cf76..ac45c7f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,39 +1,87 @@ -name: Produce packages +name: Test action main branch on: workflow_dispatch: schedule: - - cron: "*/3 * * * *" # every 3 hours + - cron: "5 * * * *" # every hour jobs: - build: + clean: runs-on: ubuntu-latest + name: Ubuntu with classic personal access token + steps: + - uses: snok/container-retention-policy@v3-develop + name: Delete test-1-* images with a temporal token + with: + account: snok + token: ${{ secrets.GITHUB_TOKEN }} + cut-off: 2h + image-names: container-retention-policy + image-tags: test-* !test-2* !test-3* !test-4* !test-5* + tag-selection: tagged + timestamp-to-use: created_at + dry-run: false + rust-log: container_retention_policy=debug + + - name: Generate a token + id: generate-token + uses: actions/create-github-app-token@v1 + with: + app-id: 911530 + private-key: ${{ secrets.GH_APP_PRIVATE_KEY }} + + - uses: snok/container-retention-policy@v3-develop + name: Delete test-2-* images with an Github app token + with: + account: snok + token: ${{ steps.generate-token.outputs.token }} + cut-off: 2h + image-names: container-retention-policy + image-tags: test-* !test-3* !test-4* !test-5* + tag-selection: tagged + timestamp-to-use: created_at + dry-run: false + rust-log: container_retention_policy=debug + + - uses: snok/container-retention-policy@v3-develop + name: Delete remaining test images with a PAT + with: + account: snok + token: ${{ secrets.PAT }} + cut-off: 2h + image-names: container-retention-policy + image-tags: test-* + tag-selection: tagged + timestamp-to-use: created_at + dry-run: false + rust-log: container_retention_policy=debug + + produce: + runs-on: ubuntu-latest + name: Upload more test images steps: - - uses: actions/checkout@v4 - uses: docker/setup-buildx-action@v3 - uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build latest + - name: Build empty images run: | for ((i=1; i<=5; i++)) do randomString=$(LC_ALL=C tr -dc A-Za-z0-9 /dev/null || echo RANDOM) - echo "FROM alpine as builder" > Dockerfile - echo "RUN echo \"$randomString\" > test.txt" >> Dockerfile - echo "FROM scratch" >> Dockerfile - echo "COPY --from=builder /test.txt ." >> Dockerfile - + { + echo "FROM alpine as builder" + echo "RUN echo \"$randomString\" > test.txt" + echo "FROM scratch" + echo "COPY --from=builder /test.txt ." + } > Dockerfile imageName="ghcr.io/snok/container-retention-policy:test-${i}" - docker build -f Dockerfile -t "$imageName" --push . - for ((j=1; j<=3; j++)) do docker tag "$imageName" "ghcr.io/snok/container-retention-policy:test-${i}-${j}" docker push "ghcr.io/snok/container-retention-policy:test-${i}-${j}" done - done + done \ No newline at end of file