-
Notifications
You must be signed in to change notification settings - Fork 4.7k
oc: rolling back to the same dc version should be a no-op #13104
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
Conversation
@Kargakis can you comment on this? I can picture a scenario where I exec'd into my container, messed something up and want to roll back to the same version but without whatever mess I created. |
@pweil- can't you just kill the pods in that case? |
@pweil- you can still do 'oc rollout latest' but maybe it's not obvious? Anyway, it's impossible to rollback to the same version in upstream Deployments but that may change if we stop hashing the podtemplate. |
Yes, you could kill it and allow the replication controller to recreate it. Or as @Kargakis mentioned use edit: confusing wording |
Yeah now I think we shouldn't special case this one since we support redeploying the same thing but I don't feel strong - it's been a long time since I opened the issue... |
But I think here the goal is to avoid causing a new deployment when the user wrongly calls oc rollback with the same version as currently deployed. |
@mfojtik you are the proud owner of DCs, your call |
@mfojtik what about that one? Is it still a valid merge for a valid issue? |
@Kargakis I'm fine with this change, but I would like to see extended test for this scenario. |
@mfojtik I can add some tests in test/cmd/deployments.sh inside the cmd/deployments/rollback tests.
|
Hi @mfojtik any update on that PR? |
A unit test would be fine for this one. Extended test is an overkill. |
Thank you both, I will update my PR with those tests... |
I did a rebase and added the rollback test, however I couldn't make sense of the unit tests in pkg/deploy/registry/rollback/rest_test.go In fact I have tried to add my own creating a deployapi.DeploymentConfigRollbackSpec with revision 2 while there is initially a deploytest.OkDeploymentConfig(2) but I cannot make that fail... However the test says "coverage: 78.6% of statements" so maybe these cases are not covered by unit testing yet? Where can I find some reference for these tests? |
@matthyx this produced the error for me: https://github.com/matthyx/origin/pull/1/files (with modified strings.contains to make the test fail)
|
Also, I notice you now have a merge commit from your rebase. When you rebase it shouldn't add any extra commits to your PR. The process looks like this:
Hope that helps! 👍 |
Dear @pweil- I have understood my mistake... running the test one level too high doesn't spot the artificial error:
Whereas, that one fails (so works!):
Thanks a lot for the test code, mine was based on |
[test] |
Evaluated for origin test up to 90040d0 |
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin/129/) (Base Commit: fedfdff) |
LGTM, thanks for adding the test :-) [merge] |
Evaluated for origin merge up to 90040d0 |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_request_origin/63/) (Base Commit: 9e4e2e7) (Image: devenv-rhel7_6067) |
Refrain from rolling back deploymentconfig if from.Status.LatestVersion equals rollback.Spec.Revision