Skip to content
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
109 changes: 61 additions & 48 deletions .github/workflows/cleanup_old_docker_containers.yaml
Original file line number Diff line number Diff line change
@@ -1,54 +1,67 @@
---
# This workflow is designed to clean up old Docker container versions in a GitHub repository.
name: Cleanup Old Docker Container Versions
run-name: "${{ github.event_name }} - ${{ github.actor }}"
on:
schedule:
- cron: "0 0 * * 0" # Runs weekly on Sunday at midnight
workflow_dispatch:
inputs:
threshold-days:
description: "Number of days to keep container versions"
required: false
default: "7"
included-tags:
description: "Tags to include for deletion"
required: false
default: "*"
excluded-tags:
description: "Tags to exclude from deletion"
required: false
default: "latest,release*,*.*"
dry-run:
description: "Enable dry-run mode"
required: false
default: "false"
type: "boolean"
debug:
description: "Enable debug mode"
required: false
default: "false"
type: "boolean"
schedule:
- cron: "0 0 * * 0" # Runs weekly on Sunday at midnight
workflow_dispatch:
inputs:
threshold-days:
description: "Number of days to keep container versions"
required: false
default: "7"
included-tags:
description: "Tags to include for deletion"
required: false
default: "*"
excluded-tags:
description: "Tags to exclude from deletion"
required: false
default: "release*,semver,main,latest"
dry-run:
description: "Enable dry-run mode"
required: false
default: true
type: boolean
debug:
description: "Enable debug mode"
required: false
default: false
type: boolean
permissions:
contents: read

jobs:
cleanup:
runs-on: ubuntu-latest
cleanup:
env:
GITHUB_EVENT_NAME: ${{ github.event_name }}
GITHUB_ACTOR: ${{ github.actor }}
THRESHOLD_DAYS: ${{ github.event.inputs.threshold-days || 7 }}
INCLUDED_TAGS: ${{ github.event.inputs.included-tags || '*' }}
EXCLUDED_TAGS: ${{ github.event.inputs.excluded-tags || 'latest,release*,*.*,semver,main' }}
DRY_RUN: ${{ github.event.inputs.dry-run || 'false' }}
DEBUG: ${{ github.event.inputs.debug || 'false' }}
name: "Cleanup Old Docker Container Versions"
runs-on: ubuntu-latest
steps:
- name: "Summary"
run: |
echo "**Event**: $GITHUB_EVENT_NAME"
echo "**Actor**: $GITHUB_ACTOR"
echo "**Threshold days**: $THRESHOLD_DAYS"
echo "**Included tags**: $INCLUDED_TAGS"
echo "**Excluded tags**: $EXCLUDED_TAGS"
echo "**Dry-run**: $DRY_RUN"
echo "**Debug**: $DEBUG"

steps:
- name: "Summary"
run: |
echo "**Event**: ${{ github.event_name }}"
echo "**Actor**: ${{ github.actor }}"
echo "**Threshold days**: ${{ github.event.inputs.threshold-days || 8 }}"
echo "**Included tags**: ${{ github.event.inputs.included-tags || '*' }}"
echo "**Excluded tags**: ${{ github.event.inputs.excluded-tags || 'latest,release*,*.*' }}"
echo "**Dry-run**: ${{ github.event.inputs.dry-run || 'false' }}"
echo "**Debug**: ${{ github.event.inputs.debug || 'false' }}"
- name: Run Container Package Cleanup Action
uses: netcracker/qubership-workflow-hub/actions/container-package-cleanup@v2.0.5
with:
threshold-days: ${{ github.event.inputs.threshold-days || 8 }}
included-tags: ${{ github.event.inputs.included-tags || '*' }}
excluded-tags: ${{ github.event.inputs.excluded-tags || 'latest,release*,*.*' }}
dry-run: ${{ github.event.inputs.dry-run || 'false' }}
debug: ${{ github.event.inputs.debug || 'false' }}
env:
PACKAGE_TOKEN: ${{ secrets.GH_RWD_PACKAGE_TOKEN }}
- name: "Run Container Package Cleanup Action"
uses: netcracker/qubership-workflow-hub/actions/container-package-cleanup@396774180000abdb825cbf150b56cc59c6913db8 #v2.0.5
with:
threshold-days: ${{ env.THRESHOLD_DAYS }}
included-tags: ${{ env.INCLUDED_TAGS }}
excluded-tags: ${{ env.EXCLUDED_TAGS }}
dry-run: ${{ env.DRY_RUN }}
debug: ${{ env.DEBUG }}
env:
PACKAGE_TOKEN: ${{ secrets.GH_RWD_PACKAGE_TOKEN }}
Loading