github.com/xgoffin/jenkins-library@v1.154.0/vars/fioriOnCloudPlatformPipeline.groovy (about)

     1  import static com.sap.piper.Prerequisites.checkScript
     2  
     3  import groovy.transform.Field
     4  
     5  @Field def STEP_NAME = getClass().getName()
     6  
     7  @Field def GENERAL_CONFIG_KEYS = []
     8  @Field def PARAMETER_KEYS = []
     9  @Field def STEP_CONFIG_KEYS = []
    10  
    11  /** The Scenario is intended for building and uploading a fiori application.
    12    *
    13    * It needs to be called from a pipeline script (Jenkinsfile) like:
    14    * ```
    15    *   @Library('piper-lib-os') _
    16    *   @Library('your-additional-lib') __ // optional
    17    *
    18    *   // parameter 'customDefaults' below is optional
    19    *   fioriOnCloudPlatformPipeline(script: this, customDefaults: '<configFile>')
    20    * ```
    21    */
    22  void call(parameters = [:]) {
    23  
    24      checkScript(this, parameters)
    25  
    26      node(parameters.label) {
    27  
    28          //
    29          // Cut and paste lines below in order to create a pipeline from this scenario
    30          // In this case `parameters` needs to be replaced by `script: this`.
    31  
    32          stage('prepare') {
    33  
    34              deleteDir()
    35              checkout scm
    36              setupCommonPipelineEnvironment(parameters)
    37          }
    38  
    39          stage('build') {
    40  
    41              mtaBuild(parameters)
    42          }
    43  
    44          stage('deploy') {
    45  
    46              def mtaBuildCfg = parameters.script.commonPipelineEnvironment.getStepConfiguration('mtaBuild', '')
    47  
    48              if((mtaBuildCfg.platform == 'NEO') || (mtaBuildCfg.buildTarget == 'NEO')) {
    49                  neoDeploy(parameters)
    50              }
    51              else if((mtaBuildCfg.platform == 'CF') || (mtaBuildCfg.buildTarget == 'CF')) {
    52                  cloudFoundryDeploy(parameters)
    53              }
    54              else {
    55                  error "Deployment failed: no valid deployment target defined! Find details in https://sap.github.io/jenkins-library/steps/mtaBuild/#platform"
    56              }
    57          }
    58  
    59          // Cut and paste lines above in order to create a pipeline from this scenario
    60          //
    61      }
    62  }