|
|
|
@ -0,0 +1,39 @@ |
|
|
|
# Learning Jenkins, 05-01: Pipeline as Code |
|
|
|
Create a pipeline job. |
|
|
|
|
|
|
|
Paste the following code in the pipeline definition: |
|
|
|
``` |
|
|
|
pipeline { |
|
|
|
agent any |
|
|
|
options { |
|
|
|
buildDiscarder(logRotator(daysToKeepStr: '10', numToKeepStr: '10')) |
|
|
|
timeout(time: 12, unit: 'HOURS') |
|
|
|
timestamps() |
|
|
|
} |
|
|
|
triggers { |
|
|
|
cron '@midnight' |
|
|
|
} |
|
|
|
stages { |
|
|
|
stage('Initialize') { |
|
|
|
steps { |
|
|
|
echo 'Initializing..' |
|
|
|
} |
|
|
|
} |
|
|
|
stage('Build') { |
|
|
|
steps { |
|
|
|
echo 'Building..' |
|
|
|
} |
|
|
|
} |
|
|
|
stage('Test') { |
|
|
|
steps { |
|
|
|
echo 'Testing..' |
|
|
|
} |
|
|
|
} |
|
|
|
stage('Report') { |
|
|
|
steps { |
|
|
|
echo 'Reporting....' |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
``` |