Skip to content

Remove old images from DigitalOcean's Container Registry

License

Notifications You must be signed in to change notification settings

henrik242/docr-image-remove

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace
This branch is 16 commits ahead of martintomas/docr-image-remove:main.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

982172b · Feb 14, 2024

History

24 Commits
Feb 12, 2024
Nov 30, 2020
Feb 14, 2024
Feb 9, 2024
Feb 12, 2024

Repository files navigation

DigitalOcean Image Remove

This action uses doctl to find and remove old images from Digital Ocean's Container Registry.

  1. Gets the repository manifests using doctl registry repository lm and orders them by the UpdatedAt attribute. By default it will ignore the 10 most recent images
  2. Then deletes the older images using doctl registry repository delete-manifest
  3. Lastly triggers garbage collection to reclaim space in the registry

PRs are welcome.

Usage

Add this step to a job to automatically delete older images as part of a job:

  steps:
    - name: Install doctl
      uses: digitalocean/action-doctl@v2
      with:
        token: ${{ secrets.DIGITALOCEAN_API_KEY }}
    - name: Remove old images from Container Registry
      uses: henrik242/docr-image-remove@v1
      with:
        image_repository: image-repository # required
        buffer_size: 10
        exclude: ^(latest|tag1|tag2)$

Inputs

  • image_repository - (Required) Image repository name in the Container Registry
  • buffer_size - (Optional) Number of recent images. Default is 10
  • exclude - (Optional) Regex expression to exclude in the tags to delete.

History

Based on these efforts:

License

This GitHub Action and associated scripts and documentation in this project are released under the MIT License.

About

Remove old images from DigitalOcean's Container Registry

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%