I'm working on a basic Jenkins pipeline. The build and testing are successful but I'm looking at how to archive the build. For context, this is a simple Rust webserver.
Under the pipeline steps documentation in the Basic Steps plugin, it has the archive
function. But it says:
Archives build output artifacts for later use. As of Jenkins 2.x, you may use the more configurable
archiveArtifacts
.
I cannot find any documentation on archiveArtifacts
. There are some examples, but I would like to look at the documentation for it, what parameters it accepts, i.e. what makes it more configurable than archive
.
My question: is there a place where this documentation is best found? jenkins.io is incomplete and wiki.jenkins.io is missing this command.
archiveArtifacts : Archive the artifacts. Archives the build artifacts (for example, distribution zip files or jar files) so that they can be downloaded later. Archived files will be accessible from the Jenkins webpage.
Normally, Jenkins keeps artifacts for a build as long as a build log itself is kept, but if you don't need old artifacts and would rather save disk space, you can do so. Note that the Maven job type automatically archives any produced Maven artifacts. Any artifacts configured here will be archived on top of that.
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/*.
I suggest archiveArtifacts: Archive the artifacts from the Pipeline Steps Reference.
Archives the build artifacts (for example, distribution zip files or jar files) so that they can be downloaded later. Archived files will be accessible from the Jenkins webpage. Normally, Jenkins keeps artifacts for a build as long as a build log itself is kept, but if you don't need old artifacts and would rather save disk space, you can do so.
Note that the Maven job type automatically archives any produced Maven artifacts. Any artifacts configured here will be archived on top of that. Automatic artifact archiving can be disabled under the advanced Maven options.
artifacts
String
allowEmptyArchive
(optional)
Normally, a build fails if archiving returns zero artifacts. This option allows the archiving process to return nothing without failing the build. Instead, the build will simply throw a warning.
boolean
excludes
(optional)
Optionally specify the 'excludes' pattern, such as "foo/bar/**/*". A file that matches this mask will not be archived even if it matches the mask specified in 'files to archive' section.
String
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With