Code Monkey home page Code Monkey logo

Comments (3)

sethvargo avatar sethvargo commented on June 14, 2024 2

Yea, it matches untagged images too.

from gcr-cleaner.

rjpeter2 avatar rjpeter2 commented on June 14, 2024

Which is good! Except, the keep logic includes the untagged images as well. I think this is undesired behavior.
If I have images tagged like so:
<>
<1.0.8>
<1.0.7>
<1.0.6>
<1.0.5>
<>
Where <> are untagged images.
Then if I run a filter like so:
-tag-filter-any "^(\d+).(\d+).(\d+)$" -keep 3

I would expect it to delete the untagged images and image 1.0.5, keeping 1.0.8, 1.0.7, and 1.0.6. But this is not the case. It will delete 1.0.6, 1.0.5, and the untagged image after 1.0.5. This is not very glamorous but I think a solution that would fix this without a bunch of refactoring would be to change this line in pkg/gcrcleaner/cleaner.go:
if keepCount < keep { to if keepCount < keep && len(m.Tags) != 0 {

Let me know if you'd like this change and I can whip up a PR.

from gcr-cleaner.

sethvargo avatar sethvargo commented on June 14, 2024

I think the core of the issue is:

the keep logic includes the untagged images as well...

And what the right behavior is here. In my head, "keep" means keep N things, not keep N tagged things but delete everything else.

from gcr-cleaner.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.