Container Image Cleanup #330
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow prunes container images based on a retention policy. | |
# The workflow runs on the completion of the nightly Docker build workflow. | |
# Only images that are older than 1 day are pruned. This helps ensure that only the latest images are retained. | |
# This workflow supports on-demand execution using the workflow_dispatch event. | |
name: Container Image Cleanup | |
on: | |
workflow_run: | |
workflows: ["Nighly Docker Build"] | |
types: [completed] | |
workflow_dispatch: | |
jobs: | |
prune: | |
name: Prune Container Images | |
runs-on: ubuntu-latest | |
steps: | |
- uses: snok/container-retention-policy@v2 | |
with: | |
image-names: librarium | |
cut-off: 1 day ago UTC | |
timestamp-to-use: created_at | |
account-type: personal | |
org-name: spectrocloud | |
keep-at-least: 1 | |
skip-tags: nightly | |
dry-run: false | |
token-type: github-token | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Slack Notification | |
if: ${{ failure() }} | |
uses: rtCamp/[email protected] | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_PRIVATE_TEAM_WEBHOOK }} | |
SLACK_USERNAME: "spectromate" | |
SLACK_ICON_EMOJI: ":robot_panic:" | |
SLACK_COLOR: ${{ job.status }} | |
SLACK_MESSAGE: 'The nightly docs container prune workflow failed. Review the GitHub Actions logs for more details.' |