1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2024-12-12 10:55:20 +02:00

No need for manipulating origin url

the gitSshUrl can be provided directly to the push call. This avoids footprint on the build
servers git repository.
This commit is contained in:
Marcus Holl 2018-08-15 12:06:24 +02:00
parent 6c6f106f26
commit 044e940dec
2 changed files with 3 additions and 5 deletions

View File

@ -79,9 +79,8 @@ class ArtifactSetVersionTest extends BasePiperTest {
assertThat(jscr.shell, hasItem("mvn --file 'pom.xml' --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn versions:set -DnewVersion=1.2.3-20180101010203_testCommitId"))
assertThat(jscr.shell, hasItem('git add .'))
assertThat(jscr.shell, hasItem("git commit -m 'update version 1.2.3-20180101010203_testCommitId'"))
assertThat(jscr.shell, hasItems(containsString('git remote set-url origin myGitSshUrl'),
containsString('git tag build_1.2.3-20180101010203_testCommitId'),
containsString('git push origin build_1.2.3-20180101010203_testCommitId')))
assertThat(jscr.shell, hasItems(containsString('git tag build_1.2.3-20180101010203_testCommitId'),
containsString('git push myGitSshUrl build_1.2.3-20180101010203_testCommitId')))
}
@Test

View File

@ -97,9 +97,8 @@ def call(Map parameters = [:], Closure body = null) {
error "[${STEP_NAME}]git commit failed: ${e}"
}
sh """#!/bin/bash
git remote set-url origin ${config.gitSshUrl}
git tag ${config.tagPrefix}${newVersion}
git push origin ${config.tagPrefix}${newVersion}"""
git push ${config.gitSshUrl} ${config.tagPrefix}${newVersion}"""
config.gitCommitId = gitUtils.getGitCommitIdOrNull()
}