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

Plugin unconditionally copies managed script to VC root / working dir even if it's read-only, which fails

      Using a ClearCase dynamic view, the root path itself is read-only (which contains N number of VOBs or repos, managed by the server), which prevents me from using this really valuable plugin.

      The error text from a job console looks like so:

      15:25:59  Running Prebuild steps
      15:25:59  executing script 'ScriptBuildStepConfigProvider.1325285620945'
      15:25:59  FATAL: Cannot create temporary script 'Setup ClearCase environment'
      15:25:59  hudson.util.IOException2: Failed to copy C:\Users\garepa.SEL\AppData\Local\Temp\build_step_template5292341656269454572.sh to M:\garepa_ux_view2/build_step_template5292341656269454572.sh
      15:25:59  	at hudson.FilePath.copyTo(FilePath.java:1415)
      15:25:59  	at org.jenkinsci.plugins.managedscripts.ScriptBuildStep.perform(ScriptBuildStep.java:167)
      15:25:59  	at org.jenkinsci.plugins.preSCMbuildstep.PreSCMBuildStepsWrapper.preCheckout(PreSCMBuildStepsWrapper.java:116)
      15:25:59  	at hudson.model.AbstractBuild$AbstractRunner.preCheckout(AbstractBuild.java:559)
      15:25:59  	at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:459)
      15:25:59  	at hudson.model.Run.run(Run.java:1404)
      15:25:59  	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      15:25:59  	at hudson.model.ResourceController.execute(ResourceController.java:88)
      15:25:59  	at hudson.model.Executor.run(Executor.java:238)
      15:25:59  Caused by: java.io.FileNotFoundException: M:\garepa_ux_view2\build_step_template5292341656269454572.sh (The media is write protected)
      15:25:59  	at java.io.FileOutputStream.open(Native Method)
      15:25:59  	at java.io.FileOutputStream.<init>(Unknown Source)
      15:25:59  	at java.io.FileOutputStream.<init>(Unknown Source)
      15:25:59  	at hudson.FilePath$25.call(FilePath.java:1323)
      15:25:59  	at hudson.FilePath$25.call(FilePath.java:1319)
      15:25:59  	at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
      15:25:59  	at hudson.FilePath.write(FilePath.java:1319)
      15:25:59  	at hudson.FilePath.copyTo(FilePath.java:1408)
      15:25:59  	... 8 more
      15:25:59  Failed build for org.jenkinsci.plugins.managedscripts.ScriptBuildStep@1ebae65
      

      The copying would have succeeded if instead the destination to copy to was taken from the path in the WORKSPACE environment variable (which I'd think would be the original intent?)

          [JENKINS-12260] Plugin unconditionally copies managed script to VC root / working dir even if it's read-only, which fails

          Garen Parham added a comment - - edited

          From looking at the source code here:

          https://github.com/jenkinsci/managed-scripts-plugin/blob/master/src/main/java/org/jenkinsci/plugins/managedscripts/ScriptBuildStep.java

          It looks like the cause of this problem is the method used to determine the working dir (which is deprecated):

          FilePath workingDir = build.getModuleRoot();

          From reading JENKINS-4640 and this old thread:
          http://markmail.org/message/qqbs7dugyse2swhe

          Presumably this would be fixed by using a newer method, getWorkspace()

          Garen Parham added a comment - - edited From looking at the source code here: https://github.com/jenkinsci/managed-scripts-plugin/blob/master/src/main/java/org/jenkinsci/plugins/managedscripts/ScriptBuildStep.java It looks like the cause of this problem is the method used to determine the working dir (which is deprecated): FilePath workingDir = build.getModuleRoot(); From reading JENKINS-4640 and this old thread: http://markmail.org/message/qqbs7dugyse2swhe Presumably this would be fixed by using a newer method, getWorkspace()

          Code changed in jenkins
          User: imod
          Path:
          src/main/java/org/jenkinsci/plugins/managedscripts/ScriptBuildStep.java
          http://jenkins-ci.org/commit/managed-scripts-plugin/2530ddcde68eb2cba973f169a11f0a1cf865fc33
          Log:
          [FIXED JENKINS-12260] fix wrong workspace determination

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: imod Path: src/main/java/org/jenkinsci/plugins/managedscripts/ScriptBuildStep.java http://jenkins-ci.org/commit/managed-scripts-plugin/2530ddcde68eb2cba973f169a11f0a1cf865fc33 Log: [FIXED JENKINS-12260]  fix wrong workspace determination

            domi Dominik Bartholdi
            garen Garen Parham
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: