I would like to know how to continue with a build only when a file contains specific text?
I want the build to fail if the text is incorrect, otherwise continue with build.
I would like to know how to continue with a build only when a file contains specific text?
I want the build to fail if the text is incorrect, otherwise continue with build.
update your script to return a nonzero exit status when the file doesn't contain the text. run your shell script via an sh
step like this:
sh '/path/to/your/script_that_checks_another_file_for_certain_text.sh'
full pipeline:
pipeline {
agent { label 'docker' }
stages {
stage('build') {
steps {
sh '/path/to/your/script_that_checks_another_file_for_certain_text.sh'
echo 'this will not happen if the above script returns a bad exit status'
}
}
}
}