|
|
@@ -10,6 +10,17 @@
|
|
|
* New image is pushed only as uat-latest. Prod promote: SOURCE_TAG=uat-latest.
|
|
|
*/
|
|
|
|
|
|
+/** Normalize GIT_BRANCH: uat-20260202 (not origin/uat-20260202 or refs/heads/...) */
|
|
|
+def normalizeGitBranch(String raw) {
|
|
|
+ def b = (raw ?: 'uat-20260202').trim()
|
|
|
+ if (!b) {
|
|
|
+ return 'uat-20260202'
|
|
|
+ }
|
|
|
+ b = b.replaceFirst('^refs/heads/', '')
|
|
|
+ b = b.replaceFirst('^origin/', '')
|
|
|
+ return b
|
|
|
+}
|
|
|
+
|
|
|
/** HARBOR_PUSH_SCOPE: all-java-services | <repo>-only */
|
|
|
def filterHarborPushScope(List allServices, String scope) {
|
|
|
def s = (scope ?: 'all-java-services').trim()
|
|
|
@@ -216,12 +227,12 @@ pipeline {
|
|
|
stage('Checkout') {
|
|
|
steps {
|
|
|
script {
|
|
|
- def branch = (params.GIT_BRANCH ?: 'uat-20260202').trim()
|
|
|
+ def branch = normalizeGitBranch(params.GIT_BRANCH)
|
|
|
if (!branch) {
|
|
|
error('GIT_BRANCH is required')
|
|
|
}
|
|
|
env.GIT_BRANCH = branch
|
|
|
- echo ">>> Checkout branch: ${env.GIT_BRANCH}"
|
|
|
+ echo ">>> Checkout branch: ${env.GIT_BRANCH} (use branch name only, e.g. uat-20260202)"
|
|
|
git branch: "${env.GIT_BRANCH}",
|
|
|
credentialsId: "${env.GIT_CREDENTIALS}",
|
|
|
url: "${env.GIT_URL}"
|