Compare commits

...

4 Commits

Author SHA1 Message Date
Denes Matetelki f26b3f5a30 try block instead of a post
jenkinsfiles_play/master There was a failure building this commit Details
jenkinsfiles_play/scripted_branch There was a failure building this commit Details
giteee/jenkinsfile_play/master There was a failure building this commit Details
6 years ago
Denes Matetelki d89cb33df3 scripted post action
jenkinsfiles_play/master There was a failure building this commit Details
6 years ago
Denes Matetelki d4d75c3ca8 try2
jenkinsfiles_play/master This commit looks good Details
6 years ago
Denes Matetelki 50e2d5d7e7 simplify even more
jenkinsfiles_play/master There was a failure building this commit Details
6 years ago

46
Jenkinsfile vendored

@ -1,15 +1,45 @@
#!/usr/bin/env groovy #!/usr/bin/env groovy
properties( properties([
[ parameters([
string(name: 'Name', defaultValue: 'denes'), booleanParam(defaultValue: false, description: 'dog', name: 'cat'),
string(name: 'Age', defaultValue: '34') string(defaultValue: 'lisa', description: 'uninteresting', name: 'name', trim: false)
] ])
) ])
node('master') { node('master') {
stage('Print params') { stage('Print params') {
sh "echo "${params.Name}" echo "flag: ${params.cat}"
sh "echo "${params.Age}" echo "flag: ${params.name}"
}
try {
stage('Test') {
sh 'echo "Fail!"; exit 1'
}
echo 'This will run only if successful'
} catch (e) {
echo 'This will run only if failed'
// Since we're catching the exception in order to report on it,
// we need to re-throw it, to ensure that the build is marked as failed
throw e
} finally {
def currentResult = currentBuild.result ?: 'SUCCESS'
if (currentResult == 'UNSTABLE') {
echo 'This will run only if the run was marked as unstable'
}
def previousResult = currentBuild.previousBuild?.result
if (previousResult != null && previousResult != currentResult) {
echo 'This will run only if the state of the Pipeline has changed'
echo 'For example, if the Pipeline was previously failing but is now successful'
} }
echo 'This will always run'
}
} }

Loading…
Cancel
Save