I use windows based runner and sometimes my build system fails with exit code 2 or 3 that's not entirely a failure but warnings.
1. I would like to see them in bitbucket pipeline logs which I tried with after-script echo but doesn't work
2. Is there a way to tell pipeline fail a step only for exit code 1 and don't fail for other codes?
Thanks,
Ajay
G'day, @Ajay
Have you tried adding the echo command to show the exit code at the end of your script, for example:
- Running a command; echo "Exit code: $?"
Regards,
syahrul
Hi @Ajay
If that's the case, maybe run your steps in a bash script for example:
#!/bin/bash
# Run your command
your_command_here
# Capture the exit code
EXIT_CODE=$?
# Check the exit code and decide whether to exit with an error
if [ $EXIT_CODE -eq 1 ]; then
echo "Command failed with exit code 1, failing the step."
exit 1
else
echo "Command completed with exit code $EXIT_CODE, but not failing the step."
exit 0
fi
This will check for exit code, and if the exit code is 1, it will failed the steps, otherwise it'll return complete steps.
Regards,
Syahrul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.