Fix cpkg skipCi/skipPush options handling
This commit is contained in:
parent
7ac2319ae1
commit
22047c685a
|
@ -10,8 +10,8 @@ def call(Map params = [:]) {
|
||||||
def gitCredentials = params.gitCredentials ? params.gitCredentials : null
|
def gitCredentials = params.gitCredentials ? params.gitCredentials : null
|
||||||
def gitEmail = params.gitEmail ? params.gitEmail : 'jenkins@cadoles.com'
|
def gitEmail = params.gitEmail ? params.gitEmail : 'jenkins@cadoles.com'
|
||||||
def gitUsername = params.gitUsername ? params.gitUsername : 'Jenkins'
|
def gitUsername = params.gitUsername ? params.gitUsername : 'Jenkins'
|
||||||
def skipCi = params.skipCi ? params.skipCi : false
|
def skipCi = params.containsKey('skipCi') ? params.skipCi : false
|
||||||
def skipPush = params.skipPush ? params.skipPush: true
|
def skipPush = params.containsKey('skipPush') ? params.skipPush: true
|
||||||
|
|
||||||
// Define dist branch based on provided informations and base branch name
|
// Define dist branch based on provided informations and base branch name
|
||||||
def distBranch = "dist/${dist}/${distVersion}/${distBranchName}"
|
def distBranch = "dist/${dist}/${distVersion}/${distBranchName}"
|
||||||
|
@ -84,36 +84,8 @@ def call(Map params = [:]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gitCredentials != null) {
|
if (gitCredentials != null) {
|
||||||
withCredentials([
|
git.withHTTPCredentials(gitCredentials) {
|
||||||
usernamePassword(
|
proc.call()
|
||||||
credentialsId: gitCredentials,
|
|
||||||
usernameVariable: 'GIT_USERNAME',
|
|
||||||
passwordVariable: 'GIT_PASSWORD'
|
|
||||||
)
|
|
||||||
]) {
|
|
||||||
def randomUUID = UUID.randomUUID().toString()
|
|
||||||
def tmpAskPassScript = pwd(tmp:true) + "/${randomUUID}"
|
|
||||||
try {
|
|
||||||
writeFile(
|
|
||||||
file: tmpAskPassScript,
|
|
||||||
text: '''
|
|
||||||
#!/bin/sh
|
|
||||||
case "$1" in
|
|
||||||
Username*) echo $GIT_USERNAME ;;
|
|
||||||
Password*) echo $GIT_PASSWORD ;;
|
|
||||||
esac
|
|
||||||
'''
|
|
||||||
)
|
|
||||||
sh(script: "git config user.email '${gitEmail}'")
|
|
||||||
sh(script: "git config user.name '${gitUsername}'")
|
|
||||||
sh(script: "chmod +x '${tmpAskPassScript}'")
|
|
||||||
withEnv(["GIT_ASKPASS=${tmpAskPassScript}"]) {
|
|
||||||
proc.call()
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
sh(script: "rm -f '${tmpAskPassScript}'")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
proc.call()
|
proc.call()
|
||||||
|
|
Loading…
Reference in New Issue