update Jenkinsfile for workflow gitops

This commit is contained in:
Syifa 2025-10-24 09:59:37 +07:00
parent 642ab59f5e
commit 663ddd17d0
1 changed files with 31 additions and 27 deletions

14
Jenkinsfile vendored
View File

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