-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
Jenkins 2.89.1 on CentOS 7
Pipeline fails script when SUB-shell returns non 0 exit code, main shell works fine and returns 0.
Steps to reproduce:
very simple pipeline
node('sddc-controller') {
stage('Setup foundation') {
sh """
source ~/test.sh
"""
}
}
test.sh
AA="aaaaaaa"
R="$(echo $AA | tr '[:upper:]' '[:lower:]' | grep 'bb')"
#export R="$(echo $AA | tr '[:upper:]' '[:lower:]' | grep 'bb')"
echo "R=$R"
this fails,
if 'export R' line is used then script gets executed fine;
if AA to contain 'bb' then script works tool.
Expected behavior: should be the same as bash, do not fail R= assignment when grep returns non 0 exit code,