mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-03-03 15:02:35 +02:00
nexusUpload: Remove config processing from Groovy layer (#1364)
This commit is contained in:
parent
9372aa1f43
commit
ded6152b56
@ -58,7 +58,6 @@ public class CommonStepsTest extends BasePiperTest{
|
||||
'prepareDefaultValues',
|
||||
'setupCommonPipelineEnvironment',
|
||||
'buildSetResult',
|
||||
'nexusUpload',
|
||||
'mavenBuild',
|
||||
'mavenExecuteStaticCodeChecks',
|
||||
'cloudFoundryCreateServiceKey'
|
||||
|
@ -1,6 +1,7 @@
|
||||
import com.sap.piper.DownloadCacheUtils
|
||||
import groovy.transform.Field
|
||||
|
||||
import static com.sap.piper.Prerequisites.checkScript
|
||||
import static groovy.json.JsonOutput.toJson
|
||||
|
||||
@Field String STEP_NAME = getClass().getName()
|
||||
@ -9,13 +10,8 @@ import static groovy.json.JsonOutput.toJson
|
||||
//Metadata maintained in file project://resources/metadata/nexusUpload.yaml
|
||||
|
||||
void call(Map parameters = [:]) {
|
||||
// Replace 'additionalClassifiers' List with JSON encoded String.
|
||||
// This is currently necessary, since the go code doesn't support complex/arbitrary parameter types.
|
||||
// TODO: Support complex/structured types of parameters in piper-go
|
||||
if (parameters.additionalClassifiers) {
|
||||
parameters.additionalClassifiers = "${toJson(parameters.additionalClassifiers as List)}"
|
||||
}
|
||||
parameters = DownloadCacheUtils.injectDownloadCacheInMavenParameters(parameters.script, parameters)
|
||||
final script = checkScript(this, parameters) ?: this
|
||||
parameters = DownloadCacheUtils.injectDownloadCacheInMavenParameters(script, parameters)
|
||||
|
||||
List credentials = [[type: 'usernamePassword', id: 'nexusCredentialsId', env: ['PIPER_username', 'PIPER_password']]]
|
||||
piperExecuteBin(parameters, STEP_NAME, METADATA_FILE, credentials)
|
||||
|
@ -1,4 +1,3 @@
|
||||
import com.sap.piper.ConfigurationHelper
|
||||
import com.sap.piper.GenerateStageDocumentation
|
||||
import com.sap.piper.ReportAggregator
|
||||
import groovy.transform.Field
|
||||
@ -9,10 +8,7 @@ import static com.sap.piper.Prerequisites.checkScript
|
||||
|
||||
@Field Set GENERAL_CONFIG_KEYS = []
|
||||
@Field Set STAGE_STEP_KEYS = []
|
||||
@Field Set STAGE_CONFIG_KEYS = STAGE_STEP_KEYS.plus([
|
||||
/** Parameters for deployment to a Nexus Repository Manager. */
|
||||
'nexus'
|
||||
])
|
||||
@Field Set STAGE_CONFIG_KEYS = STAGE_STEP_KEYS
|
||||
@Field Set PARAMETER_KEYS = STAGE_CONFIG_KEYS
|
||||
|
||||
/**
|
||||
@ -23,14 +19,6 @@ void call(Map parameters = [:]) {
|
||||
String stageName = 'artifactDeployment'
|
||||
final script = checkScript(this, parameters) ?: this
|
||||
|
||||
Map config = ConfigurationHelper.newInstance(this)
|
||||
.loadStepDefaults()
|
||||
.mixinGeneralConfig(script.commonPipelineEnvironment, GENERAL_CONFIG_KEYS)
|
||||
.mixinStageConfig(script.commonPipelineEnvironment, stageName, STAGE_CONFIG_KEYS)
|
||||
.mixin(parameters, PARAMETER_KEYS)
|
||||
.withMandatoryProperty('nexus')
|
||||
.use()
|
||||
|
||||
piperStageWrapper(stageName: stageName, script: script) {
|
||||
|
||||
def commonPipelineEnvironment = script.commonPipelineEnvironment
|
||||
@ -41,21 +29,8 @@ void call(Map parameters = [:]) {
|
||||
commonPipelineEnvironment.setValue('unstableSteps', unstableSteps)
|
||||
}
|
||||
|
||||
Map nexusConfig = config.nexus as Map
|
||||
|
||||
// Pull additionalClassifiers param from resolved config here for legacy compatibility.
|
||||
// The parameter will become obsolete soon.
|
||||
Map nexusUploadParams = [
|
||||
script: script,
|
||||
additionalClassifiers: nexusConfig.additionalClassifiers,
|
||||
]
|
||||
|
||||
if (nexusConfig.credentialsId) {
|
||||
nexusUploadParams.nexusCredentialsId = nexusConfig.credentialsId
|
||||
}
|
||||
|
||||
withEnv(["STAGE_NAME=${stageName}"]) {
|
||||
nexusUpload(nexusUploadParams)
|
||||
nexusUpload(script: script)
|
||||
}
|
||||
|
||||
ReportAggregator.instance.reportDeploymentToNexus()
|
||||
|
Loading…
x
Reference in New Issue
Block a user