• Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • m2release-plugin
    • None
    • Platform: All, OS: All

      Release builds should be built from clear workspace.

          [JENKINS-3925] Clear workspace before build

          syvalta added a comment -

          Created an attachment (id=755)
          Patch that adds clear workspace, fixes race a condition and decreases copy-paste code. Sorry about the white space changes.

          syvalta added a comment - Created an attachment (id=755) Patch that adds clear workspace, fixes race a condition and decreases copy-paste code. Sorry about the white space changes.

          syvalta added a comment -

          Created an attachment (id=756)
          Updated patch, the previous patch used next dev version when setting build description instead of the release version

          syvalta added a comment - Created an attachment (id=756) Updated patch, the previous patch used next dev version when setting build description instead of the release version

          James Nord added a comment -

          Thanks for the patch but I want to understand this a bit more.

          Currently releases are effectivly done from a clean checkout - which is
          ${workspace_loc}/target/checkout

          if you want to make sure its clean you just need to add the clean goal before
          release:prepare release:perfrom options in the release goals.

          If your using a local m2 repository which is recommended I think cleaning the m2
          repo should be pushed up to the maven core to clean - and the m2release plugin
          just triggers that to clean itself.

          If your not using a local m2 repo then you have other issues

          Other than that what was the race condition and under what circumstances did it
          manifest itself?

          James Nord added a comment - Thanks for the patch but I want to understand this a bit more. Currently releases are effectivly done from a clean checkout - which is ${workspace_loc}/target/checkout if you want to make sure its clean you just need to add the clean goal before release:prepare release:perfrom options in the release goals. If your using a local m2 repository which is recommended I think cleaning the m2 repo should be pushed up to the maven core to clean - and the m2release plugin just triggers that to clean itself. If your not using a local m2 repo then you have other issues Other than that what was the race condition and under what circumstances did it manifest itself?

          syvalta added a comment -

          I thought it as precaution to guarantee that the release is buildable from clean
          checkout. But you are right, if it isn't the build will fail at release:perform.
          So the patch just makes it to fail earlier (already in release:prepare before
          tagging instead only in release:perform).

          About the race condition: when M2ReleaseAction schedules a build it synchronizes
          on the M2ReleaseBuildWrapper instance. However, M2ReleaseBuildWrapper.setUp
          doesn't synchronize on anything, so it might run before M2ReleaseAction has set
          the release properties, or they might be only partially set. The patch makes the
          setUp() to wait M2ReleaseAction to signal that everything is set up.

          syvalta added a comment - I thought it as precaution to guarantee that the release is buildable from clean checkout. But you are right, if it isn't the build will fail at release:perform. So the patch just makes it to fail earlier (already in release:prepare before tagging instead only in release:perform). About the race condition: when M2ReleaseAction schedules a build it synchronizes on the M2ReleaseBuildWrapper instance. However, M2ReleaseBuildWrapper.setUp doesn't synchronize on anything, so it might run before M2ReleaseAction has set the release properties, or they might be only partially set. The patch makes the setUp() to wait M2ReleaseAction to signal that everything is set up.

          James Nord added a comment -

          Race condition is fixed in 0.3.

          James Nord added a comment - Race condition is fixed in 0.3.

          fabrice31 added a comment -

          Hi

          I would like to konw when this patch will be merge to trunk and released ?
          I use svn update option and I need for a release to delete my entire worspace to clean sources and also my .repository maven local folder job repo.

          fabrice31 added a comment - Hi I would like to konw when this patch will be merge to trunk and released ? I use svn update option and I need for a release to delete my entire worspace to clean sources and also my .repository maven local folder job repo.

          Anders Hammar added a comment -

          Support for deleting the m2 local repository in the workspace would be good. That's the recommended fashion to ensure a good release environment.

          Anders Hammar added a comment - Support for deleting the m2 local repository in the workspace would be good. That's the recommended fashion to ensure a good release environment.

            Unassigned Unassigned
            syvalta syvalta
            Votes:
            6 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: