2019-06-04 08:01:43 +02:00
|
|
|
import static com.sap.piper.Prerequisites.checkScript
|
|
|
|
import com.sap.piper.ConfigurationHelper
|
2020-11-16 16:14:54 +02:00
|
|
|
import com.sap.piper.JenkinsUtils
|
2019-06-04 08:01:43 +02:00
|
|
|
import com.sap.piper.Utils
|
|
|
|
import groovy.transform.Field
|
|
|
|
|
2021-10-11 10:08:20 +02:00
|
|
|
@Field String STEP_NAME = getClass().getName()
|
2021-11-15 15:20:20 +02:00
|
|
|
@Field String METADATA_FILE = 'metadata/hadolintExecute.yaml'
|
2020-11-16 16:14:54 +02:00
|
|
|
|
|
|
|
@Field Set GENERAL_CONFIG_KEYS = []
|
2019-06-04 08:01:43 +02:00
|
|
|
@Field Set STEP_CONFIG_KEYS = GENERAL_CONFIG_KEYS.plus([
|
|
|
|
'qualityGates',
|
2020-02-04 17:36:09 +02:00
|
|
|
'reportFile',
|
|
|
|
'reportName'
|
2019-06-04 08:01:43 +02:00
|
|
|
])
|
|
|
|
@Field Set PARAMETER_KEYS = STEP_CONFIG_KEYS
|
2021-10-11 10:08:20 +02:00
|
|
|
|
2019-06-04 08:01:43 +02:00
|
|
|
void call(Map parameters = [:]) {
|
2020-11-16 16:14:54 +02:00
|
|
|
final script = checkScript(this, parameters) ?: null
|
|
|
|
List credentialInfo = [
|
|
|
|
[type: 'usernamePassword', id: 'configurationCredentialsId', env: ['PIPER_configurationUsername', 'PIPER_configurationPassword']],
|
|
|
|
]
|
2019-06-04 08:01:43 +02:00
|
|
|
|
2020-11-16 16:14:54 +02:00
|
|
|
issuesWrapper(parameters, script){
|
|
|
|
piperExecuteBin(parameters, STEP_NAME, METADATA_FILE, credentialInfo)
|
|
|
|
}
|
|
|
|
}
|
2019-06-04 08:01:43 +02:00
|
|
|
|
2020-11-16 16:14:54 +02:00
|
|
|
def issuesWrapper(Map parameters = [:], Script script, Closure body){
|
|
|
|
String stageName = parameters.stageName ?: env.STAGE_NAME
|
|
|
|
// load default & individual configuration
|
|
|
|
Map config = ConfigurationHelper.newInstance(this)
|
|
|
|
.loadStepDefaults([:], stageName)
|
|
|
|
.mixinGeneralConfig(script.commonPipelineEnvironment, GENERAL_CONFIG_KEYS)
|
|
|
|
.mixinStepConfig(script.commonPipelineEnvironment, STEP_CONFIG_KEYS)
|
|
|
|
.mixinStageConfig(script.commonPipelineEnvironment, stageName, STEP_CONFIG_KEYS)
|
|
|
|
.mixin(parameters, PARAMETER_KEYS)
|
|
|
|
.use()
|
2019-06-04 08:01:43 +02:00
|
|
|
|
2020-11-16 16:14:54 +02:00
|
|
|
try {
|
|
|
|
body()
|
|
|
|
} finally {
|
|
|
|
recordIssues(
|
|
|
|
blameDisabled: true,
|
|
|
|
enabledForFailure: true,
|
|
|
|
aggregatingResults: false,
|
|
|
|
qualityGates: config.qualityGates,
|
|
|
|
tool: checkStyle(
|
|
|
|
id: config.reportName,
|
|
|
|
name: config.reportName,
|
|
|
|
pattern: config.reportFile
|
2019-06-04 08:01:43 +02:00
|
|
|
)
|
2020-11-16 16:14:54 +02:00
|
|
|
)
|
2019-06-04 08:01:43 +02:00
|
|
|
}
|
|
|
|
}
|