Archive Artifacts
You can manually download archived artifacts. By default, build artifacts are kept as long as the build log is.
If you want a job's builds to archive artifacts, you can do so as an after build action:
-
Open the job’s configuration page.
-
Click Configure
.
-
Click the After Build tab.
-
Click Add After Build Action and select Artifact Archiver.
-
In Files to archive, enter a comma-separated list of file paths, such as
env/,SQL/,target/
, using the path relative to the workspace, not the full file path.You can use wildcards to archive multiple files. For example, you could use
env/**
to archive all files in all subdirectories of theenv
directory. Or, you could useenv/**/*.bin
to archive all files that end with the.bin
extension in all subdirectories of theenv
directory.Here are some more examples:
**/*
or**
archives all files in all directories and subdirectories**/*.sql
archives all files that have a.sql
file extension, in all directories and subdirectoriesenv/*
matches all files in theenv
folder itself, but doesn't include any files in any subdirectories
The patterns can be more complex too. For example, you could use
**/target/*.jar
to archive.jar
files in alltarget
directories your workspace. -
In Files to exclude, enter a comma-separated list of files, including the path, as described in the previous step.
A file that matches the exclude pattern won’t be archived even if it matches the pattern specified in Files to archive.
-
If your application is a Maven application and you want to archive Maven artifacts, select Archive Maven Artifacts.
To archive the Maven POM file along with the Maven artifacts, select Include POM.xml.
-
Click Save.
Discard Old Builds and Artifacts
To save storage space, you can configure a job to discard its old builds and artifacts:
-
Open the job’s configuration page.
-
Click Settings
.
-
Click the General tab, if necessary.
-
If not selected, select Discard Old Builds.
-
Configure the discard options.
-
Click Save.
Old builds will be discarded after you save the job configuration and after a job has been built.