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

a job dedicated to copyartifacts from a build specified by a build paramter (ie a run parameter) fails when launched manuallyco

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Not A Defect
    • Component/s: copyartifact-plugin
    • Labels:
      None
    • Environment:
      Jenkins ver. 1.450
      copy artifacts plugin v1.21

      Description

      The tested job is minimalist:

      • it defines a Run parameter (named "IFW") to select a build from the job "IFW"
      • it defines a "copy artifacts from another project" specified by a "build parameter", the parameter name beeing "IFW", and selectif the followinfg artifacts "**/*zip"

      When manually launching the job, selecting the (succesful) last build of the IFW job, I got the following error:

      FATAL: : only whitespace content allowed before start tag and not h (position: START_DOCUMENT seen h... @1:1)
      com.thoughtworks.xstream.io.StreamException: : only whitespace content allowed before start tag and not h (position: START_DOCUMENT seen h... @1:1)
      at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:78)
      at com.thoughtworks.xstream.io.xml.AbstractPullReader.readRealEvent(AbstractPullReader.java:154)
      at com.thoughtworks.xstream.io.xml.AbstractPullReader.readEvent(AbstractPullReader.java:147)
      at com.thoughtworks.xstream.io.xml.AbstractPullReader.move(AbstractPullReader.java:126)
      at com.thoughtworks.xstream.io.xml.AbstractPullReader.moveDown(AbstractPullReader.java:111)
      at com.thoughtworks.xstream.io.xml.XppReader.<init>(XppReader.java:48)
      at com.thoughtworks.xstream.io.xml.XppDriver.createReader(XppDriver.java:44)
      at com.thoughtworks.xstream.XStream.fromXML(XStream.java:856)
      at com.thoughtworks.xstream.XStream.fromXML(XStream.java:848)
      at hudson.plugins.copyartifact.BuildSelectorParameter.getSelectorFromXml(BuildSelectorParameter.java:81)
      at hudson.plugins.copyartifact.ParameterizedBuildSelector.getBuild(ParameterizedBuildSelector.java:52)
      at hudson.plugins.copyartifact.CopyArtifact.perform(CopyArtifact.java:164)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
      at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:700)
      at hudson.model.Build$RunnerImpl.build(Build.java:178)
      at hudson.model.Build$RunnerImpl.doRun(Build.java:139)
      at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:470)
      at hudson.model.Run.run(Run.java:1409)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:238)
      Caused by: org.xmlpull.v1.XmlPullParserException: only whitespace content allowed before start tag and not h (position: START_DOCUMENT seen h... @1:1)
      at org.xmlpull.mxp1.MXParser.parseProlog(MXParser.java:1519)
      at org.xmlpull.mxp1.MXParser.nextImpl(MXParser.java:1395)
      at org.xmlpull.mxp1.MXParser.next(MXParser.java:1093)
      at com.thoughtworks.xstream.io.xml.XppReader.pullNextEvent(XppReader.java:63)
      ... 20 more

        Activity

        Hide
        sdwilsh Shawn Wilsher added a comment -

        This is happening for me for a manual job or one triggered by the parametrized build trigger plugin.

        Show
        sdwilsh Shawn Wilsher added a comment - This is happening for me for a manual job or one triggered by the parametrized build trigger plugin.
        Hide
        sdwilsh Shawn Wilsher added a comment -

        Oh, I see the issue that I and christopheM are running into. The "copy artifacts from another project" specified by a "build parameter" only works when your parameter is the copy artifacts parameter. What we both need is for the "specific build" to be able to parse environment variables.

        Show
        sdwilsh Shawn Wilsher added a comment - Oh, I see the issue that I and christopheM are running into. The "copy artifacts from another project" specified by a "build parameter" only works when your parameter is the copy artifacts parameter. What we both need is for the "specific build" to be able to parse environment variables.
        Hide
        sdwilsh Shawn Wilsher added a comment -

        The copy artifact plugin even properly escapes environment variables. The issue is that the variable that the RunParameter creates is just the job URL. It also creates two other variables which contain the job name and number, but those are not valid variables (https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Build?focusedCommentId=58001926#comment-58001926). If those were valid we should be able to just use those.

        Show
        sdwilsh Shawn Wilsher added a comment - The copy artifact plugin even properly escapes environment variables. The issue is that the variable that the RunParameter creates is just the job URL. It also creates two other variables which contain the job name and number, but those are not valid variables ( https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Build?focusedCommentId=58001926#comment-58001926 ). If those were valid we should be able to just use those.
        Hide
        mindless Alan Harder added a comment -

        I think there's some confusion on the purpose of the Run parameter.. it is for how to select a build, not about which project.. so this:

        it defines a Run parameter (named "IFW") to select a build from the job "IFW"

        is not possible. You simply define a build selector parameter named IFW and a default value.
        When you add a Copy Artifact build step to the job you must specify the project to copy from (probably "IFW" in this case), and then for the build to select you can choose "from build parameter" and give "IFW" as the parameter name (using the name "IFW" for the build parameter is perhaps part of the confusion).

        I just tried using a run parameter with Jenkins 1.461 and Copy Artifact 1.22, and didn't see any error. If you still see a problem, perhaps try in a different environment or setup and see if you can narrow down what factors cause the error.

        Show
        mindless Alan Harder added a comment - I think there's some confusion on the purpose of the Run parameter.. it is for how to select a build, not about which project.. so this: it defines a Run parameter (named "IFW") to select a build from the job "IFW" is not possible. You simply define a build selector parameter named IFW and a default value. When you add a Copy Artifact build step to the job you must specify the project to copy from (probably "IFW" in this case), and then for the build to select you can choose "from build parameter" and give "IFW" as the parameter name (using the name "IFW" for the build parameter is perhaps part of the confusion). I just tried using a run parameter with Jenkins 1.461 and Copy Artifact 1.22, and didn't see any error. If you still see a problem, perhaps try in a different environment or setup and see if you can narrow down what factors cause the error.
        Hide
        mindless Alan Harder added a comment -

        oh, I was right there was confusion, but just now I figured out what it was... I see that "Run parameter" is one of the choices for the types of parameters you can add in a job, and indeed you can make one for picking a particular build from a particular project, like "IFW". Copy Artifact's "from build parameter" option does not support this type of parameter. It only supports the "Build selector for Copy Artifact" type of build parameter. You can select "specific build" here, but you have to type the build number.. you won't get a list of existing build numbers the way a "Run parameter" shows.

        Show
        mindless Alan Harder added a comment - oh, I was right there was confusion, but just now I figured out what it was... I see that "Run parameter" is one of the choices for the types of parameters you can add in a job, and indeed you can make one for picking a particular build from a particular project, like "IFW". Copy Artifact's "from build parameter" option does not support this type of parameter. It only supports the "Build selector for Copy Artifact" type of build parameter. You can select "specific build" here, but you have to type the build number.. you won't get a list of existing build numbers the way a "Run parameter" shows.
        Hide
        mindless Alan Harder added a comment -

        Closing. If you like you can file a feature request to support "Run parameter" for the build selector (though I have no plans to implement it).

        Show
        mindless Alan Harder added a comment - Closing. If you like you can file a feature request to support "Run parameter" for the build selector (though I have no plans to implement it).
        Hide
        abatkin Adam Batkin added a comment -

        How is this not a defect? The error message gives no indication of what was wrong or where to even start debugging the issue. Literally the best you can do is Google the message and hope that you find this bug. Google should be the last resort, not the only option.

        Show
        abatkin Adam Batkin added a comment - How is this not a defect? The error message gives no indication of what was wrong or where to even start debugging the issue. Literally the best you can do is Google the message and hope that you find this bug. Google should be the last resort, not the only option.

          People

          • Assignee:
            mindless Alan Harder
            Reporter:
            christophem christopheM
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: