1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-03-03 15:02:35 +02:00

[refactoring] Reduce number of sh calls

This commit is contained in:
Marcus Holl 2018-09-27 16:15:49 +02:00
parent ced73231fa
commit 01b03f0df3
2 changed files with 3 additions and 4 deletions

View File

@ -89,8 +89,8 @@ class ArtifactSetVersionTest extends BasePiperTest {
assertEquals('testCommitId', jer.env.getGitCommitId())
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 -DgenerateBackupPoms=false"))
assertThat(jscr.shell, hasItem('git add .'))
assertThat(jscr.shell, hasItems(containsString("git commit -m 'update version 1.2.3-20180101010203_testCommitId'"),
assertThat(jscr.shell, hasItems(containsString("git add ."),
containsString("git commit -m 'update version 1.2.3-20180101010203_testCommitId'"),
containsString('git tag build_1.2.3-20180101010203_testCommitId'),
containsString('git push myGitSshUrl build_1.2.3-20180101010203_testCommitId')))
}

View File

@ -84,8 +84,6 @@ def call(Map parameters = [:], Closure body = null) {
.withMandatoryProperty('gitSshUrl')
.use()
sh 'git add .'
def gitConfig = []
if(config.gitUserEMail) gitConfig.add("-c user.email=\"${config.gitUserEMail}\"")
@ -94,6 +92,7 @@ def call(Map parameters = [:], Closure body = null) {
try {
sh """#!/bin/bash
git add .
git ${gitConfig} commit -m 'update version ${newVersion}'
git tag ${config.tagPrefix}${newVersion}"""
config.gitCommitId = gitUtils.getGitCommitIdOrNull()