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
    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'

    • Type: 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.
    • Type: boolean
  • caseSensitive (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.
    • Type: boolean
  • defaultExcludes (optional)
    • Type: boolean
  • excludes (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.
    • Type: String
  • fingerprint (optional)
    • Type: boolean
  • followSymlinks (optional)
    By disabling this option all symbolic links found in the workspace will be ignored.
    • Type: boolean
  • onlyIfSuccessful (optional)
    • Type: boolean

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
    Can use wildcards like module/dist/**/*.zip (see the @includes of Ant fileset for the exact format). The base directory is the workspace.
    • Type: String
  • caseSensitive (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.
    • Type: boolean
  • defaultExcludes (optional)
    • Type: boolean
  • excludes (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.
    • Type: String

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.