Copy Artifacts from Another Job
If your application depends on artifacts from another job, you can configure the job to copy those artifacts when a build is run:
-
Open the job’s configuration page.
-
Click Configure
.
-
Click the Before Build tab.
-
Click Add Before Build Action and select Copy Artifacts.
-
In From Job, select the job whose artifacts you want to copy.
-
In Which Build, select the build that generated the artifacts.
-
If you select the Use last successful build if not run in pipeline option, the last successful (other) build will be used if this build isn't run in a pipeline.
The build will fail if you don't select the option but do select the upstream build in the previous step and don't run the build in a pipeline.
-
In Artifacts to copy, specify the artifacts to copy. When a build runs, the artifacts are copied with their relative paths.
If you don't specify a value, the build will copy all artifacts. The
archive.zip
file is never copied. -
In Target Directory, specify the workspace directory where the artifacts will be copied.
Be sure that directory names don't contain a forward slash or null character. You can optionally include parameters in the path, such as:
data/$myDir/$myDir2/stuff
If Target Directory is left empty, the artifacts will be copied to the root directory of the workspace.
-
To flatten the directory structure of the copied artifacts, select Flatten Directories.
-
By default, if a build can’t copy artifacts, it'll be marked as failed. If you don’t want the build to be marked as failed, select Optional (Do not fail build if artifacts copy failed).
-
Click Save.