Skip to content

Commit

Permalink
Split image cleanup job into its own workflow (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
alessfg authored Feb 23, 2024
1 parent 415fab7 commit 65ace00
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 124 deletions.
31 changes: 0 additions & 31 deletions .github/workflows/alpine-mainline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -374,34 +374,3 @@ jobs:
DOCKER_CONTENT_TRUST_REPOSITORY_KEY_ID: ${{ secrets.DOCKER_CONTENT_TRUST_REPOSITORY_KEY_ID }}
DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE: ${{ secrets.DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE }}
NOTARY_TARGETS_PASSPHRASE: ${{ secrets.DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE }}

cleanup:
name: Delete untagged Alpine NGINX mainline Docker images on the Amazon ECR Public Gallery and the GitHub Container Registry
if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
needs: [slim, core, perl]
steps:
- name: Check out the codebase
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
aws-region: ${{ secrets.AWS_REGION }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Delete untagged Alpine NGINX mainline Docker images on the Amazon ECR Public Gallery
run: |
.github/workflows/scripts/delete-untagged-amazon-public-ecr-images.sh
- name: Delete untagged Alpine NGINX mainline Docker images on the GitHub Container Registry
uses: stumpylog/image-cleaner-action/untagged@9255a1b3b8ca44b3e5887e2168155223b277ca1d # v0.5.0
with:
is_org: true
owner: nginxinc
package_name: nginx-unprivileged
do_delete: true
token: ${{ secrets.GITHUB_TOKEN }}
31 changes: 0 additions & 31 deletions .github/workflows/alpine-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -350,34 +350,3 @@ jobs:
DOCKER_CONTENT_TRUST_REPOSITORY_KEY_ID: ${{ secrets.DOCKER_CONTENT_TRUST_REPOSITORY_KEY_ID }}
DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE: ${{ secrets.DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE }}
NOTARY_TARGETS_PASSPHRASE: ${{ secrets.DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE }}

cleanup:
name: Delete untagged Alpine NGINX stable Docker images on the Amazon ECR Public Gallery and the GitHub Container Registry
if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
needs: [slim, core, perl]
steps:
- name: Check out the codebase
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
aws-region: ${{ secrets.AWS_REGION }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Delete untagged Alpine NGINX stable Docker images on the Amazon ECR Public Gallery
run: |
.github/workflows/scripts/delete-untagged-amazon-public-ecr-images.sh
- name: Delete untagged Alpine NGINX stable Docker images on the GitHub Container Registry
uses: stumpylog/image-cleaner-action/untagged@9255a1b3b8ca44b3e5887e2168155223b277ca1d # v0.5.0
with:
is_org: true
owner: nginxinc
package_name: nginx-unprivileged
do_delete: true
token: ${{ secrets.GITHUB_TOKEN }}
31 changes: 0 additions & 31 deletions .github/workflows/debian-mainline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -259,34 +259,3 @@ jobs:
DOCKER_CONTENT_TRUST_REPOSITORY_KEY_ID: ${{ secrets.DOCKER_CONTENT_TRUST_REPOSITORY_KEY_ID }}
DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE: ${{ secrets.DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE }}
NOTARY_TARGETS_PASSPHRASE: ${{ secrets.DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE }}

cleanup:
name: Delete untagged Debian NGINX mainline Docker images on the Amazon ECR Public Gallery and the GitHub Container Registry
if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
needs: [core, perl]
steps:
- name: Check out the codebase
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
aws-region: ${{ secrets.AWS_REGION }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Delete untagged Debian NGINX mainline Docker images on the Amazon ECR Public Gallery
run: |
.github/workflows/scripts/delete-untagged-amazon-public-ecr-images.sh
- name: Delete untagged Debian NGINX mainline Docker images on the GitHub Container Registry
uses: stumpylog/image-cleaner-action/untagged@9255a1b3b8ca44b3e5887e2168155223b277ca1d # v0.5.0
with:
is_org: true
owner: nginxinc
package_name: nginx-unprivileged
do_delete: true
token: ${{ secrets.GITHUB_TOKEN }}
31 changes: 0 additions & 31 deletions .github/workflows/debian-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -243,34 +243,3 @@ jobs:
DOCKER_CONTENT_TRUST_REPOSITORY_KEY_ID: ${{ secrets.DOCKER_CONTENT_TRUST_REPOSITORY_KEY_ID }}
DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE: ${{ secrets.DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE }}
NOTARY_TARGETS_PASSPHRASE: ${{ secrets.DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE }}

cleanup:
name: Delete untagged Debian NGINX stable Docker images on the Amazon ECR Public Gallery and the GitHub Container Registry
if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
needs: [core, perl]
steps:
- name: Check out the codebase
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
aws-region: ${{ secrets.AWS_REGION }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Delete untagged Debian NGINX stable Docker images on the Amazon ECR Public Gallery
run: |
.github/workflows/scripts/delete-untagged-amazon-public-ecr-images.sh
- name: Delete untagged Debian NGINX stable Docker images on the GitHub Container Registry
uses: stumpylog/image-cleaner-action/untagged@9255a1b3b8ca44b3e5887e2168155223b277ca1d # v0.5.0
with:
is_org: true
owner: nginxinc
package_name: nginx-unprivileged
do_delete: true
token: ${{ secrets.GITHUB_TOKEN }}
37 changes: 37 additions & 0 deletions .github/workflows/image-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: Image Cleanup
on:
workflow_dispatch:
workflow_run:
workflows: [Alpine Mainline, Alpine Stable, Debian Mainline, Debian Stable]
types: [completed]
jobs:
cleanup:
name: Delete untagged NGINX Unprivileged Docker images on the Amazon ECR Public Gallery and the GitHub Container Registry
# if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false
steps:
- name: Check out the codebase
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
aws-region: ${{ secrets.AWS_REGION }}
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

- name: Delete untagged NGINX Unprivileged Docker images on the Amazon ECR Public Gallery
run: |
.github/workflows/scripts/delete-untagged-amazon-public-ecr-images.sh
- name: Delete untagged NGINX Unprivileged Docker images on the GitHub Container Registry
uses: stumpylog/image-cleaner-action/untagged@9255a1b3b8ca44b3e5887e2168155223b277ca1d # v0.5.0
with:
is_org: true
owner: nginxinc
package_name: nginx-unprivileged
do_delete: true
token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 65ace00

Please sign in to comment.