Share files between pipelines?

29 views
Skip to first unread message

zil...@gmail.com

unread,
Sep 16, 2020, 11:48:35 AM9/16/20
to Jenkins Users
I posted this in Stackoverflow but i thought I'd post it here too, since this is a Jenkins specific group


 I want to share a file between two different pipelines, running on 2 different nodes.

I tried to use the Copy Artifacts plugin like so

Pipeline1:
node {'linux-0') { 
  stage("Create file") { 
     sh "echo \"hello world\" > hello.txt"
     archiveArtifacts artifact: 'hello.txt', fingerprint: true
   }
 }

Pipeline2:
node('linux-1') { 
  stage("Copy form first pipeline") { 
    copyArtifacts projectName: 'Pipeline1',
                  fingerprintArtifacts: true,
                  filter: 'hello.txt' 
   }
}

and I get the following error for Pipeline2

ERROR: Unable to find project for artifact copy: Pipeline1 This may be due to incorrect project name or permission settings; see help for project name in job configuration. Finished: FAILURE

What am I missing?

Gianluca

unread,
Sep 16, 2020, 11:55:53 AM9/16/20
to Jenkins Users
The error is very verbose.
So ... or the project name is incorrect ... or the user running Pipeline2 doesn't permission to see "Pipeline1".

You can check the project name by looking at the Jenkins user interface for "Full project name: .... "
See screenshot.

Ah ... remember that you have to escape the "/" with "%2F" in the pipeline code.
Screenshot_20200916_165422.png

zil...@gmail.com

unread,
Sep 16, 2020, 12:37:19 PM9/16/20
to Jenkins Users
Thanks.
Reply all
Reply to author
Forward
0 new messages