6

The Jenkins docs say:

artifacts
You can use wildcards like 'module/dist/**/*.zip'. See the includes attribute of Ant fileset for the exact format. The base directory is the workspace. You can only archive files that are located in your workspace.

    Type: String

but I'm not clear how you add 2 separate artifacts.

Do you have 2 separate archiveArtifacts commands? Or separate artifact filenames by a space?

E.g. archiveArtifacts artifacts: "my.tar.gz my2.txt", fingerprint: true

archiveArtifacts artifacts: "my.tar.gz", fingerprint: true archiveArtifacts artifacts: "my.txt", fingerprint: true

https://jenkins.io/doc/pipeline/steps/core/#archiveartifacts-archive-the-artifacts

Snowcrash
  • 80,579
  • 89
  • 266
  • 376
  • Usually we put all our to be archived files into a folder and then directly archive the whole folder so you get all files by one command. 'archiveArtifacts artifacts: 'Test/*.*' – Michael Kemmerzell Feb 25 '19 at 13:15
  • 1
    Duplicate : https://stackoverflow.com/a/32826133/2661253 – Zak Feb 25 '19 at 14:22

1 Answers1

4

You can archive multiple files as artifacts. you can use comma-separated file names as :

archiveArtifacts artifacts: "my.tar.gz, my2.txt"

Chhagan
  • 136
  • 1
  • 7