mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-03-03 15:02:35 +02:00
Always use artifactPrepareVersion (#2360)
artifactSetVersion was documented as being "deprecated" since a while, but was still used.
This commit is contained in:
parent
81c8553d6a
commit
0491bf3712
@ -122,7 +122,7 @@ class PiperPipelineStageInitTest extends BasePiperTest {
|
||||
stashSettings: 'com.sap.piper/pipeline/stashSettings.yml'
|
||||
)
|
||||
|
||||
assertThat(stepsCalled, hasItems('checkout', 'setupCommonPipelineEnvironment', 'piperInitRunStageConfiguration', 'artifactSetVersion', 'pipelineStashFilesBeforeBuild'))
|
||||
assertThat(stepsCalled, hasItems('checkout', 'setupCommonPipelineEnvironment', 'piperInitRunStageConfiguration', 'artifactPrepareVersion', 'pipelineStashFilesBeforeBuild'))
|
||||
assertThat(stepsCalled, not(hasItems('slackSendNotification')))
|
||||
|
||||
}
|
||||
@ -176,7 +176,7 @@ class PiperPipelineStageInitTest extends BasePiperTest {
|
||||
'checkout',
|
||||
'setupCommonPipelineEnvironment',
|
||||
'piperInitRunStageConfiguration',
|
||||
'artifactSetVersion',
|
||||
'artifactPrepareVersion',
|
||||
'slackSendNotification',
|
||||
'pipelineStashFilesBeforeBuild'
|
||||
))
|
||||
@ -211,7 +211,7 @@ class PiperPipelineStageInitTest extends BasePiperTest {
|
||||
'checkout',
|
||||
'setupCommonPipelineEnvironment',
|
||||
'piperInitRunStageConfiguration',
|
||||
'artifactSetVersion',
|
||||
'artifactPrepareVersion',
|
||||
'pipelineStashFilesBeforeBuild'
|
||||
))
|
||||
}
|
||||
|
@ -189,7 +189,6 @@ void call(Map parameters = [:]) {
|
||||
echo "[${STEP_NAME}] GitHub labels could not be retrieved from Pull Request, please make sure that credentials are maintained on multi-branch job."
|
||||
}
|
||||
|
||||
|
||||
setPullRequestStageStepActivation(script, config, prActions)
|
||||
}
|
||||
|
||||
@ -197,15 +196,19 @@ void call(Map parameters = [:]) {
|
||||
if (parameters.script.commonPipelineEnvironment.configuration.runStep?.get('Init')?.slackSendNotification) {
|
||||
slackSendNotification script: script, message: "STARTED: Job <${env.BUILD_URL}|${URLDecoder.decode(env.JOB_NAME, java.nio.charset.StandardCharsets.UTF_8.name())} ${env.BUILD_DISPLAY_NAME}>", color: 'WARNING'
|
||||
}
|
||||
if (config.inferBuildTool && env.ON_K8S) {
|
||||
// We set dockerImage: "" for the K8S case to avoid the execution of artifactPrepareVersion in a K8S Pod.
|
||||
// In addition, a mvn executable is available on the Jenkins instance which can be used directly instead of executing the command in a container.
|
||||
artifactPrepareVersion script: script, buildTool: buildTool, dockerImage: ""
|
||||
} else if (config.inferBuildTool) {
|
||||
artifactPrepareVersion script: script, buildTool: buildTool
|
||||
} else {
|
||||
artifactSetVersion script: script
|
||||
Map prepareVersionParams = [script: script]
|
||||
if (config.inferBuildTool) {
|
||||
prepareVersionParams.buildTool = buildTool
|
||||
}
|
||||
if (env.ON_K8S) {
|
||||
// We force dockerImage: "" for the K8S case to avoid the execution of artifactPrepareVersion in a K8S Pod.
|
||||
// Since artifactPrepareVersion may need the ".git" folder in order to push a tag, it would need to be part of the stashing.
|
||||
// There are however problems with tar-ing this folder, which results in a failure to copy the stash back -- without a failure of the pipeline.
|
||||
// This then also has the effect that any changes made to the build descriptors by the step (updated version) are not visible in the relevant stashes.
|
||||
// In addition, a mvn executable is available on the Jenkins instance which can be used directly instead of executing the command in a container.
|
||||
prepareVersionParams.dockerImage = ""
|
||||
}
|
||||
artifactPrepareVersion prepareVersionParams
|
||||
}
|
||||
pipelineStashFilesBeforeBuild script: script
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user