update Jenkinsfile for workflow gitops
This commit is contained in:
parent
642ab59f5e
commit
663ddd17d0
|
|
@ -65,11 +65,13 @@ pipeline {
|
||||||
|
|
||||||
withCredentials([usernamePassword(credentialsId: 'gitea-token-gitops', usernameVariable: 'GITEA_USER', passwordVariable: 'GITEA_PASS')]) {
|
withCredentials([usernamePassword(credentialsId: 'gitea-token-gitops', usernameVariable: 'GITEA_USER', passwordVariable: 'GITEA_PASS')]) {
|
||||||
branches.each { envSet ->
|
branches.each { envSet ->
|
||||||
sh """
|
|
||||||
echo "=============================="
|
echo "=============================="
|
||||||
echo "Updating GitOps for branch: ${envSet.name}"
|
echo "Updating GitOps for branch: ${envSet.name}"
|
||||||
echo "=============================="
|
echo "=============================="
|
||||||
|
|
||||||
|
// Gunakan block dengan masking aktif
|
||||||
|
sh(
|
||||||
|
script: """
|
||||||
# Install yq kalau belum ada
|
# Install yq kalau belum ada
|
||||||
if ! command -v ./yq &> /dev/null; then
|
if ! command -v ./yq &> /dev/null; then
|
||||||
echo "Installing yq locally..."
|
echo "Installing yq locally..."
|
||||||
|
|
@ -96,7 +98,9 @@ pipeline {
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
rm -rf gitops
|
rm -rf gitops
|
||||||
"""
|
""",
|
||||||
|
mask: true // <--- ini kunci masking password dari log
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -106,14 +110,14 @@ pipeline {
|
||||||
|
|
||||||
post {
|
post {
|
||||||
success {
|
success {
|
||||||
echo "✅ GitOps update successful — all branches (dev, staging, prod) updated!"
|
echo "GitOps update successful — all branches (dev, staging, prod) updated!"
|
||||||
}
|
}
|
||||||
failure {
|
failure {
|
||||||
echo "❌ Pipeline failed, check Jenkins logs for details."
|
echo "Pipeline failed, check Jenkins logs for details."
|
||||||
}
|
}
|
||||||
always {
|
always {
|
||||||
cleanWs()
|
cleanWs()
|
||||||
echo "🧹 Workspace cleaned up."
|
echo "Workspace cleaned up."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue