Skip to content

Automation to delete OCI cache for provider #323

Description

@wagoodman

Today we have provider images that we create daily: https://github.com/orgs/anchore/packages?repo_name=grype-db

We always start with the latest cache on every data sync, however, there are instances where we want to delete todays cache for operational reasons. Ideally this should be done from a workflow that the @anchore/tools team can kick off. This is specifically important since image versions can only be deleted by admins, thus, only a small portion of the team can delete the latest image.

To list packages:

gh api \
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  /orgs/anchore/packages/container/grype-db%2Fdata%2Fnvd/versions

List package versions: https://docs.github.com/en/rest/packages/packages?apiVersion=2022-11-28#list-package-versions-for-a-package-owned-by-an-organization

Ideally we should delete the package version: https://docs.github.com/en/rest/packages/packages?apiVersion=2022-11-28#delete-package-version-for-an-organization

Question: will this approach work for workflow_dispatch if the user kicking it off does not have admin rights?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions