Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Is it possible to retrieve artifacts from "failed' builds?

Sam Wainwright November 10, 2021

We're attempting to implement a basic smoke test suite using Pipelines + Cypress. Obviously, we'll want to have access to the video/screenshot artifacts of those runs especially if they fail, but it seems like the artifacts aren't available after a 'failed' step. Is what we're trying possible?

2 answers

1 accepted

2 votes
Answer accepted
Caroline R
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 12, 2021

Hi, @Sam Wainwright! Welcome to the community! 

Artifacts are not uploaded for the failed steps. Bitbucket pipelines are configured to stop at any non-zero exit code. That means that the pipeline execution is stopped when cypress fails the tests. Because artifacts are stored after the last step of the pipeline, you won’t have any artifacts.

Bitbucket Pipelines achieves the default behavior of exiting on the first error by prepending your script with the "set -e” bash command. You can "undo” this at any point in your script using the command "set +e”. If you want all the commands in your script to execute regardless of errors then put "set +e” at the top of your script. If you just want to ignore the error for one particular command then put "set +e” before that command and "set -e” after it.

Once the scripts are forcefully successful with the help of the method mentioned above, the artifacts upload part will be executed and they will be available for download later.

I hope this helps, but do let me know if you have any questions. 

Kind regards,
Caroline

Sam Wainwright November 12, 2021

Great, that did the trick. Thanks!

Caroline R
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 15, 2021

Hi, Sam! Thanks for your confirmation, I'm glad to know it worked! 

Kind regards,
Caroline 

Christian Sciberras May 5, 2023

So the solution to getting failure results from a pipeline is to force the pipeline to look like it is successful??

Like Martynas Šustavičius likes this
0 votes
Simon Schick January 24, 2022

Is there any other option planned on integrating? This way, a build will be marked as successful even though it failed ... Can we get an option where we can enable the collection of artefacts on error?

Caroline R
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 24, 2022

Hi, Simon. 

Currently, Artifacts are not uploaded for failed steps. So, if you need that, we can create a feature request to implement it. We just need some additional details about your business case (the reason you need this feature) to raise this request. 

Kind regards,
Caroline 

Simon Schick January 24, 2022

Thanks very much for your fast reply on this! Well, my business case is as described by the originator of the issue.

We use `cypress` to run our tests, which creates screen-recordings of tests which I want to access if the tests fail. Furthermore we use the same pipeline to automatically upload the build to our staging environment, which should not happen if the tests fail. Furthermore, a red test indicates that there's something wrong, so I'd like it red (to use bitbuckets notifications for failed tests) but still have access to the artifacts.

One possible solution could be to provide an option per registered artifact, where I can decide to have them 1. despite of the result - or - 2. only if failed or succeeded. The option "only on success" could then be the default option, as this is the behavior as it is today.

Does this sum it up?

Caroline R
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 27, 2022

Hi, Simon. 

Thanks for sharing the additional details about your request. I have created the following feature request to add the option to retrieve artifacts from failed builds: 

We suggest that you add your vote there (by selecting the Vote for this issue link) as the number of votes helps the development team and product managers better understand the demand for new features. 

You are more than welcome to leave any feedback, and you can also add yourself as a watcher (by selecting the Start watching this issue link) if you'd like to get notified via email on updates.

Implementation of new features is done as per our policy here and any updates will be posted in the feature request. 

Kind regards,
Caroline

Like Simon Schick likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events