diff --git a/Jenkinsfile b/Jenkinsfile index 574357f..36e0a22 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,13 +25,17 @@ pipeline { } stage('Commit & Push') { steps { - script { + withCredentials([usernamePassword( + credentialsId: env.GIT_CREDENTIALS, + usernameVariable: 'GIT_USER', + passwordVariable: 'GIT_PASS' + )]) { sh ''' git config user.name "jenkins" git config user.email "jenkins@example.com" git add test.txt - git commit -m "Update test.txt from Jenkins" - git push origin main + git commit -m "Update test.txt from Jenkins" || echo "No changes to commit" + git push https://$GIT_USER:$GIT_PASS@git.karel.one/karel/test.git main ''' } }