1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00
sap-jenkins-library/vars/piperPipeline.groovy
Oliver Nocon 74366631b5
Project "Piper" Template: framework and structure (#476)
* Project "Piper" Template: framework and structure

This is the first in a series of Pull-Requests to provide a fully functional Pipeline template into the library.

This PR contains:
* general Pipeline structure incl. tests
* Pipeline initialization incl. tests
* Hollow pipeline stages incl. tests
* first set of default values
* add gitUrls to commonPipelineEnvironment
* set correct git information on commonPipelineEnvironment
2019-02-05 15:37:59 +01:00

91 lines
4.7 KiB
Groovy

void call(parameters) {
pipeline {
agent none
options {
skipDefaultCheckout()
timestamps()
}
stages {
stage('Init') {
steps {
library 'piper-lib-os'
piperPipelineStageInit script: parameters.script, customDefaults: parameters.customDefaults
}
}
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
when {allOf {branch parameters.script.commonPipelineEnvironment.getStepConfiguration('', '').productiveBranch; expression {return parameters.script.commonPipelineEnvironment.getStepConfiguration('piperInitRunStageConfiguration', env.STAGE_NAME).manualConfirmation}}}
steps {
input message: 'Shall we proceed to promotion & release?'
}
}
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 {
always {
influxWriteData script: parameters.script, wrapInNode: true
mailSendNotification script: parameters.script, wrapInNode: true
}
}
}
}