The following plugin provides functionality available through Pipeline-compatible steps. Read more about how to integrate steps into your Pipeline in the Steps section of the Pipeline Syntax page.

For a list of other such plugins, see the Pipeline Steps Reference page.

Jenkins Core

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. Automatic artifact archiving can be disabled under the advanced Maven options.

The Pipeline Snippet Generator generates this example when all arguments are set to true (some arguments by default are true):
archiveArtifacts artifacts: '**/*.txt',
                   allowEmptyArchive: true,
                   fingerprint: true,
                   onlyIfSuccessful: true

  • artifacts : String
    You can use wildcards like 'module/dist/**/*.zip'. See the includes attribute of Ant fileset for the exact format -- except that "," (comma) is the only supported separator. The base directory is the workspace. You can only archive files that are located in your workspace.

    Here are some examples of usage for pipeline:

    • How to archive multiple artifacts from a specific folder:
      archiveArtifacts artifacts: 'target/*.jar'

    • How to archive multiple artifacts with different patterns:
      archiveArtifacts artifacts: 'target/*.jar, target/*.war'

    • How to archive multiple nested artifacts:
      archiveArtifacts artifacts: '**/*.jar'

  • allowEmptyArchive : boolean (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.
  • caseSensitive : boolean (optional)
    Artifact archiver uses Ant org.apache.tools.ant.DirectoryScanner which by default is case sensitive. For instance, if the job produces *.hpi files, pattern "**/*.HPI" will fail to find them.

    This option can be used to disable case sensitivity. When it's unchecked, pattern "**/*.HPI" will match any *.hpi files, or pattern "**/cAsEsEnSiTiVe.jar" will match a file called caseSensitive.jar.
  • defaultExcludes : boolean (optional)
  • excludes : String (optional)
    Optionally specify the 'excludes' pattern, such as "foo/bar/**/*". Use "," to set a list of patterns. A file that matches this mask will not be archived even if it matches the mask specified in 'files to archive' section.
  • fingerprint : boolean (optional)
  • followSymlinks : boolean (optional)
    By disabling this option all symbolic links found in the workspace will be ignored.
  • onlyIfSuccessful : boolean (optional)

fingerprint: Record fingerprints of files to track usage

Jenkins can record the 'fingerprint' of files (most often jar files) to keep track of where/when those files are produced and used. When you have inter-dependent projects on Jenkins, this allows you to quickly find out answers to questions like:
  • I have foo.jar on my HDD but which build number of FOO did it come from?
  • My BAR project depends on foo.jar from the FOO project.
    • Which build of foo.jar is used in BAR #51?
    • Which build of BAR contains my bug fix to foo.jar #32?

To use this feature, all of the involved projects (not just the project in which a file is produced, but also the projects in which the file is used) need to use this and record fingerprints.

See this document for more details.

  • targets : String
    Can use wildcards like module/dist/**/*.zip (see the @includes of Ant fileset for the exact format). The base directory is the workspace.
  • caseSensitive : boolean (optional)
    Fingerprinter uses Ant org.apache.tools.ant.DirectoryScanner which by default is case sensitive. For instance, if the job produces *.hpi files, pattern "**/*.HPI" will fail to find them.

    This option can be used to disable case sensitivity. When it's unchecked, pattern "**/*.HPI" will match any *.hpi files, or pattern "**/cAsEsEnSiTiVe.jar" will match a file called caseSensitive.jar.
  • defaultExcludes : boolean (optional)
  • excludes : String (optional)
    Optionally specify the 'excludes' pattern, such as "foo/bar/**/*". Use "," to set a list of patterns. A file that matches this mask will not be fingerprinted even if it matches the mask specified in 'files to fingerprint' section.

Was this page helpful?

Please submit your feedback about this page through this quick form.

Alternatively, if you don't wish to complete the quick form, you can simply indicate if you found this page helpful?

    


See existing feedback here.