I run a script in nodejs that trigger by bash that run by Jenkins pipeline.
The problem is the pipeline doesn't stop when the error happens. it should not run "echo git add ."
I add set -e - but seems that not work in this case.
What I can do to stop the execute in bash because error in the npm/node?
In Jenkins:
stage('Deploy') {
sh './scripts/deploy.sh'
}
In deploy.sh:
#!/bin/bash
set -e
npm run prepare-version
echo "git add ."
In package.json:
"scripts": { "prepare-version": "node ./scripts/prepare.js" }
prepare.js:
(async() => {
throw new Error('bug!!!');
})();
