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

Fix helper resource contains #46

Closed
wants to merge 2 commits into from
Closed

Fix helper resource contains #46

wants to merge 2 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Nov 19, 2020

Hello,

I was looking why the command seiso image history namespace/project --keep 0 wanted to remove our image stream which were running on our integration environment:

INFO Seiso unknown, commit dirty, date today      
INFO Showing results for --commit-limit=0 and --keep=0 
INFO Found image tag candidate: namespace/project:cd3b3c7644b7ab1c1521d9b9d4c518543b5a51e7 
INFO Found image tag candidate: namespace/project:173d28aaf9d2cff8fa469ad1d0c6937326f88d74 
INFO Found image tag candidate: namespace/project:66ada63440a483c6e763bf9b26e4f1cc2e028834

The cd3b3c7644b7ab1c1521d9b9d4c518543b5a51e7 tag is currently running so I was surprised it was a delete candidate.

I had to add a log.info to explicitly shows which tags were found active.

With this, log, I've found that cd3b3c7644b7ab1c1521d9b9d4c518543b5a51e7 tag wasn't found as active.

Then, I continue to debug and found this error in the helper.ResourceContains: it looked only one resource, didn't find the image tag and return.

This PRs fixes it to loop over all Resources up to find one matching.

The final result in my case is:

seiso image history namespace/project --keep 0
INFO Seiso unknown, commit dirty, date today      
INFO Found active image stream tag: namespace/project:725fe0e277a9055504c32f2d56e3aa2bfb9ab62b 
INFO Found active image stream tag: namespace/project:cd3b3c7644b7ab1c1521d9b9d4c518543b5a51e7 
INFO Found active image stream tag: namespace/project:173d28aaf9d2cff8fa469ad1d0c6937326f88d74 
INFO Found active image stream tag: namespace/project:66ada63440a483c6e763bf9b26e4f1cc2e028834 
INFO No inactive image stream tags found           
 - namespace=logi-winbiz 
 - 📺 image=backend

Unfortunately, I don't know Go and so I'm not be able to add / fix the unit tests.

@ghost
Copy link
Author

ghost commented Nov 19, 2020

I've just repushed the fix commit to follow style of the ObjectContains method in the same file.

@ghost
Copy link
Author

ghost commented Nov 24, 2020

@ccremer could you check this PR please ?

I think that's important to apply this fix because seiso can currently delete images which are active on production environments.

@ccremer
Copy link
Contributor

ccremer commented Nov 26, 2020

@anothertobi or @zugao are you able to look into this?
It's definitely missing the unit test

@ghost
Copy link
Author

ghost commented Apr 6, 2021

I'm closing this PR in favor of #49 which contains same fix with unit tests to be sure it works correctly.

@ghost ghost closed this Apr 6, 2021
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants