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

No way to revert modifications in checkout? #31

Closed
kf-jstatz opened this issue Apr 2, 2020 · 5 comments
Closed

No way to revert modifications in checkout? #31

kf-jstatz opened this issue Apr 2, 2020 · 5 comments

Comments

@kf-jstatz
Copy link

Maybe I missed it, but it would be nice to be able to ensure nothing is changed locally. We're building a Unity project and occasionally someone might end up opening the project manually on the build machine, and some minor things like materials/etc may end up modified. As a general case I'd like to be able to ensure nothing locally is changed when running a Jenkins build, however it might have happened.

@mig42
Copy link
Contributor

mig42 commented Apr 2, 2020

Hi @kf-jstatz!

The checkout operation first cleans the workspace and then performs a workspace update to download the appropriate contents. That first clean step means undoing all checked-out and locally change files in the workspace. You can see it in action in method CheckoutAction.checkoutWorkspace() here.

WorkspaceManager.cleanWorkspace(tool, workspace.getPath());

So, I'd say your scenario is covered: if anyone perform changes in the Jenkins workspace, Jenkins would then revert those changes when a new build is triggered.

Did you verify this?

Thanks!
Miguel

@kf-jstatz
Copy link
Author

kf-jstatz commented Apr 2, 2020 via email

@mig42
Copy link
Contributor

mig42 commented Apr 3, 2020

No worries 😄

You're right, there's no mention of it in the documentation! I'll leave this issue open until we update the docs. I'm happy to hear that there isn't any actual problem though!

Regards,
Miguel

@knapsu
Copy link
Collaborator

knapsu commented Oct 1, 2020

Hi. It all depends on the modifications that are done on the build node and how the build is actually being done.

  1. If the file is modified in the workspace (tracked change) then it would be reverted by default.
  2. If a file is added to the workspace (not tracked change) it would not get discarded. This can lead to problems on subsequent runs.
  3. Sometimes the intermediate build files that were put in ignore.conf could be causing issues . Cleaning those might sometimes be needed.

I had a type 2 case with Unreal where some extra files needed to be present to make a specific build. Unfortunately as the cleanup was not done completely it was causing incorrect builds on subsequent runs on this Jenkins agent node.

Type 3 case also happened few times for me. Going to each agent node (had 7 of those) and manually doing a cleanup was very tedious.

A potential workaround for this problem was running custom cleanup command after workspaec synchronization. In pipeline script it would look like this:

bat script: """
    @cd workspaeDir
    @cm rm private -r .
    @cm undocheckout --all --silent .
"""

The good thing is that in pull request #30 branch there are improvements that allows to specify a cleanup method, how deep it should revert the workspace. I am using this on production for more than a year now.

76547151-0416f080-648d-11ea-9a29-85137a9ea61d

mig42 added a commit that referenced this issue Oct 7, 2020
Include an explicit mention to the undo operation that runs
before any update.

This was mentioned in issue #31

Signed-off-by: Miguel González <mgonzalez@codicesoftware.com>
@mig42
Copy link
Contributor

mig42 commented Oct 7, 2020

As I said in my previous comment, I added a mention in the README to let everyone know that the Plastic SCM checkout undoes all changes in controlled items before running updates.

Closing the issue now!

@mig42 mig42 closed this as completed Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants