update: jenkinsfile code for multibranch pipeline
This commit is contained in:
parent
859b0ce173
commit
ab05c4fcb4
|
|
@ -36,7 +36,7 @@ pipeline {
|
||||||
script {
|
script {
|
||||||
def gitBranch = env.BRANCH_NAME ?: sh(script: "git rev-parse --abbrev-ref HEAD", returnStdout: true).trim()
|
def gitBranch = env.BRANCH_NAME ?: sh(script: "git rev-parse --abbrev-ref HEAD", returnStdout: true).trim()
|
||||||
def tag = "${gitBranch}-build-${env.BUILD_NUMBER}"
|
def tag = "${gitBranch}-build-${env.BUILD_NUMBER}"
|
||||||
echo "🛠 Building and pushing Docker images with tag: ${tag}"
|
echo "Building and pushing Docker images with tag: ${tag}"
|
||||||
|
|
||||||
withCredentials([usernamePassword(credentialsId: env.DOCKER_CRED_ID, usernameVariable: 'DOCKER_USER', passwordVariable: 'DOCKER_PASS')]) {
|
withCredentials([usernamePassword(credentialsId: env.DOCKER_CRED_ID, usernameVariable: 'DOCKER_USER', passwordVariable: 'DOCKER_PASS')]) {
|
||||||
sh """
|
sh """
|
||||||
|
|
@ -80,12 +80,12 @@ pipeline {
|
||||||
dir("${MANIFEST_DIR}-${overlayEnv}") {
|
dir("${MANIFEST_DIR}-${overlayEnv}") {
|
||||||
sh """
|
sh """
|
||||||
set -e
|
set -e
|
||||||
echo "🧹 Cleaning overlays folder, keeping only ${overlayEnv}..."
|
echo "Cleaning overlays folder, keeping only ${overlayEnv}..."
|
||||||
for d in overlays/*; do
|
for d in overlays/*; do
|
||||||
[ -d "$d" ] || continue
|
[ -d "\$d" ] || continue
|
||||||
if [ "$(basename "$d")" != "${overlayEnv}" ]; then
|
if [ "\$(basename \"\$d\")" != "${overlayEnv}" ]; then
|
||||||
echo "Removing $d"
|
echo "Removing \$d"
|
||||||
rm -rf "$d"
|
rm -rf "\$d"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
@ -115,7 +115,7 @@ pipeline {
|
||||||
|
|
||||||
stage('ArgoCD Sync (optional)') {
|
stage('ArgoCD Sync (optional)') {
|
||||||
steps {
|
steps {
|
||||||
echo "ℹIf ArgoCD auto-sync is enabled, updates will deploy automatically."
|
echo "If ArgoCD auto-sync is enabled, updates will deploy automatically."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue