Pipeline Build teardown issues
Asked by Jonathan Gafner:

Hi

In our pipeline we have one step on self host (that run in parallel with other steps ) that has issue with the Build teardown taking forever (no artifacts are upload and no caches ) and I have some questions about it:  

1. Any documentation on exactly what BB is doing during the Build teardown?
2. Why the Build teardown is taking minutes and show always \`\`\`\<1s\`\`\` ?
3. The Build teardown is printing "Searching for test report..." and then it keep running without any info - how can I see what it is doing ?
4. Any way to avoid the test scan for a step ?

In attach images of the total time and the steps times: (the 5 min diff is all in the build teardown)

![Screen Shot 2022-07-05 at 12.33.36.png](https://community.atlassian.com/t5/image/serverpage/image-id/204553i1EBAEC6DE3B407B9/image-size/large?v=v2&px=999 "Screen Shot 2022-07-05 at 12.33.36.png")![Screen Shot 2022-07-05 at 12.34.27.png](https://community.atlassian.com/t5/image/serverpage/image-id/204554i1B2441775DDEA3A8/image-size/large?v=v2&px=999 "Screen Shot 2022-07-05 at 12.34.27.png")  

Thanks


Answers:
author: Jonathan Gafner
body: [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086) hi - any chance you have good news for me on how one can avoid the scan complete ?   
Not all pipeline run tests so I don't get why on each pipeline BB need to scan for tests result this is really a pain point for us

Thanks

comments: author: Theodora Boudale
body: Hi Jonathan,

Scanning for test reports cannot be disabled. I went ahead and created a feature request about this in our issue tracker:

* <https://jira.atlassian.com/browse/BCLOUD-22370>

The public issue tracker is where our product managers and development team track feature requests. I would suggest adding your vote to that feature request (by selecting the **Vote for this issue** link) as the number of votes helps us better understand the demand for new features. You can ask your team members to add their votes as well.

I would also suggest adding a comment with feedback and your use case, and adding 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](https://confluence.atlassian.com/support/implementation-of-new-features-policy-201294576.html) and any updates will be posted in the feature request.

Kind regards,  
Theodora


author: Jonathan Gafner
body: Hi [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086)   

I found the root cause but not sure how to solve it...   

The cause of the long teardown is that we have a node_module under one of our modules and it contains 1120 dependencies (folders) that are scanned by the pipeline to find test results xml. I found it out by adding an \`\`\`*rm -rf\`\`\`* step to the node_modules as a last script step and I saw that it is taking now minutes to remove the node_modules folder but the teardown become less than a second.  

The wrong duration presented is still a bug of yours but at least I know the root of the duration.   

I was wondering if I ll create a fake dummy xml test result the scanner will stop with the first found or it scanning depth 4 (in the [docs](https://support.atlassian.com/bitbucket-cloud/docs/test-reporting-in-pipelines/) it say 3 and in the job it says 4 ) ?   

<br />

<br />

<br />

Thanks

comments: author: Theodora Boudale
body: Hi Jonathan,

Creating a dummy xml test result is not going to work, because the scanner will keep running.

One thing you could try is creating a directory with depth 5 and moving the *node_modules* directory there. If you do that, you may need to change the configuration in your project so that it can find the *node_modules* directory in the new location.

I can create a feature request about the ability to disable the test report scanner for our development team to consider, please feel free to let me know if you'd like me to proceed with that.

I will reach out to my team internally regarding the discrepancy between the documentation and the Pipelines log.

Kind regards,  
Theodora


author: Jonathan Gafner
body: [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086) thanks.

But this is a script made by the pipeline and is added to each step define in the yaml, so it is on Atlassian to add logs.   

Regarding the ticket I saw similar ticket opened since 2017 ;(   

Thanks anyway

comments: author: Theodora Boudale
body: Hi Jonathan,

Regarding the following:
> I'm not sure if there is a way to avoid the test scan for a step, I will ask my team and get back to you.

I'm afraid there is no way to disable scanning for test reports.

If you would like us to investigate why the 'Build teardown' is taking such a long time for your builds, please create a support ticket by following the steps I mentioned in my previous reply, otherwise, we cannot access the repo and investigate. We need a support ticket for this instead of a community question.

The support ticket will be visible only to you and Atlassian staff, so you can provide the URL of a build with this issue and it won't be publicly visible.

Kind regards,  
Theodora


author: Theodora Boudale
body: Hi Jonathan,

We don't have any documentation specific to the "Build teardown". I believe that the times displayed in the Pipelines log get updated when there is output, so one possible reason for the time being displayed as \<1s would be that there is no newer output in "Build teardown".

It is hard to say what is happening though without checking additional logs. I would advise creating a ticket with the support team and providing the URL of a build with this issue so we can further investigate. With a support ticket open, the engineer working on your case will be able to access the repo and additional logs in order to investigate.

Since your workspace is on a paid billing plan, you can create a ticket via <https://support.atlassian.com/contact/#/>, in "What can we help you with?" select "Technical issues and bugs" and then Bitbucket Cloud as product.

I'm not sure if there is a way to avoid the test scan for a step, I will ask my team and get back to you.

Kind regards,  
Theodora


Tags: bitbucket-cloud

bitbucket-pipelines

cloud