Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPSEXP-2893 Add step which cleans the bakery-cache tags older than given period #116

Merged
merged 7 commits into from
Nov 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/cleanup_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ on:
required: false
type: boolean
default: false
clean-old-cache:
description: Delete old cache images
required: false
type: boolean
default: false
old-cache-period:
description: Period to keep cache images
required: false
type: string
default: 2 weeks

env:
ORG: Alfresco
Expand Down Expand Up @@ -62,6 +72,21 @@ jobs:
delete-tags: ${{ env.PR_TAGS }}
dry-run: false

- name: Remove ${{ env.CACHE_REPO }} tags older than ${{ env.PERIOD }} when requested
uses: dataaxiom/ghcr-cleanup-action@98b4022383d6ddb70ccbf6a378b4d8c67a60f066 # v1.0.13
if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.clean-old-cache)
env:
PERIOD: ${{ github.event_name == 'workflow_dispatch' && inputs.old-cache-period || (github.event_name != 'workflow_dispatch' && '2 weeks') }}
with:
token: ${{ secrets.DELETE_PACKAGES_GITHUB_TOKEN }}
owner: ${{ env.ORG }}
repository: ${{ env.REPO }}
packages: ${{ env.CACHE_REPO }}
delete-untagged: false
gionn marked this conversation as resolved.
Show resolved Hide resolved
keep-n-tagged: 0
older-than: ${{ env.PERIOD }}
dry-run: ${{ github.event_name == 'workflow_dispatch' && inputs.dry-run || (github.event_name != 'workflow_dispatch' && 'false') }}

- name: Remove images when requested
uses: dataaxiom/ghcr-cleanup-action@98b4022383d6ddb70ccbf6a378b4d8c67a60f066 # v1.0.13
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
Expand Down
Loading