when i run pipeline i used atlassian ssh run and i made deploy.sh file but in deploy.sh i start the pm2 if it gets fails i exit the code but still my pipeline does not failed it keep running how to failed it
G'day, @Nikhil Singh
Welcome to the community!
If I understand correctly, you are deploying your application using the ssh-run pipe and a Bash script. However, when the script attempts to start pm2 and fails, your build continues to run instead of stopping. If this is the case, you may need to explicitly specify an exit command in your script. This will ensure that the script exits with a non-zero exit code when an error occurs, causing the build to fail as expected.
ssh-run
pm2
Here's an example
#!/bin/bash<br> # Start the application with pm2 pm2 start app.js<br> # Check if the previous command was successful if [ $? -ne 0 ]; then echo "Failed to start the application with pm2." exit 1 # Exit with a non-zero status to indicate failure fi<br> echo "Application started successfully."
I hope this helps.
Regards,Syahrul
It looks like you're new here. Sign in or register to get started.