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 gitEmail = params.gitEmail ? params.gitEmail : 'jenkins@cadoles.com'
|
||||
def gitUsername = params.gitUsername ? params.gitUsername : 'Jenkins'
|
||||
def skipCi = params.skipCi ? params.skipCi : false
|
||||
def skipPush = params.skipPush ? params.skipPush: true
|
||||
def skipCi = params.containsKey('skipCi') ? params.skipCi : false
|
||||
def skipPush = params.containsKey('skipPush') ? params.skipPush: true
|
||||
|
||||
// Define dist branch based on provided informations and base branch name
|
||||
def distBranch = "dist/${dist}/${distVersion}/${distBranchName}"
|
||||
@ -84,36 +84,8 @@ def call(Map params = [:]) {
|
||||
}
|
||||
|
||||
if (gitCredentials != null) {
|
||||
withCredentials([
|
||||
usernamePassword(
|
||||
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}'")
|
||||
}
|
||||
|
||||
git.withHTTPCredentials(gitCredentials) {
|
||||
proc.call()
|
||||
}
|
||||
} else {
|
||||
proc.call()
|
||||
|
Loading…
Reference in New Issue
Block a user