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

Optional Copy Artifact build step fails if no specific build's build number is given

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: copyartifact-plugin
    • Labels:
      None
    • Environment:
    • Similar Issues:

      Description

      I set up an optional copy artifact step for a specific build, which is determined by a build parameter (e.g. $SOURCE_BUILD_NO).

      The expectation was to leave the parameter empty if I didn't want to copy anything, as it couldn't have copied anything, and move on, just like when entering a build number for a non-existing build.

      That resulted in a build failure.

      FATAL: For input string: "$SOURCE_BUILD_NO"
      java.lang.NumberFormatException: For input string: "$SOURCE_BUILD_NO"
      

      Workarounds:

      • Entering the build number of a non-existing build or build without artifacts, e.g. -5.
      • Using conditional build step plugin.

        Attachments

          Activity

          Hide
          danielbeck Daniel Beck added a comment -

          Clarified title

          Show
          danielbeck Daniel Beck added a comment - Clarified title
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Nicolas De loof
          Path:
          src/main/java/hudson/plugins/copyartifact/SpecificBuildSelector.java
          http://jenkins-ci.org/commit/copyartifact-plugin/c9c5de10dff176e4eb0b11116cc611895978c78d
          Log:
          [FIXED JENKINS-14266] check unset variable

          if env.expand don't expand a variable, this means this one has not been set, then should not break trying to parse, just ignore and let the "optional" plugin parameter fail the build if necessary

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nicolas De loof Path: src/main/java/hudson/plugins/copyartifact/SpecificBuildSelector.java http://jenkins-ci.org/commit/copyartifact-plugin/c9c5de10dff176e4eb0b11116cc611895978c78d Log: [FIXED JENKINS-14266] check unset variable if env.expand don't expand a variable, this means this one has not been set, then should not break trying to parse, just ignore and let the "optional" plugin parameter fail the build if necessary
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Nicolas De loof
          Path:
          src/main/java/hudson/plugins/copyartifact/.SpecificBuildSelector.java.swp
          src/main/java/hudson/plugins/copyartifact/SpecificBuildSelector.java
          http://jenkins-ci.org/commit/copyartifact-plugin/fe01ca92d38a088a8349ad9c9b5c9449b56d065a
          Log:
          [FIXED JENKINS-14266] check unset variable

          if env.expand don't expand a variable, this means this one has not been set, then should not break trying to parse, just ignore and let the "optional" plugin parameter fail the build if necessary

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nicolas De loof Path: src/main/java/hudson/plugins/copyartifact/.SpecificBuildSelector.java.swp src/main/java/hudson/plugins/copyartifact/SpecificBuildSelector.java http://jenkins-ci.org/commit/copyartifact-plugin/fe01ca92d38a088a8349ad9c9b5c9449b56d065a Log: [FIXED JENKINS-14266] check unset variable if env.expand don't expand a variable, this means this one has not been set, then should not break trying to parse, just ignore and let the "optional" plugin parameter fail the build if necessary
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Nicolas De loof
          Path:
          src/main/java/hudson/plugins/copyartifact/.SpecificBuildSelector.java.swp
          src/main/java/hudson/plugins/copyartifact/SpecificBuildSelector.java
          http://jenkins-ci.org/commit/copyartifact-plugin/43452e9f003d09ff6210a841bcb6c315b8aef0c3
          Log:
          [FIXED JENKINS-14266] check unset variable

          if env.expand don't expand a variable, this means this one has not been set, then should not break trying to parse, just ignore and let the "optional" plugin parameter fail the build if necessary

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nicolas De loof Path: src/main/java/hudson/plugins/copyartifact/.SpecificBuildSelector.java.swp src/main/java/hudson/plugins/copyartifact/SpecificBuildSelector.java http://jenkins-ci.org/commit/copyartifact-plugin/43452e9f003d09ff6210a841bcb6c315b8aef0c3 Log: [FIXED JENKINS-14266] check unset variable if env.expand don't expand a variable, this means this one has not been set, then should not break trying to parse, just ignore and let the "optional" plugin parameter fail the build if necessary
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/test/java/hudson/plugins/copyartifact/SpecificBuildSelectorTest.java
          http://jenkins-ci.org/commit/copyartifact-plugin/8d3a3c84b3aa8d499adb77b4345badbe98e73f25
          Log:
          JENKINS-14266 Confirming fix with a test.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/test/java/hudson/plugins/copyartifact/SpecificBuildSelectorTest.java http://jenkins-ci.org/commit/copyartifact-plugin/8d3a3c84b3aa8d499adb77b4345badbe98e73f25 Log: JENKINS-14266 Confirming fix with a test.

            People

            • Assignee:
              mindless Alan Harder
              Reporter:
              danielbeck Daniel Beck
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: