Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Commit

Permalink
JENKINS-45738 Added example of declarative pipeline using task steps …
Browse files Browse the repository at this point in the history
…with closures
  • Loading branch information
tommysdk committed Dec 13, 2017
1 parent 4726fe7 commit db371a3
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions examples/JENKINS-45738-declarative-pipeline-with-task-closures.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
pipeline {
agent any
options {
ansiColor('xterm')
buildDiscarder(logRotator(numToKeepStr: '20'))
timeout(time: 30, unit: 'MINUTES')
timestamps()
}
stages {
stage('Commit stage') {
steps {
task('Compile and package') {
echo 'Building...'
sleep 2
echo 'Successfully built project!'
}

task('Upload artifacts') {
sleep 3
echo 'Successfully uploaded artifacts!'
}
}
}
stage('Test stage') {
steps {
task('Run component tests') {
echo 'Running tests...'
sleep 4
echo 'Component tests finished!'
}

task('Run integration tests') {
sleep 5
echo 'Integration tests finished
}
}
}
stage('Deploy') {
steps {
task('Deploy to UAT') {
echo 'Deploying to UAT...'
sleep 4
echo 'Successfully deployed to UAT'
}

task('Deploy to production') {
echo 'Deploying to production...'
sleep 4
echo 'Deployed to production!'
}
}
}
}
}

0 comments on commit db371a3

Please sign in to comment.