| I am encountering simliar issues. I am executing some bash kung-fu on the target server and if this fails, i would like to exit the "step"/plugin with a RC != 0. The pipeline does not respect that the step has failed and continues the pipeline, so that the following step fails.
[Pipeline] step
SSH: Connecting from host [53d1c1e2cbf8]
SSH: Connecting with configuration [swpsws47] ...
SSH: EXEC: STDOUT/STDERR from command [
if [ -d /export/yyy/install/xxxmx-soapui/ ]; then
cd /export/yyy/install/xxxmx-soapui/
rm -fv /export/yyy/install/soapui.tar.gz
tar -zcf ../soapui.tar.gz ./*
else
echo "This build does not contain SoapUI tests to execute. Please update your branch!"
exit 9
fi ] ...
This build does not contain SoapUI tests to execute. Please update your branch!
SSH: EXEC: completed after 201 ms
SSH: Disconnecting configuration [swpsws47] ...
ERROR: Exception when publishing, exception message [Exec exit status not zero. Status [9]]
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Download Tests)
[Pipeline] sh
[xxx-smoketest-swpsws47] Running shell script
+ wget -q http://swpsws47/yyy/install/soapui.tar.gz
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Verify Server Ready)
Stage "Verify Server Ready" skipped due to earlier failure(s)
The pipeline looks like
pipeline {
agent any
stages {
stage('Prepare Tests') {
steps {
cleanWs notFailBuild: true
sshPublisher(publishers: [sshPublisherDesc(configName: "$ServerName", transfers: [sshTransfer(excludes: '', execCommand: '''
if [ -d /export/yyy/install/xxxmx-soapui/ ]; then
cd /export/yyy/install/xxxmx-soapui/
rm -fv /export/yyy/install/soapui.tar.gz
tar -zcf ../soapui.tar.gz ./*
else
echo "This build does not contain have SoapUI tests to execute. Please update your branch!"
exit 9
fi ''', execTimeout: 18000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '', remoteDirectorySDF: false, removePrefix: '', sourceFiles: '')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
}
}
stage('Download Tests') {
steps {
sh 'wget -q http://$ServerName/yyy/install/soapui.tar.gz'
sh 'tar -xzf soapui.tar.gz --directory .'
}
}
stage('Verify Server Ready') {
...
}
}
}
|