You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am deploying with Helm from CI and it would be really helpful to have the commands return a different exit code based on whether there is some changes or not. From CI I usually don't care about the actual changes but I want to know if something changed or not.
My suggestion would be to have a --detailed-exit-code flag similar to terraform plan or git diff
The best would probably to do like terraform and return something like this:
0 if no error and no diff
1 if there is an error
2 if no error but a diff
This change would also allow to implement the same flag in helmfile. See roboll/helmfile#133
Any thoughts?
Reacted by Travis Groth, rlongstaff, cosmopetrich, Yusuke Kuoka, Hubert Witkowski and Mariam Tkesheladze
I'd like to see this as well so that a helm deployment is only triggered if there is an actual difference. The lack of information as to whether a deployment is needed has been our biggest issue with helm and integrating it into more 'driverless' automation.
The exit code is actually easy to implement in helm-diff based on my testing, but helm itself will treat any non-zero exit code as an error. So, this should probably be coupled with a change in helm to define an exit code contract to signal failure versus a code that should be passed back to the caller.
@travisgroth thanks for looking into this, I didn't have time to do it yet.
It looks like it is a little more complicated than what I thought.
Were you planning on opening an issue in the helm project ? I can also do it if you prefer
@royjs it probably makes sense for you to initiate the issues across the 3 projects, but I'll chime in on the discussion. Assuming there is an agreement on the path forward and the interface, I may be able to do a PR for one or more of these since I've already wandered through the code path.
@travisgroth@royjs@cmeury Would you be able to participate in the helm part of this issue at helm/helm#4170? As a workaround, I was trying to bypass helm's plugin system, hence call helm-diff directly. But turned out it isn't very feasible as explained in the issue. I'm now eager to implement this in helm. Appreciate your support there 😃
@mumoshu I just tried it and the exit code works fine. The only issue I had is that the helm-diff usage is printed after the diff where a change is detected. Did you see the same behaviour?
Activity
travisgroth commentedon Jun 2, 2018
I'd like to see this as well so that a helm deployment is only triggered if there is an actual difference. The lack of information as to whether a deployment is needed has been our biggest issue with helm and integrating it into more 'driverless' automation.
The exit code is actually easy to implement in helm-diff based on my testing, but helm itself will treat any non-zero exit code as an error. So, this should probably be coupled with a change in helm to define an exit code contract to signal failure versus a code that should be passed back to the caller.
royjs commentedon Jun 4, 2018
@travisgroth thanks for looking into this, I didn't have time to do it yet.
It looks like it is a little more complicated than what I thought.
Were you planning on opening an issue in the helm project ? I can also do it if you prefer
travisgroth commentedon Jun 4, 2018
@royjs it probably makes sense for you to initiate the issues across the 3 projects, but I'll chime in on the discussion. Assuming there is an agreement on the path forward and the interface, I may be able to do a PR for one or more of these since I've already wandered through the code path.
mumoshu commentedon Jul 20, 2018
@travisgroth @royjs @cmeury Would you be able to participate in the helm part of this issue at helm/helm#4170? As a workaround, I was trying to bypass helm's plugin system, hence call
helm-diffdirectly. But turned out it isn't very feasible as explained in the issue. I'm now eager to implement this in helm. Appreciate your support there 😃return non-zero exitcode when encountering any change on upgrade (#65)
mumoshu commentedon Jul 25, 2018
helm/helm#4367 was merged to the upstream to resolve helm/helm#4170.
It should be good to start returning the separate exit code for no error but diff now.
feat: Dedicated exit code (2) on there's diff
feat: Dedicated exit code (2) on there's diff
feat: Dedicated exit code (2) on there's diff
feat: Dedicated exit code (2) on there's diff (#78)
mumoshu commentedon Jul 25, 2018
#78 in combination with
helmbuilt from the current master seems to work:@royjs @travisgroth @cmeury Could you verify that it works for you?
For your reference,
helmcan be build from master by runningmake build && cp bin/helm path/to/your/bin/helm211dev.mumoshu commentedon Jul 25, 2018
I'm not going to close this until helm 2.11 is released. It may take a few months, because helm is still 2.10.rc-1 today.
royjs commentedon Jul 25, 2018
@mumoshu I just tried it and the exit code works fine. The only issue I had is that the helm-diff usage is printed after the diff where a change is detected. Did you see the same behaviour?
mumoshu commentedon Aug 21, 2018
@royjs Hey. Thanks for the report! Yes, and it should be fixed by #79.
mumoshu commentedon Aug 21, 2018
FYI, helm 2.10 has already been released with the feature.
mumoshu commentedon Aug 21, 2018
I'm going to closing this after #81, bumping helm dependency to 2.10
mumoshu commentedon Aug 27, 2018
Released v2.9.0+3 and v2.10.0+1 that includes this feature. Closing as resolved, but please feel free to try and report any issue! Thanks.