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 stop mojo by taking container name pattern into account #1427

Merged
merged 3 commits into from
Jul 20, 2021

Conversation

j3t
Copy link
Contributor

@j3t j3t commented Jan 18, 2021

Fixes #1168

@sonarcloud
Copy link

sonarcloud bot commented Jan 18, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@codecov
Copy link

codecov bot commented Jan 18, 2021

Codecov Report

Merging #1427 (4211767) into master (9a49d21) will increase coverage by 0.03%.
The diff coverage is 94.11%.

@@             Coverage Diff              @@
##             master    #1427      +/-   ##
============================================
+ Coverage     61.89%   61.92%   +0.03%     
- Complexity     2160     2164       +4     
============================================
  Files           166      166              
  Lines          9537     9548      +11     
  Branches       1441     1442       +1     
============================================
+ Hits           5903     5913      +10     
- Misses         3119     3120       +1     
  Partials        515      515              
Impacted Files Coverage Δ
...fabric8/maven/docker/util/ContainerNamingUtil.java 81.69% <94.11%> (+1.69%) ⬆️

@zbelzer
Copy link

zbelzer commented Jan 21, 2021

This would be very useful for our team. Please consider its review.

@rohanKanojia rohanKanojia requested a review from rhuss January 22, 2021 06:32
Copy link
Collaborator

@rhuss rhuss left a comment

Choose a reason for hiding this comment

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

In general I believe the use case that this PR is solving and that is described in the reference issue is valid, but I'm concerned about backwards compatibility which must be ensured.

Unfortunately I don't have enough time to dive deeper in this PR technically, but @rohanKanojia if you could give it tech review that would be cool.


return keepOnlyLastIndexedContainer(containers, partiallyApplied);
String appliedContainerNamePattern = new FormatParameterReplacer(lookups).replace(containerNamePattern);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it correct that this changes the current behaviour in a non-backwards compatible way? (i.e. that all containers are stopped now by default, not the latest started)

If so we would need to be more careful to keep the old behaviour (at least for a certain deprecation period) and introduce this new behaviour either by a certain indication in the container name pattern or if this is not possible, with a new flag for docker:stop.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's true. I have changed it so that the new approach is only applied if the container name pattern doesn't contain an index placeholder. This way it should be backward compatible again.

@rohanKanojia rohanKanojia added this to the 0.35.0 milestone Mar 7, 2021
@rhuss
Copy link
Collaborator

rhuss commented Mar 7, 2021

btw, I'm also not sure why only the container name with the highest index is used (when the container pattern includes a %i. We might remove it, though.

@rhuss
Copy link
Collaborator

rhuss commented Mar 7, 2021

Can we get #1410 in first and then check out how this fit to this PR ? (guess there might be a conflict)

@rohanKanojia
Copy link
Member

@j3t: Hello, Thanks for updating this PR. Somehow commit history seems to be messed up. Could you please take a look into it? Let's try to get it reviewed and merged soon.

@j3t j3t closed this Apr 19, 2021
@j3t j3t force-pushed the fix_1168_more_robust_stop_procedure branch from 71e3cc0 to ac614a2 Compare April 19, 2021 14:26
@j3t j3t reopened this Apr 19, 2021
@rohanKanojia rohanKanojia self-requested a review April 19, 2021 15:26
@j3t
Copy link
Contributor Author

j3t commented Jul 19, 2021

Hi @rohanKanojia, is there any chance this gets included in the next release? What is missing? How can I help?

@sonarcloud
Copy link

sonarcloud bot commented Jul 20, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

93.8% 93.8% Coverage
0.0% 0.0% Duplication

@rhuss
Copy link
Collaborator

rhuss commented Jul 20, 2021

Looks good to me. Let's get that merged.

@rhuss rhuss merged commit 9ed2c24 into fabric8io:master Jul 20, 2021
@rhuss
Copy link
Collaborator

rhuss commented Jul 20, 2021

@j3t thanks a ton ! Sorry for the delay, I hope we can make a release asap.

@rohanKanojia
Copy link
Member

@j3t: I'm sorry for the late reply. I was on PTO. Do you need a new patch release with this fix? Or are you okay with waiting for the next minor release?

@j3t
Copy link
Contributor Author

j3t commented Jul 21, 2021

@j3t: I'm sorry for the late reply. I was on PTO. Do you need a new patch release with this fix? Or are you okay with waiting for the next minor release?

No worries, the next minor release is sufficient I guess.

@j3t j3t deleted the fix_1168_more_robust_stop_procedure branch July 22, 2021 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Container name pattern ignored when stopping
5 participants