add git push from Jenkins

This commit is contained in:
Nana Janashia
2020-11-29 08:30:24 +01:00
parent a24c7c6f15
commit 0972181e49

20
Jenkinsfile vendored
View File

@@ -43,7 +43,25 @@ pipeline {
steps {
script {
echo 'deploying docker image to EC2...'
echo 'bla'
}
}
}
stage('commit version update') {
steps {
script {
withCredentials([usernamePassword(credentialsId: 'gitlab-credentials', passwordVariable: 'PASS', usernameVariable: 'USER')]) {
sh 'git config --global user.email "jenkins@example.com"'
sh 'git config --global user.name "jenkins"'
sh 'git status'
sh 'git branch'
sh 'git config --list'
sh "git remote set-url origin https://${USER}:${PASS}@gitlab.com/nanuchi/java-maven-app.git"
sh 'git add .'
sh 'git commit -m "ci: version bump"'
sh 'git push origin HEAD:jenkins-jobs'
}
}
}
}