This repository has been archived by the owner on Sep 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JENKINS-45738 Added example of declarative pipeline using task steps …
…with closures
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
examples/JENKINS-45738-declarative-pipeline-with-task-closures.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!' | ||
} | ||
} | ||
} | ||
} | ||
} |