github.com/ouraigua/jenkins-library@v0.0.0-20231028010029-fbeaf2f3aa9b/src/com/sap/piper/DeploymentType.groovy (about)

     1  package com.sap.piper
     2  
     3  enum DeploymentType {
     4  
     5      NEO_ROLLING_UPDATE('rolling-update'), CF_BLUE_GREEN('blue-green'), CF_STANDARD('standard'), NEO_DEPLOY('deploy')
     6  
     7      private String value
     8  
     9      public DeploymentType(String value){
    10          this.value = value
    11      }
    12  
    13      @Override
    14      public String toString(){
    15          return value
    16      }
    17  
    18      static DeploymentType selectFor(CloudPlatform cloudPlatform, boolean enableZeroDowntimeDeployment) {
    19  
    20          switch (cloudPlatform) {
    21  
    22              case CloudPlatform.NEO:
    23                  if (enableZeroDowntimeDeployment) return NEO_ROLLING_UPDATE
    24                  return NEO_DEPLOY
    25  
    26              case CloudPlatform.CLOUD_FOUNDRY:
    27                  if (enableZeroDowntimeDeployment) return CF_BLUE_GREEN
    28                  return CF_STANDARD
    29  
    30              default:
    31                  throw new RuntimeException("Unknown cloud platform: ${cloudPlatform}")
    32          }
    33      }
    34  }