2018-09-21 16:55:31 +02:00
import static com . sap . piper . Prerequisites . checkScript
2018-05-30 12:00:13 +02:00
import com.sap.piper.Utils
import com.sap.piper.ConfigurationHelper
import groovy.transform.Field
2018-11-29 10:54:05 +02:00
@Field String STEP_NAME = getClass ( ) . getName ( )
2019-04-02 13:13:25 +02:00
@Field Set STEP_CONFIG_KEYS = [ 'noDefaultExludes' , 'stashIncludes' , 'stashExcludes' ]
2018-05-30 12:00:13 +02:00
@Field Set PARAMETER_KEYS = STEP_CONFIG_KEYS
2018-08-30 16:33:07 +02:00
void call ( Map parameters = [ : ] ) {
2018-05-30 12:00:13 +02:00
handlePipelineStepErrors ( stepName: STEP_NAME , stepParameters: parameters , stepNameDoc: 'stashFiles' ) {
2019-04-02 13:13:25 +02:00
Utils utils = parameters . juStabUtils
2018-05-30 12:00:13 +02:00
if ( utils = = null ) {
utils = new Utils ( )
}
2018-09-21 16:55:31 +02:00
def script = checkScript ( this , parameters )
2018-05-30 12:00:13 +02:00
if ( script = = null )
2018-10-31 09:40:12 +02:00
script = this
2018-05-30 12:00:13 +02:00
2018-10-17 11:05:20 +02:00
Map config = ConfigurationHelper . newInstance ( this )
2018-09-07 10:08:16 +02:00
. loadStepDefaults ( )
2018-05-30 12:00:13 +02:00
. mixinGeneralConfig ( script . commonPipelineEnvironment , STEP_CONFIG_KEYS )
. mixinStepConfig ( script . commonPipelineEnvironment , STEP_CONFIG_KEYS )
2018-08-15 10:37:34 +02:00
. mixinStageConfig ( script . commonPipelineEnvironment , parameters . stageName ? : env . STAGE_NAME , STEP_CONFIG_KEYS )
2018-05-30 12:00:13 +02:00
. mixin ( parameters , PARAMETER_KEYS )
. use ( )
2019-01-21 09:47:34 +02:00
new Utils ( ) . pushToSWA ( [
step: STEP_NAME ,
stepParamKey1: 'scriptMissing' ,
stepParam1: parameters ? . script = = null
] , config )
2018-08-09 11:35:33 +02:00
2019-04-02 13:13:25 +02:00
config . stashIncludes . each { stashKey , stashIncludes - >
def useDefaultExcludes = ! config . noDefaultExludes . contains ( stashKey )
utils . stashWithMessage ( stashKey , "[${STEP_NAME}] no files detected for stash '${stashKey}': " , stashIncludes , config . stashExcludes [ stashKey ] ? : '' , useDefaultExcludes )
2018-05-30 12:00:13 +02:00
}
}
}