'Jenkins: archiveArtifacts - multiple distinct files

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



Solution 1:[1]

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

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

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1