Details
Description
Issue Summary
Builds are no longer failing when a required artifact cannot be created and the location doesn't exist. The build should fail regardless of the location since the artifact couldn't be published.
This is reproducible on Data Center: yes.
Steps to Reproduce
- Create a plan with a simple inline Script task
echo hello world
- Create an artifact definition in your job with the following settings:
- Name: Test
- Location: target – it could be any location, just make sure it doesn't exist
- Copy pattern: hello-world.txt – it could be any pattern, just make sure it doesn't pick up anything
- The Shared option is not needed to reproduced this issue.
- Check the Required box.
Expected Results
Build will fail since the artifact couldn't be published:
simple 19-Apr-2022 12:56:14 Publishing an artifact: Test error 19-Apr-2022 12:56:14 Unable to publish artifact [Test]: the source directory /var/atlassian/application-data/bamboo/xml-data/build-dir/PROJ-PLAN-JOB1/test does not exist. error 19-Apr-2022 12:56:14 The artifact is required, build will now fail. simple 19-Apr-2022 12:56:14 The artifact hasn't been successfully published after 322.9 μs
Actual Results
The build succeeds even though the required artifact wasn't published successfully. Here's an example from the build log:
simple 19-Apr-2022 15:10:03 Publishing an artifact: Test error 19-Apr-2022 15:10:03 Unable to publish artifact [Test]: the source directory /var/atlassian/application-data/bamboo/local-working-dir/PROJ-PLAN-JOB1/target does not exist. simple 19-Apr-2022 15:10:03 The artifact hasn't been successfully published after 1.072 ms
If you remove the location (leave the Location field empty in your artifact definition) then the build fails as expected. It only succeeds if the location doesn't exist.
Workaround
Upgrade to version 8.2.1, which is not affected, or:
Specify the location of the artifact in the Copy pattern field rather then the Location field (leave this field empty). For example, instead of using the following artifact definition:
- Name: myArtifact
- Location: target
- Copy pattern: hello-world.txt
- Required box checked.
You can use the following and put the location in the Copy pattern field:
- Name: myArtifact
- Location:
- Copy pattern: target/hello-world.txt
- Required box checked.
You don't have to put the full path to the file in the filesystem – it will be relative to the build working directory as long as you don't put a / in front of it. This will be enough to make the build fail if the artifact is not published.