Archive multiple artifacts with same name

2,595 views
Skip to first unread message

Sverre Moe

unread,
Jun 13, 2016, 4:14:39 AM6/13/16
to Jenkins Users
As I am building on multiple slave nodes I get RPM artifacts from each node. Building on 4 64bit Linux OS, I will get 4 distinct artifacts with the same name. Using ArtifactArchiver will only archive one of those distinct archives and overwrite the previous archived artifact. Considering since each OS may have different versions of libraries one single artifact may not work on all the OS.

Is there a way around this problem that will allow me to archive 4 artifacts with same name?
I am using Jenkins Pipeline and performing the following step
step([$class: 'ArtifactArchiver', artifacts: '*.rpm', excludes: null, fingerprint: true, onlyIfSuccessful: true])

When I was previously using Multi-configuration builds, this was not a problem since each configuration would show their own artifacts.

Sverre Moe

unread,
Aug 12, 2016, 2:15:31 AM8/12/16
to Jenkins Users
As it stands, using archive is useless unless it can be organized by the node it was built on. Building a single project on multiple linux distributions will produce the same named file, but not necessary the same.

Brian Ray

unread,
Aug 23, 2016, 2:53:16 PM8/23/16
to Jenkins Users
Have you looked at the stash step? You can set an arbitrary name, which is how I got around a similar issue.

The only downside is that the artifacts aren't saved with the build. If you need that capability there may be a way to hack that however.

Sverre Moe

unread,
Aug 24, 2016, 2:39:48 AM8/24/16
to Jenkins Users
Yes, I am using several stash with different name derived from the slave name. This helps me to transfer the artifacts to our repository.

However my problem is with the archive step that makes the artifacts listed up in Jenkins.
In project branch job: Last Successful Artifacts 
In each project build: Build Artifacts

If I build an RPM on SLES12 and CentOS7, then that artifact would have the same name: project-1.0.0-1.x86_64.rpm
Using the archive step would overwrite the artifact the second time I call the archive step for the same named artifact.

Brian Ray

unread,
Aug 26, 2016, 12:53:20 PM8/26/16
to Jenkins Users
I can't think of a way around it without naming the artifacts slightly differently. That is frustrating.

Michael Lasevich

unread,
Aug 26, 2016, 1:55:01 PM8/26/16
to Jenkins Users
Have you considered creating a temp subdirectory with identity of your OS (can be generated automatically) and then moving your artifacts to that directory and archiving the directory? You end up with artifacts with same names in different directories - easy to browse and link to, and does what you want.

Something like this(untested):

temp="to_archive"
sh """
  dir="${temp}/\$(lsb_release -si)-\$(lsb_release -sr)-\$(uname -m)"
  mkdir -p "\${dir}"
  cp *.rpm "${dir}"
"""
dir(temp){ archive '**' }


-M

Sverre Moe

unread,
Aug 29, 2016, 3:14:46 AM8/29/16
to Jenkins Users
That worked. 

I removed
step([$class: 'ArtifactArchiver', artifacts: '*.rpm', excludes: null, fingerprint: true, onlyIfSuccessful: true])
from Build stage. 

Added
archive '**'
to the Publish stage.

Build Artifacts now list up same named RPMs under a directory for each build slave.
sles11-x86_64/package-1.1.1-x86_64.rpm
sles12-x86_64/package-1.1.1-x86_64.rpm
centos7-x86_64/package-1.1.1-x86_64.rpm

David Karlsen

unread,
Aug 30, 2016, 3:43:49 PM8/30/16
to jenkins...@googlegroups.com
I see the archive DSL have less options (fingerprint) than the wrapper-based version - should they become aligned?

--
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-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/f88d3af3-d8de-47ff-a09c-7ef165dec3a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages