From 8ea6b43a73837cedd2aeb1320ee4b9432c8c36f9 Mon Sep 17 00:00:00 2001 From: cclecle Date: Sun, 19 Mar 2023 20:50:50 +0000 Subject: [PATCH] fix: git remote credentials --- Jenkinsfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index fb306e7..0b6865f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -135,9 +135,7 @@ pipeline { sh("git config --global user.email $_MaintainerEmail") sh("git config --global user.name $_MaintainerName") - withCredentials([usernamePassword(credentialsId: _SCMCredentials, passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) { - sh("git remote set-url origin https://${GIT_USERNAME}:${GIT_PASSWORD}@chacha.ddns.net/gitea/${_PROJECT_USER_NAME}/${_PROJECT_NAME}.git") - } + } } @@ -151,6 +149,11 @@ pipeline { extensions: [[$class: "CloneOption", noTags: false, shallow: false, depth: 0, reference: '']], userRemoteConfigs: [[credentialsId: _SCMCredentials, url: GIT_URL]]]) script{ + + withCredentials([usernamePassword(credentialsId: _SCMCredentials, passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) { + sh("git remote set-url origin https://${GIT_USERNAME}:${GIT_PASSWORD}@chacha.ddns.net/gitea/${_PROJECT_USER_NAME}/${_PROJECT_NAME}.git") + } + // using git to get the latest tag on this branch (before processing) def latestTag_beforeProcessing = sh(returnStdout: true, script: "git tag --sort=-creatordate | head -n 1").trim() echo("latestTag_beforeProcessing:. . . . . . . . . . . . $latestTag ")