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

     1  package com.sap.piper
     2  
     3  class StepAssertions {
     4      def static assertFileIsConfiguredAndExists(Script step, Map configuration, String configurationKey) {
     5          ConfigurationHelper.newInstance(step, configuration).withMandatoryProperty(configurationKey)
     6          assertFileExists(step, configuration[configurationKey])
     7      }
     8  
     9      def static  assertFileExists(Script step, String filePath) {
    10          if (!step.fileExists(filePath)) {
    11              step.error("File ${filePath} cannot be found.")
    12          }
    13      }
    14  }