2019-02-05 16:37:59 +02:00
|
|
|
void call(parameters) {
|
|
|
|
pipeline {
|
|
|
|
agent none
|
2019-07-03 10:13:26 +02:00
|
|
|
triggers {
|
|
|
|
issueCommentTrigger('.*/piper ([a-z]*).*')
|
|
|
|
}
|
2019-02-05 16:37:59 +02:00
|
|
|
options {
|
|
|
|
skipDefaultCheckout()
|
|
|
|
timestamps()
|
|
|
|
}
|
|
|
|
stages {
|
|
|
|
stage('Init') {
|
|
|
|
steps {
|
2019-07-05 16:32:24 +02:00
|
|
|
piperPipelineStageInit script: parameters.script, customDefaults: ['com.sap.piper/pipeline/stageOrdinals.yml'].plus(parameters.customDefaults ?: [])
|
2019-02-05 16:37:59 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Pull-Request Voting') {
|
|
|
|
when { anyOf { branch 'PR-*'; branch parameters.script.commonPipelineEnvironment.getStepConfiguration('piperPipelineStagePRVoting', 'Pull-Request Voting').customVotingBranch } }
|
|
|
|
steps {
|
|
|
|
piperPipelineStagePRVoting script: parameters.script
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Build') {
|
|
|
|
when {branch parameters.script.commonPipelineEnvironment.getStepConfiguration('', '').productiveBranch}
|
|
|
|
steps {
|
|
|
|
piperPipelineStageBuild script: parameters.script
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Additional Unit Tests') {
|
|
|
|
when {allOf {branch parameters.script.commonPipelineEnvironment.getStepConfiguration('', '').productiveBranch; expression {return parameters.script.commonPipelineEnvironment.configuration.runStage?.get(env.STAGE_NAME)}}}
|
|
|
|
steps {
|
|
|
|
piperPipelineStageAdditionalUnitTests script: parameters.script
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Integration') {
|
|
|
|
when {allOf {branch parameters.script.commonPipelineEnvironment.getStepConfiguration('', '').productiveBranch; expression {return parameters.script.commonPipelineEnvironment.configuration.runStage?.get(env.STAGE_NAME)}}}
|
|
|
|
steps {
|
|
|
|
piperPipelineStageIntegration script: parameters.script
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Acceptance') {
|
|
|
|
when {allOf {branch parameters.script.commonPipelineEnvironment.getStepConfiguration('', '').productiveBranch; expression {return parameters.script.commonPipelineEnvironment.configuration.runStage?.get(env.STAGE_NAME)}}}
|
|
|
|
steps {
|
|
|
|
piperPipelineStageAcceptance script: parameters.script
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Security') {
|
|
|
|
when {allOf {branch parameters.script.commonPipelineEnvironment.getStepConfiguration('', '').productiveBranch; expression {return parameters.script.commonPipelineEnvironment.configuration.runStage?.get(env.STAGE_NAME)}}}
|
|
|
|
steps {
|
|
|
|
piperPipelineStageSecurity script: parameters.script
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Performance') {
|
|
|
|
when {allOf {branch parameters.script.commonPipelineEnvironment.getStepConfiguration('', '').productiveBranch; expression {return parameters.script.commonPipelineEnvironment.configuration.runStage?.get(env.STAGE_NAME)}}}
|
|
|
|
steps {
|
|
|
|
piperPipelineStagePerformance script: parameters.script
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Compliance') {
|
|
|
|
when {allOf {branch parameters.script.commonPipelineEnvironment.getStepConfiguration('', '').productiveBranch; expression {return parameters.script.commonPipelineEnvironment.configuration.runStage?.get(env.STAGE_NAME)}}}
|
|
|
|
steps {
|
|
|
|
piperPipelineStageCompliance script: parameters.script
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Confirm') {
|
|
|
|
agent none
|
2019-05-22 10:42:59 +02:00
|
|
|
when {allOf {expression { env.BRANCH_NAME ==~ parameters.script.commonPipelineEnvironment.getStepConfiguration('', '').productiveBranch }; anyOf {expression {return (currentBuild.result == 'UNSTABLE')}; expression {return parameters.script.commonPipelineEnvironment.getStepConfiguration('piperInitRunStageConfiguration', env.STAGE_NAME).manualConfirmation}}}}
|
2019-02-05 16:37:59 +02:00
|
|
|
steps {
|
2019-05-22 10:42:59 +02:00
|
|
|
piperPipelineStageConfirm script: parameters.script
|
2019-02-05 16:37:59 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Promote') {
|
|
|
|
when { branch parameters.script.commonPipelineEnvironment.getStepConfiguration('', '').productiveBranch}
|
|
|
|
steps {
|
|
|
|
piperPipelineStagePromote script: parameters.script
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Release') {
|
|
|
|
when {allOf {branch parameters.script.commonPipelineEnvironment.getStepConfiguration('', '').productiveBranch; expression {return parameters.script.commonPipelineEnvironment.configuration.runStage?.get(env.STAGE_NAME)}}}
|
|
|
|
steps {
|
|
|
|
piperPipelineStageRelease script: parameters.script
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
post {
|
2019-04-15 14:18:08 +02:00
|
|
|
/* https://jenkins.io/doc/book/pipeline/syntax/#post */
|
|
|
|
success {buildSetResult(currentBuild)}
|
|
|
|
aborted {buildSetResult(currentBuild, 'ABORTED')}
|
|
|
|
failure {buildSetResult(currentBuild, 'FAILURE')}
|
|
|
|
unstable {buildSetResult(currentBuild, 'UNSTABLE')}
|
|
|
|
cleanup {
|
2019-05-02 12:26:28 +02:00
|
|
|
piperPipelineStagePost script: parameters.script
|
2019-02-05 16:37:59 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|