1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00
sap-jenkins-library/vars/abapEnvironmentPipeline.groovy
Daniel Mieg ebac0da332
Add create tag to abapEnvironmentPipeline (#3870)
* Add alias

* Add step and defaults

* Add closing }

* Add test

* Remove alias

* initial copy

* Change step activation

* Change test

* Read foreign config

* Fix Syntax

* Test

* Test

* Only consider stage config

* Test config

* Test

* Test

* Change echo

* Fix

* Test

* Default test

* Uncomment

* Test different outputs

* Adapt Config

Co-authored-by: tiloKo <70266685+tiloKo@users.noreply.github.com>
2022-10-12 10:20:13 +02:00

94 lines
3.8 KiB
Groovy

void call(parameters) {
pipeline {
agent none
options {
skipDefaultCheckout()
}
stages {
stage('Init') {
steps {
abapEnvironmentPipelineStageInit script: parameters.script, customDefaults: ['com.sap.piper/pipeline/abapEnvironmentPipelineDefaults.yml'].plus(parameters.customDefaults ?: [])
}
}
stage('Initial Checks') {
when {expression {return parameters.script.commonPipelineEnvironment.configuration.runStage?.get("Build")}}
steps {
abapEnvironmentPipelineStageInitialChecks script: parameters.script
}
}
stage('Prepare System') {
when {expression {return parameters.script.commonPipelineEnvironment.configuration.runStage?.get(env.STAGE_NAME)}}
steps {
abapEnvironmentPipelineStagePrepareSystem script: parameters.script
}
}
stage('Clone Repositories') {
when {expression {return parameters.script.commonPipelineEnvironment.configuration.runStage?.get(env.STAGE_NAME)}}
steps {
abapEnvironmentPipelineStageCloneRepositories script: parameters.script
}
}
stage('Test') {
parallel {
stage('ATC') {
when {expression {return parameters.script.commonPipelineEnvironment.configuration.runStage?.get(env.STAGE_NAME)}}
steps {
abapEnvironmentPipelineStageATC script: parameters.script
}
}
stage('AUnit') {
when {expression {return parameters.script.commonPipelineEnvironment.configuration.runStage?.get(env.STAGE_NAME)}}
steps {
abapEnvironmentPipelineStageAUnit script: parameters.script
}
}
}
}
stage('Build') {
when {expression {return parameters.script.commonPipelineEnvironment.configuration.runStage?.get(env.STAGE_NAME)}}
steps {
abapEnvironmentPipelineStageBuild script: parameters.script
}
}
stage('Integration Tests') {
when {expression {return parameters.script.commonPipelineEnvironment.configuration.runStage?.get(env.STAGE_NAME)}}
steps {
abapEnvironmentPipelineStageIntegrationTests script: parameters.script
}
}
stage('Confirm') {
when {expression {return parameters.script.commonPipelineEnvironment.configuration.runStage?.get("Publish")}}
steps {
abapEnvironmentPipelineStageConfirm script: parameters.script
}
}
stage('Publish') {
when {expression {return parameters.script.commonPipelineEnvironment.configuration.runStage?.get(env.STAGE_NAME)}}
steps {
abapEnvironmentPipelineStagePublish script: parameters.script
}
}
}
post {
/* https://jenkins.io/doc/book/pipeline/syntax/#post */
success {buildSetResult(currentBuild)}
aborted {buildSetResult(currentBuild, 'ABORTED')}
failure {buildSetResult(currentBuild, 'FAILURE')}
unstable {buildSetResult(currentBuild, 'UNSTABLE')}
cleanup {
abapEnvironmentPipelineStagePost script: parameters.script
}
}
}
}