Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/prune-contaiers: add a GC script for containers images #3826

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jbtrystram
Copy link
Contributor

This script calls skopeo delete to prune image from a remote directory. Currently only supports the FCOS tag structure.

If no duration is specified, no image will be pruned.

See coreos/fedora-coreos-tracker#1367 See coreos/fedora-coreos-pipeline#995

This script calls skopeo delete to prune image from a remote
directory. Currently only supports the FCOS tag structure.

If no duration is specified, no image will be pruned.

See coreos/fedora-coreos-tracker#1367
See coreos/fedora-coreos-pipeline#995
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised by the choice of bash. I think any new command with non-trivial logic should be written in one of the other two languages in this repo (Python or Go).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comments below are only about overall logic and not bash-specific things.


for tag in $tags; do

# ignore the named moving tags ("stable", "next" etc..)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I would generalize this as "ignore all tags that don't match the build ID format".

# value
tag_age=$(( today - $(date -d "${build_date}" +%s) ))

# test for production streams. Production stream id are 1, 2 and 3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be nice to follow a model closer to cosa cloud-prune where the policy is encoded in a separate YAML file that this command reads in. That would allow us to keep that file in e.g. fedora-coreos-pipeline and possibly down the the line have a similar file for RHCOS.

# test for production streams. Production stream id are 1, 2 and 3
if [[ $stream -eq 1 || $stream -eq 2 || $stream -eq 3 ]]; then
if [[ $tag_age -gt "$prod_age_seconds" ]]; then
echo "Production tag ${tag} is older than ${PROD_AGE}, pruning."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't considering barrier releases.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess i would have to pull the builds.json for each stream to see if the release is a barrier..
is a LABEL attached to the container to indicate they are barrier releases ? That would be neat

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The source of truth for barriers is in https://github.com/coreos/fedora-coreos-streams/tree/main/updates. You can download from there, or from the S3-uploaded version (e.g. https://builds.coreos.fedoraproject.org/updates/testing.json).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants