How to make copy artifact plugin copy multiple artifact from jobs dynamically

809 views
Skip to first unread message

Bala murugan

unread,
Mar 15, 2015, 11:17:53 PM3/15/15
to jenkins...@googlegroups.com
Hi All,

In jenkins, 
I have a situation, where i need to copy artifacts from multiple jobs and each time the number of jobs changes. Is there a way to use copy artifact plugin to copy from multiple workspaces which can be configurable..?

Appreciate your help.

Thanks
Bala

Matthew...@diamond.ac.uk

unread,
Mar 16, 2015, 6:52:13 AM3/16/15
to jenkins...@googlegroups.com

The copy artifact does _not_ copy from the workspace, it only copies the artifacts that Jenkins saves.

You can copy saved artifacts from as many different jobs as you want – you just need multiple “copy artifacts” steps.

 

--

 

-- 

This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.
Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd.
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.
Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
 

Daniel Beck

unread,
Mar 16, 2015, 1:15:48 PM3/16/15
to jenkins...@googlegroups.com
On 16.03.2015, at 11:52, Matthew...@Diamond.ac.uk wrote:

> The copy artifact does _not_ copy from the workspace

Actually, it does.

Weird and basically a "worst practice" IMO, but it exists.

Bala murugan

unread,
Mar 16, 2015, 10:02:07 PM3/16/15
to jenkins...@googlegroups.com, Matthew...@diamond.ac.uk
Hi Daniel,

Yes i can add multiple copy_artifacts steps.. But for me, the number of artifacts i need to copy changes everytime, I am thinking a way to avoid changing the job to add and delete the copy_artifacts steps everytime.

Is there a way to do it?

Cheers
Bala

Bala murugan

unread,
Mar 16, 2015, 10:03:46 PM3/16/15
to jenkins...@googlegroups.com

Hi all,

Yes i can add multiple copy_artifacts steps.. But for me, the number of artifacts i need to copy changes everytime, I am thinking a way to avoid changing the job to add and delete the copy_artifacts steps everytime.

Is there a way to do it?

Cheers
Bala


Richard Bywater

unread,
Mar 16, 2015, 10:13:57 PM3/16/15
to jenkins...@googlegroups.com
What drives the number of artifacts that need copying? (That is, how is the job going to work out the artifacts that are required to be copied)

Richard

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/b52cfa21-9fe7-4c71-b677-738e382d34c3%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Bala murugan

unread,
Mar 16, 2015, 11:44:40 PM3/16/15
to jenkins...@googlegroups.com
So I have 21 different jobs which runs seperately for each git repo and archives the artifact.

And i have a job which deploys to a integration environment. in this job, i want to have these 21 jobs as choices , and i can select what jobs i need to copy each time when i trigger this job,,  the problem for me is if i have extended choice parameter i cannot use that value to pass to the copy_artifact plugin.

Does it make sense of what i am trying to achieve?

Cheers

Maciej Jaros

unread,
Mar 17, 2015, 6:13:56 AM3/17/15
to jenkins...@googlegroups.com
2015-03-17 o 04:44, Bala murugan:
So I have 21 different jobs which runs seperately for each git repo and archives the artifact.

And i have a job which deploys to a integration environment. in this job, i want to have these 21 jobs as choices , and i can select what jobs i need to copy each time when i trigger this job,,  the problem for me is if i have extended choice parameter i cannot use that value to pass to the copy_artifact plugin.

Does it make sense of what i am trying to achieve?

You can use a Conditional step with a Regular expression match. You still need 21 steps... which is kind of hard to set up... But it is doable.

In the below screen "WhatBranchShoulBeUsed" is a Choice Parameter exposed to users (on of its values is "release").


Matthew...@diamond.ac.uk

unread,
Mar 17, 2015, 6:38:45 AM3/17/15
to jenkins...@googlegroups.com
Indeed, I see you're correct - when you specify "Which Build", there is an option "Copy from WORKSPACE of latest completed build".
As you say, of dubious merit, but doable.

> -----Original Message-----
> > The copy artifact does _not_ copy from the workspace
>
> Actually, it does.
>
> Weird and basically a "worst practice" IMO, but it exists.

Ginga, Dick

unread,
Mar 17, 2015, 8:32:35 AM3/17/15
to jenkins...@googlegroups.com

Are you sure you cannot use the choice parameter in the Project name field? I do. I pass in project and build number and use them this way:

 

Bala murugan

unread,
Mar 17, 2015, 10:34:49 AM3/17/15
to jenkins...@googlegroups.com
@rginga

Are u selecting mutiple choices in the $(PROJECT_ARTIFACTS} variable.. that where i get the problem..

single choice is working fine. when is select mutiple choices the copy artifact steps fails..

Ginga, Dick

unread,
Mar 17, 2015, 10:46:44 AM3/17/15
to jenkins...@googlegroups.com

I see. Nope, that field will take only one project name. Having spent all of 6 minutes thinking about this J you will have to accumulate all your artifacts in one place, perhaps on a share, and then use a shell command to copy the ones based on your extended choice values.

 

From: jenkins...@googlegroups.com [mailto:jenkins...@googlegroups.com] On Behalf Of Bala murugan
Sent: Tuesday, March 17, 2015 10:35 AM
To: jenkins...@googlegroups.com
Subject: Re: How to make copy artifact plugin copy multiple artifact from jobs dynamically

 

@rginga

 

Are u selecting mutiple choices in the $(PROJECT_ARTIFACTS} variable.. that where i get the problem..

 

single choice is working fine. when is select mutiple choices the copy artifact steps fails..

 


On Tuesday, 17 March 2015 20:32:35 UTC+8, rginga wrote:

Are you sure you cannot use the choice parameter in the Project name field? I do. I pass in project and build number and use them this way:

 

Image removed by sender.

Reply all
Reply to author
Forward
0 new messages