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

COPYARTIFACT_BUILD_NUMBER_SUFFIX for pipelines (aka. workflow jobs)

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: copyartifact-plugin
    • Labels:
      None
    • Environment:
      jenkins 1.655
    • Similar Issues:

      Description

      Does the COPYARTIFACT_BUILD_NUMBER_SUFFIX work on expected lines in workflow/pipeline jobs? copy artifact command am using is

      step([$class: 'CopyArtifact', filter: '*.rpm', fingerprintArtifacts: true, projectName: 'test_pkg', resultVariableSuffix: 'testsuffix', selector: [$class: 'ParameterizedBuildSelector', parameterName: 'testparam'], target: 'test_packages'])

      when i do

      println COPYARTIFACT_BUILD_NUMBER_TESTSUFFIX

      am getting the below error

      groovy.lang.MissingPropertyException: No such property: COPYARTIFACT_BUILD_NUMBER_TESTSUFFIX for class: WorkflowScript

      println env.COPYARTIFACT_BUILD_NUMBER_TESTSUFFIX gives me null

        Attachments

          Activity

          Hide
          ikedam ikedam added a comment -

          Technically, COPYARTIFACT_BUILD_NUMBER_SUFFIX are implemented with EnvironmentContoributorAction.
          But pipeline (aka. workflow) doesn't work with EnvironmentContributorAction (Please also see JENKINS-29537).

          Possible solutions in future:

          • Pipeline supports EnvironmentContributorAction
          • Copyartifact provides an alternate way for pipelines to detect the build from where artifacts are copied.
            • I don't know much about pipelines, and don't know an appropriate solution.
          Show
          ikedam ikedam added a comment - Technically, COPYARTIFACT_BUILD_NUMBER_SUFFIX are implemented with EnvironmentContoributorAction. But pipeline (aka. workflow) doesn't work with EnvironmentContributorAction (Please also see JENKINS-29537 ). Possible solutions in future: Pipeline supports EnvironmentContributorAction Copyartifact provides an alternate way for pipelines to detect the build from where artifacts are copied. I don't know much about pipelines, and don't know an appropriate solution.
          Show
          ikedam ikedam added a comment - Related https://groups.google.com/d/msgid/jenkinsci-dev/1644147.f1qsRL37a5%40linux
          Hide
          hoshposh66 Lyndon Washington added a comment - - edited

          So is this issue that you cannot access the 'COPYARTIFACT_BUILD_NUMBER_SUFFIX' environment variable from within a pipeline build at all, or that if you are using the CopyArtifact plugin within a pipeline job to retrieve from another pipeline job, then the environment variable is not available?

          Show
          hoshposh66 Lyndon Washington added a comment - - edited So is this issue that you cannot access the 'COPYARTIFACT_BUILD_NUMBER_SUFFIX' environment variable from within a pipeline build at all, or that if you are using the CopyArtifact plugin within a pipeline job to retrieve from another pipeline job, then the environment variable is not available?
          Hide
          menehune23 Andrew Meyer added a comment - - edited

          I would love this feature. For pipelines/workflows, couldn't you just store it into a local variable rather than an environment variable? Similar to how this plugin works.

          In the meantime, we get around this by uploading a file in the source job called `buildNumber.txt` (generated by `sh "echo ${env.BUILD_NUMBER} > buildNumber.txt"), then using the `StatusBuildSelector` in the destination job to download the file from the last successful (or stable) build. Then `readFile` into a local variable.

          Show
          menehune23 Andrew Meyer added a comment - - edited I would love this feature. For pipelines/workflows, couldn't you just store it into a local variable rather than an environment variable? Similar to how this plugin works. In the meantime, we get around this by uploading a file in the source job called `buildNumber.txt` (generated by `sh "echo ${env.BUILD_NUMBER} > buildNumber.txt"), then using the `StatusBuildSelector` in the destination job to download the file from the last successful (or stable) build. Then `readFile` into a local variable.

            People

            • Assignee:
              Unassigned
              Reporter:
              kishorerp kishorerp
            • Votes:
              5 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

              • Created:
                Updated: