Is there a way to save/archive multiple artifacts from the same build?
Jenkins only allows a single \'Archive the Artifacts\' post build step, and grey\'s out the option
You can use Ant-style pattern, e.g. target/*.jar
to archive multiple artifacts.
And it is possible to use a comma separated list of patterns if your files can't be matched with one pattern, e.g. target/*.jar, target/*.war
.
The ? button next to the input field reveals this info.
You can comma separate the paths, like this:
XXX.UnitTests\bin\Release\**.* , XXX.WriteAPI.Service/bin/Release/**.*
Then you get two separate artifacts.
See http://ant.apache.org/manual/Types/fileset.html for details of the Ant Pattern syntax.
All the answers on here show how to combine multiple file patterns into 1 artifact which is not what the OP asked for.
An example of what was asked for is to have something like a Single Page Web app build that has environment specific settings compiled into the JavaScript for QA, Staging and Production.
As you would want to deploy the same build to multiple environments, you would need 3 builds, each with it's own environment settings in it. When you deploy the archive, you would not want to deploy the contents of all 3 to each environment and extract just the content for that one environment, because it is expensive to copy 66% more than is needed each time and could be error prone.
So, it is reasonable to generate 2 or more builds into their own artifacts and deploy 1 of those artifacts, depending on the target environment.
Jenkins should support multiple artifacts, not just making 1 artifact bigger.
If you want to save two different types of files like zip files and html files, then you can use
*.html,*.zip
It will help you to archive all zip files and html files in that directory.
No, jenkins does not provide only one artifact to save. You can use wild card pattern to same any number of artifacts, For example All Jars - **/*.jar All War - **/*.war and so on.
**/ means Any directory.