Artifact dependency order (files overwrite)

Is there any particualr order that artifact dependencies will be processed if it will result in file overwrite? What would be result if ovewrwite will be due to multple rules in same dependency? In multiple dependencies? Will it always ovewrite with last? Save first only? Not defined?

I'm trying to setup skipping some builds with Partial Chain Execution and would like to define dependency to JobA and JobB that produce same artifact (placed in same location in target JobC). I'd like to have in JobC artifact from JobB if both JobA and JobB were executed, but have artifact from JobA  if JobB was skipped. Can it be guarantted achieved using just proper ordering of artifact/snapshot dependencies or I must write special step that would copy JobB rtifact if they present over JobA artifacts?

0
2 comments

Looks like per https://youtrack.jetbrains.com/issue/TW-35638/Allow-editing-artifact-dependency-order (and my experiments) artifact from last dependency will win, but would be nice to document it.

0

Hi Igor,

According to the official documentation, the order of artifact rules is irrelevant. If JobA and JobB run in parallel and both have the same target artifact path, the final artifact available in JobC may depend on which build finishes last. In such cases, it is not possible to reliably ensure which artifact will be used.

Of course, when JobB is skipped, you can use ?:SourcePath => DestinationPath, which means “copy the file if it exists, and ignore if it does not.” This allows optional artifacts without causing the build to fail.

However, if you need strict control over which artifact is used in JobC, we recommend handling the logic directly within the build steps of JobC—for example, by checking whether JobB’s artifact exists and falling back to JobA’s artifact if it does not.

0

Please sign in to leave a comment.