Pipeline Fail but no useful information about the error
Asked by ronwaldo_querol:

I have parallel steps - each steps use linux shell runners and execute scripts.  

The scripts contains action that pulls the latest code and restarting service.  

The script was use in all steps, other step is success and other is fail but on fail steps, the build teardown is same on the successful steps:  

![Screenshot 2024-02-07 002822.png](/t5/image/serverpage/image-id/304663i9A52BA0113ED6549/image-size/large?v=v2&px=999 "Screenshot 2024-02-07 002822.png")  

I'm using the latest version of pipelines-runner as of today:  
atlassian-bitbucket-pipelines-runner-1.559


Answers:
author: Mark C
body: Hi [@ronwaldo_querol](/t5/user/viewprofilepage/user-id/5423717),

Welcome to the community.

For your Parallel steps, would you be able to confirm if you're using the same Linux Shell runner?

Also, please be aware of how the Linux Shell runners run your scripts:
> Linux Shell Runners use Bash to run pipeline steps on your Linux machine (host device). This allows the runner to execute applications on the host, but does not provide a clean build environment for every step. Any side effects generated by the step (such as, installing any applications, starting a database service, or editing a file outside of the build directory) would potentially affect the next step to be run (including new pipeline runs). To compensate for this, the runner try to empty the build directory empty after each step. It is your responsibility to make sure the scripts you run in each step won't have a major impact on other steps.

**Reference** : [Set up runners for Linux Shell](https://support.atlassian.com/bitbucket-cloud/docs/set-up-runners-for-linux-shell/)

Regards,  
Mark C

comments: author: ronwaldo_querol
body: Hi [@Mark C](/t5/user/viewprofilepage/user-id/1210823) - no, each parallel steps use Linux Shell runner but each of them used different workspace runner.  

Workspace Runners:

Runner name: my-runner-1  

Labels: self.hosted, linux.shell, my-runner-1

Runner name: my-runner-2

Labels: self.hosted, linux.shell, my-runner-2

Where is the build directory located and how we can empty after each step ?


author: Mark C
body: Hi [@ronwaldo_querol](/t5/user/viewprofilepage/user-id/5423717)  

<br />

Are those runners running on the same self-hosted machine?  
If yes, you can try using only 1 runner for your parallel steps and see how it goes.  

The build directory is usually located from where you started the runners in your self-hosted machine.  

Regards,  
Mark C


author: ronwaldo_querol
body: [@Mark C](/t5/user/viewprofilepage/user-id/1210823) - no, they running on separate host instance.  

So our use case is we have separate repository where we store script related to deployment including the script that run linux shell runner.  

We created a linux service to start/stop the linux shell runner.  

Everytime there is changes on this repository - the pipeline will access every servers(1 server = 1 step) will try to restart the linux shell runner service.  

The service is actually restarting, but the status on the pipeline is failed.


author: Theodora Boudale
body: Hi [@ronwaldo_querol](/t5/user/viewprofilepage/user-id/5423717),

Please allow me to step in as Mark is out of office at the moment.

You mentioned that you execute some scripts during your builds. If the command in your yml file is for example

```
- ./somescript.sh
```

You can adjust it as follows:

```
- ./somescript.sh || echo $?
```

If the execution of somescript.sh fails, then the exit code will get printed so we can see if the script returns a non-zero exit code. A Pipelines step will fail if a command returns a non-zero exit code.

You also mentioned that the pipeline will try to restart the linux shell runner service. Are you stopping the Linux Shell runner while the pipeline is running?

Kind regards,  
Theodora


author: ronwaldo_querol
body: [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086) - thank you for pointing out that I'm trying to restart the Linux Shell runner while the pipeline is running.  

All good. I tweak the script to restart the service after a period of time ensuring the pipeline build is completed before restarting the shell runner.


author: Theodora Boudale
body: You are very welcome [@ronwaldo_querol](/t5/user/viewprofilepage/user-id/5423717), and thank you for the update. It's good to hear that the issue is resolved now!


Tags: bitbucket-cloud

bitbucket-pipelines

cloud