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
Fixing loss of unshelved changes - Update ClientHelper.java [JENKINS-25724] #10
Conversation
Moving 'revert -k' operation in unshelveFiles() to before the unshelving process. Without this, when 'revert -k' is done after the unshelving process, the unshelved changes are lost. This results in the review build option (https://github.com/jenkinsci/p4-plugin#review) to be unusable and also renders the swarm jenkins integration (http://www.perforce.com/blog/140910/continuous-integration-new-perforce-server-plugin-jenkins) unusable. I am not a Java developer and don't have the resources to test / verify this change. I tried `mvn package`, but ran into build errors related from some other dependency. If this change can is valid in theory and if you can help me build the package, I can test it. Our team is moving to use the new p4 plugin and this is one the critical features for us and one that will also help convince adoption of this plugin to other teams. I guess this issue has already been reported : https://issues.jenkins-ci.org/browse/JENKINS-25724 Can you please review this change
Thank you for a pull request! Please check this document for how the Jenkins project handles pull requests |
Hi Mohan, Thank you for looking into the issue and the suggested change. The 'revert -k' option should not remove the unshelved content from the workspace. The '-k' option just removes the associated metadata from Perforce's have table. It turns out on closer inspection that I was actually setting '-n' by accident: rOpts.setNoUpdate(true); The code should be... rOpts.setNoClientRefresh(true); Even so '-n' (preview) will not remove the shelved content. I'm wondering if it is your intended usage that is causing the issue? A subsequent build WILL remove the unshelved content, unless it was building the same shelf. If the content is missing then you may have found a P4JAVA bug. Kind regards,
This email and any files transmitted with it are confidential and intended Perforce Software UK Ltd is registered in England and Wales as company no. RG40 2AT, UK |
Thanks @p4paul I got the I am testing these changes with the p4 plugin option set to 'Forced clean and sync'. Created a shelve which added a file that causes the tests to fail and hence the review build should fail.
Paul, If the issue is in the p4java library can you please help get this escalated to their notice and fix it (assuming you are working for perforce). |
I am a bit puzzled as shelving/review works for me and many other Jenkins users, there is also test coverage for unshelving stage. I'm guessing there is a configuration issue with your builds. How are you triggering a review build? Unshelving can be invoked either through Swarm or another web app calling the To verify your Job configuration please click on the 'Build Review' and fill put the following fields. review: 12345 (shelf to review) (ignore the other fields) Click build and check you workspace for the unshelved content. Please let me know the result and send me the Jenkins console output for the build. To answer your questions; p4java uses a '0' to indicate the default changelist, this will not work on the command line. Kind regards,
This email and any files transmitted with it are confidential and intended Perforce Software UK Ltd is registered in England and Wales as company no. RG40 2AT, UK |
Thanks @p4paul I triggered a build using the 'Build Review' button as you have specified and following is the output.
As a workaround for now can you give me a I tried |
Hi Mohan, This is most likely a configuration issue with your Jenkins or Perforce deployment. As I stated in my earlier email; the plugin's unshelve feature is widely used both here in Perforce and across many of our customers. Please test you can unshelve the change on the Jenkins master/slave in the working area as the Jenkins user. cd <workspace_area_used_by_jenkins> Check list:
If you are unable to find the issue, please raise a ticket with our support team (support@perforce.com) and provide the following details. Feel free to CC me on the support case. (1) p4 -Ztag info (2) p4 client -o <jenkins_workspace> (3) p4 -u <jenkins_user> protects (4) p4 describe -s <shelved_change> (5) config.xml file for the Jenkins job I do not recommend making changes to the source code until you have resolved the configuration issue. In addition I do not recommend the use of execMap/Stream functions! For reference your parameters are out of order: ...{"-s" + review, "-f"} (you need to append the change number to the '-s' flag and not as a separate parameter) Kind regards,
This email and any files transmitted with it are confidential and intended Perforce Software UK Ltd is registered in England and Wales as company no. RG40 2AT, UK |
Thanks @p4paul Turns out it was a permission issue with the jenkins p4 user we were using. Sorry for the confusion. Closing this .. |
Hi Mohan, I'm glad you were able to resolve the issue. It turned out to be a useful exercise as there was a minor bug with the '-n' flag instead of '-k'. I agree there is some work to be done on error logging; errors seem to sometimes end up in the Jenkins log and not the Job's console output. Kind regards,
This email and any files transmitted with it are confidential and intended Perforce Software UK Ltd is registered in England and Wales as company no. RG40 2AT, UK |
Moving
revert -k
operation in unshelveFiles() to before the unshelving process. Without this, whenrevert -k
is done after the unshelving process, the unshelved changes are lost. This results in the review build option to be unusable and also renders the swarm jenkins integration unusable.I am not a Java developer and don't have the resources to test / verify this change. I tried
mvn package
, but ran into build errors related from some other dependency. If this change is valid in theory and if you can help me build the package, I can test it. Our team is moving to use the new p4 plugin and this is one the critical features for us and one that will also help convince adoption of this plugin to other teams in our organization.I guess this issue has already been reported : JENKINS-25724
Can you please review this change @p4paul