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

get the build number string from which artifacts where copied not working anymore

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Not A Defect
    • Component/s: copyartifact-plugin
    • Labels:
      None
    • Environment:
      Jenkins 2.263.1
      copyartifacts 1.43 and 1.45.3
    • Similar Issues:

      Description

      I have a job to deploy arbitrary builds

      back in Jenkins 2.249.3, i was able to do the following in declarative:

      pipeline {
      	parameters {
      		choice(name: 'JOB', choices: ["Job A", "Job B"], description: 'The Job from which to take the installation files')
      		buildSelector(name: 'RUN', description: 'Which build to use from Job')
      	}
      	agent any
      	stages {
      		stage('download artifacts')
      		{
      			steps {
      				script {
      					currentBuild.setDescription("using artifacts from $JOB #$params.RUN")
      				}
      				copyArtifacts(projectName: env.JOB, selector: buildParameter(params.RUN))
      			}
      		}
      		stage('deploy')
      		{
      			steps {
      			    sh 'true'
      			}
      		}
      	}
      }
      

       

      By that, the build description was set to e.g. "using artifacts from Job A # 42"

      after upgrading to Jenkins 2.263.1 while keeping copyartifacts 1.43, copyArtifatcs still works, but $params.RUN does not contain the run number anymore, it's jsut empty.

      upgrading to copyartifacts 1.45.3 did not resolve the issue.

        Attachments

          Activity

          Hide
          ikedam ikedam added a comment -

          I could not get what `BUILDRUN1` come from and why you believe `BUILDRUN1` should work.
          Your example pipeline script may be broken. Please check that.

          Show
          ikedam ikedam added a comment - I could not get what `BUILDRUN1` come from and why you believe `BUILDRUN1` should work. Your example pipeline script may be broken. Please check that.
          Hide
          reneb Rene Buergel added a comment - - edited

          sorry, i fixed the example pipeline script

          Show
          reneb Rene Buergel added a comment - - edited sorry, i fixed the example pipeline script
          Hide
          reneb Rene Buergel added a comment -

          It still works when using the SpecificBuildSelector. Unfortunately, this was also my use case with Jenkins 2.249.3.

          I'll do some more investigations

          Show
          reneb Rene Buergel added a comment - It still works when using the SpecificBuildSelector. Unfortunately, this was also my use case with Jenkins 2.249.3. I'll do some more investigations
          Hide
          reneb Rene Buergel added a comment -

          It only worked (and still works!) for SpecificBuildSelector and only for my specific case where the buildnumber is set in the build description and HTML is turned off. The full string is <SpecificBuildSelector plugin="copyartifact@1.45.3"> <buildNumber>2</buildNumber></SpecificBuildSelector>. If you remove all the "tags", only the buildnumber 2 remains.

          Show
          reneb Rene Buergel added a comment - It only worked (and still works!) for SpecificBuildSelector and only for my specific case where the buildnumber is set in the build description and HTML is turned off. The full string is <SpecificBuildSelector plugin="copyartifact@1.45.3"> <buildNumber>2</buildNumber></SpecificBuildSelector>. If you remove all the "tags", only the buildnumber 2 remains.

            People

            Assignee:
            reneb Rene Buergel
            Reporter:
            reneb Rene Buergel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: