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

     1  package com.sap.piper
     2  
     3  import static java.lang.Boolean.getBoolean
     4  
     5  static checkScript(def step, Map params) {
     6  
     7      def script = params?.script
     8  
     9      if(script == null) {
    10  
    11          if(getBoolean('com.sap.piper.featureFlag.failOnMissingScript')) {
    12              step.error("[ERROR][${step.STEP_NAME}] No reference to surrounding script provided with key 'script', e.g. 'script: this'.")
    13          }
    14  
    15          step.currentBuild.setResult('UNSTABLE')
    16  
    17          step.echo "[WARNING][${step.STEP_NAME}] No reference to surrounding script provided with key 'script', e.g. 'script: this'. " +
    18                      "Build status has been set to 'UNSTABLE'. In future versions of piper-lib the build will fail."
    19      }
    20  
    21      return script
    22  }