Jenkins Copy Artifact unable to find folder/multiProjectPipeline/branchWithSlash

Viewed 3908

I have Jenkins LTS 2.60.2 on Windows Server 2016 and using these plugins:

  • Folders plugin (6.1.0)
  • Copy Artifact plugin (1.38.1)
  • Pipeline plugin (2.5) + all dependent pipeline sub-plugins
  • Various other dependent plugins...

See Pipeline to use artifacts from 2 projects associated by the same git branch name for more details about my setup, but to sum it up I have these items:

  • playground (a folder created with the Folders plugin to group all these following items)
  • frontend (multibranch pipeline)
  • backend (multibranch pipeline)
  • configure (pipeline with a parameter called BRANCH_NAME)

The frontend and backend git repos, both have a branch called master and one called release/2017.2.

The idea is to call the configure pipeline automatically after each successful build, passing the git branch name. Automatically triggering the configure pipeline works.

What doesn't work and I need your help to fix, is the step inside the configure pipeline to copy the artifacts from a multibranchPipeline/specificBranch.

If for the BRANCH_NAME parameter (or the upstream pipeline) is master it works. If BRANCH_NAME is: release/2017.2 I get this error:

ERROR: Unable to find project for artifact copy: playground/frontend/release%2f2017.2 This may be due to incorrect project name or permission settings; see help for project name in job configuration. Finished: FAILURE

The configure pipeline looks like this:

node {
  stage('Prepare') {
      def projectname = "playground/frontend/" + "${BRANCH_NAME}".replace("/", "%2f")
      step([$class: 'CopyArtifact', projectName: "${projectname}", selector: [$class: 'StatusBuildSelector', stable: false]])
  }
  stage('Archive') {
      archiveArtifacts '**'
  }
}

As you can see I already replace / with %2f (it's needed).

If I don't use the "playground" folder (all my pipelines as is, not inside a folder item), it works. If I use the folder and use the master branch, it works. It doesn't work if I use the folder and a branch name like 2017.2. What am I doing wrong? Can you help making it work? Of well if it's a bug (I searched in https://issues.jenkins-ci.org and found some bugs where a similar setup with folder doesn't work, but they have been fixed... so I really wonder...) in the copy artifact plugin, please file the bug and share the link here, so we can all monitor its progress...

Thank you.

2 Answers
Related