mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-19 18:18:27 -05:00
feat(gha): add workflow to clean-up old images (#60485)
This commit is contained in:
committed by
GitHub
parent
10f23bcf0c
commit
22fb9bc43b
53
.github/workflows/docker-docr-cleanup.yml
vendored
Normal file
53
.github/workflows/docker-docr-cleanup.yml
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
name: DOCR - Cleanup Container Images
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '5 0 * * 3,6' # 12:05 UTC on Wednesdays and Saturdays (6 hour maintenance window)
|
||||
|
||||
jobs:
|
||||
remove:
|
||||
name: Delete Old Images
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
repos:
|
||||
- learn-api
|
||||
variants:
|
||||
- dev
|
||||
- org
|
||||
|
||||
steps:
|
||||
- name: Install doctl
|
||||
uses: digitalocean/action-doctl@v2
|
||||
with:
|
||||
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
|
||||
|
||||
- name: Log in to DigitalOcean Container Registry with short-lived credentials
|
||||
run: doctl registry login --expiry-seconds 1200
|
||||
|
||||
- name: Delete Images
|
||||
uses: raisedadead/action-docr-cleanup@62b968c928fbb2dbce8b0caf11c0391f0921ea46 # v1
|
||||
with:
|
||||
repository_name: '${{ matrix.variants }}/${{ matrix.repos }}'
|
||||
days: '7'
|
||||
keep_last: '3'
|
||||
|
||||
# NOTE: We don't need to trigger garbage collection because we have a cron job that runs on news repo, which
|
||||
# triggers garbage collection. This can be uncommented should a need arise.
|
||||
|
||||
# clean:
|
||||
# name: Do Garbage Collection
|
||||
# runs-on: ubuntu-latest
|
||||
# needs: remove
|
||||
# steps:
|
||||
# - name: Install doctl
|
||||
# uses: digitalocean/action-doctl@v2
|
||||
# with:
|
||||
# token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
|
||||
|
||||
# - name: Log in to DigitalOcean Container Registry with short-lived credentials
|
||||
# run: doctl registry login --expiry-seconds 1200
|
||||
|
||||
# - name: Trigger Garbage collection
|
||||
# run: doctl registry garbage-collection start --include-untagged-manifests --force
|
||||
Reference in New Issue
Block a user