Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-7182

Clean workspace deletes private Maven repository

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: perforce-plugin
    • Labels:
      None
    • Environment:
      Hudson 1.371, Apache Tomcat 6.0.16, Perforce 2009.02 (both server/client)
    • Similar Issues:

      Description

      In a Maven 2 build, if you select the option to "Clean Workspace Before Each Build" it would be nice if the Perforce plug-in would ignored the Maven private repository ($WORKSPACE/.repository) or provided an option to ignore the private repository.

        Attachments

          Issue Links

            Activity

            Hide
            km km added a comment -

            Sorry, trying to understand better. Is this specific to perforce?

            Are you saying your Maven artifact local repository in $WORKSPACE/.repository? I thought, by default Maven will download the artifacts at <hudson-user-home-folder>/.m2/repository, no? (Your builds can of course override this setting).

            Show
            km km added a comment - Sorry, trying to understand better. Is this specific to perforce? Are you saying your Maven artifact local repository in $WORKSPACE/.repository? I thought, by default Maven will download the artifacts at <hudson-user-home-folder>/.m2/repository, no? (Your builds can of course override this setting).
            Hide
            rpetti Rob Petti added a comment -

            This isn't specific to the perforce plugin. The plugin simply reuses the "Wipe Out Workspace" function in core hudson.

            Show
            rpetti Rob Petti added a comment - This isn't specific to the perforce plugin. The plugin simply reuses the "Wipe Out Workspace" function in core hudson.
            Hide
            mdelaney Mike Delaney added a comment -

            Sorry, I think there is come confusion here. I did not mean the link labeled 'Wipe Out Workspace' that is provided by Hudson but the actual feature of the Perforce plugin (found in PerforceSCM.java; see snippet below) that calls workspace.deleteContents().

            If it helps, I can supply a patch as an example of what I'm doing here to work around this.

            [ Code Snippet ]
            if(wipeBeforeBuild){
            log.println("Clearing workspace...");
            if(processWorkspaceBeforeDeletion(build.getProject(), workspace, build.getBuiltOn()))

            { workspace.deleteContents(); log.println("Cleared workspace."); }

            else

            { log.println("Could not clear workspace. See hudson.perforce.PerforceSCM logger for details."); }

            forceSync = true;
            }

            Show
            mdelaney Mike Delaney added a comment - Sorry, I think there is come confusion here. I did not mean the link labeled 'Wipe Out Workspace' that is provided by Hudson but the actual feature of the Perforce plugin (found in PerforceSCM.java; see snippet below) that calls workspace.deleteContents(). If it helps, I can supply a patch as an example of what I'm doing here to work around this. [ Code Snippet ] if(wipeBeforeBuild){ log.println("Clearing workspace..."); if(processWorkspaceBeforeDeletion(build.getProject(), workspace, build.getBuiltOn())) { workspace.deleteContents(); log.println("Cleared workspace."); } else { log.println("Could not clear workspace. See hudson.perforce.PerforceSCM logger for details."); } forceSync = true; }
            Hide
            rpetti Rob Petti added a comment -

            That function is exactly the same as the Wipe Out Workspace function in hudson. The user should have the reasonable expectation that they will both operate in exactly the same way. Why is your maven repository in the workspace in the first place?

            The only thing I'd be willing to implement is an optional setting to skip an arbitrary set of paths when deleting everything. Does your patch do this, or is it hard-coded only for your case?

            Show
            rpetti Rob Petti added a comment - That function is exactly the same as the Wipe Out Workspace function in hudson. The user should have the reasonable expectation that they will both operate in exactly the same way. Why is your maven repository in the workspace in the first place? The only thing I'd be willing to implement is an optional setting to skip an arbitrary set of paths when deleting everything. Does your patch do this, or is it hard-coded only for your case?
            Hide
            mdelaney Mike Delaney added a comment - - edited

            We have our maven repository in our workspace to avoid build failures when one job tries to access a artifact that currently being downloaded from another job in Hudson; we have some machines setup with six, or more, executors. Using a private repository adds additional stability to our builds.

            The patch is currently hard-coded to skip only the ".repository" location.

            That being said, I can update the patch to be configurable. In fact, I had plans to do that but haven't had the time yet to do it.

            Show
            mdelaney Mike Delaney added a comment - - edited We have our maven repository in our workspace to avoid build failures when one job tries to access a artifact that currently being downloaded from another job in Hudson; we have some machines setup with six, or more, executors. Using a private repository adds additional stability to our builds. The patch is currently hard-coded to skip only the ".repository" location. That being said, I can update the patch to be configurable. In fact, I had plans to do that but haven't had the time yet to do it.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in hudson
            User: : rpetti
            Path:
            trunk/hudson/plugins/perforce/src/main/java/hudson/plugins/perforce/PerforceSCM.java
            http://jenkins-ci.org/commit/36404
            Log:
            [FIXED JENKINS-7182] skip .repository when cleaning out the workspace

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in hudson User: : rpetti Path: trunk/hudson/plugins/perforce/src/main/java/hudson/plugins/perforce/PerforceSCM.java http://jenkins-ci.org/commit/36404 Log: [FIXED JENKINS-7182] skip .repository when cleaning out the workspace
            Hide
            hagzag hagzag added a comment -

            I think this is a bit too much forcing everybody to skip the .repository especially when you would like to have a squeaky clean build - including a clean .m2 for the build.
            I will be posting such functionality in a FORK recommended for this plugin.

            Show
            hagzag hagzag added a comment - I think this is a bit too much forcing everybody to skip the .repository especially when you would like to have a squeaky clean build - including a clean .m2 for the build. I will be posting such functionality in a FORK recommended for this plugin.
            Hide
            aheritier Arnaud Héritier added a comment -

            myself I'm using this plugin to cleanup regularly my repositories : https://github.com/jenkinsci/maven-repo-cleaner-plugin

            Show
            aheritier Arnaud Héritier added a comment - myself I'm using this plugin to cleanup regularly my repositories : https://github.com/jenkinsci/maven-repo-cleaner-plugin

              People

              • Assignee:
                Unassigned
                Reporter:
                mdelaney Mike Delaney
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: