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-containers: add a GC script for containers images #3826

Merged
merged 2 commits into from
Jul 17, 2024

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

src/cmd-prune-containers Outdated Show resolved Hide resolved
src/cmd-prune-containers Outdated Show resolved Hide resolved
src/cmd-prune-containers Outdated Show resolved Hide resolved
src/cmd-prune-containers Outdated Show resolved Hide resolved
src/cmd-prune-containers Outdated Show resolved Hide resolved
src/cmd-prune-containers Outdated Show resolved Hide resolved
src/cmd-prune-containers Outdated Show resolved Hide resolved
src/cmd-prune-containers Outdated Show resolved Hide resolved
src/cmd-prune-containers Outdated Show resolved Hide resolved
src/cmd-prune-containers Outdated Show resolved Hide resolved
src/cmd-prune-containers Outdated Show resolved Hide resolved
src/cmd-prune-containers Outdated Show resolved Hide resolved
src/cmd-prune-containers Outdated Show resolved Hide resolved
src/cmd-prune-containers Outdated Show resolved Hide resolved
src/cmd-prune-containers Outdated Show resolved Hide resolved
@jlebon
Copy link
Member

jlebon commented Jul 12, 2024

Also, typo in the commit and PR title: s/contaiers/containers/ :)

@jbtrystram jbtrystram changed the title cmd/prune-contaiers: add a GC script for containers images cmd/prune-containers: add a GC script for containers images Jul 12, 2024
@jbtrystram jbtrystram requested a review from jlebon July 12, 2024 16:10
Copy link
Member

@jlebon jlebon left a comment

Choose a reason for hiding this comment

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

I think just the exit(1) bit needs fixing. The rest LGTM as is.

src/cmd-prune-containers Outdated Show resolved Hide resolved
src/cmd-prune-containers Outdated Show resolved Hide resolved
src/cmd-prune-containers Outdated Show resolved Hide resolved
src/cmd-prune-containers Outdated Show resolved Hide resolved
src/cmd-prune-containers Outdated Show resolved Hide resolved
src/cmd-prune-containers Outdated Show resolved Hide resolved
src/cmd-prune-containers Outdated Show resolved Hide resolved
src/cmd-prune-containers Outdated Show resolved Hide resolved
Rework the duration parsing code to support days, weeks,
months and years. Also use a regexp so we don't need the
space.

In preparation for the container garbage collection code,
which will consume the same policy files, move the
code to the shared cosalib.

Also updates the parse_fcos_version to returns the stream id in
a tuple along the build timestamp.
@jbtrystram
Copy link
Contributor Author

jbtrystram commented Jul 16, 2024

Ok I rebased and updated this PR since #3798 landed.

I made a couple of refactorings in cmdlib.py to share code between cloud-prune and this.
@gursewak1997 PTAL at the duration parsing changes suggestion in the first commit.

jlebon
jlebon previously approved these changes Jul 16, 2024
Copy link
Member

@jlebon jlebon left a comment

Choose a reason for hiding this comment

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

Nice! One comment, but LGTM as is!

src/cmd-container-prune Outdated Show resolved Hide resolved
gursewak1997
gursewak1997 previously approved these changes Jul 16, 2024
Copy link
Member

@gursewak1997 gursewak1997 left a comment

Choose a reason for hiding this comment

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

Changes lgtm

@jbtrystram jbtrystram enabled auto-merge (rebase) July 16, 2024 19:48
@gursewak1997
Copy link
Member

/test rhcos

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

This consumes the same policy.yaml defined in
coreos#3798

See coreos/fedora-coreos-tracker#1367
See coreos/fedora-coreos-pipeline#995
@jbtrystram
Copy link
Contributor Author

/override ci/prow/rhcos

Copy link

openshift-ci bot commented Jul 17, 2024

@jbtrystram: jbtrystram unauthorized: /override is restricted to Repo administrators, approvers in top level OWNERS file, and the following github teams:.

In response to this:

/override ci/prow/rhcos

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@jlebon
Copy link
Member

jlebon commented Jul 17, 2024

Prow failing on openshift/os#1551.

/override ci/prow/rhcos

Copy link

openshift-ci bot commented Jul 17, 2024

@jlebon: Overrode contexts on behalf of jlebon: ci/prow/rhcos

In response to this:

Prow failing on openshift/os#1551.

/override ci/prow/rhcos

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@jbtrystram jbtrystram merged commit aea950c into coreos:main Jul 17, 2024
5 checks passed
@jbtrystram jbtrystram deleted the containerGC branch July 17, 2024 18:05
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.

5 participants