How do you get "git push" to work in a Jenkinsfile? I am not sure what am I
missing.
The Jenkinsfile checkouts a repo using an access token (this is configured
in the Jenkins UI for the job).
The Jenkins file also does a merge of a PR in one of its stages:
withCredentials([usernamePassword(credentialsId: '****', usernameVariable:
'ACCESS_TOKEN_USERNAME', passwordVariable: 'ACCESS_TOKEN_PASSWORD',)]) {
sh "curl -X PUT -d '{\"commit_title\": \"Merge pull request\"}'
https://***/pulls/$CHANGE_ID/merge?access_token=$ACCESS_TOKEN_PASSWORD"
}
But I can't get "git push" to work in another stage:
git config --global user.name '****'
git config --global user.email ****
git commit -am 'Bumped version number'
git remote set-url origin git@****.git
git push origin master
I tried wrapping the above in withCredential and also . with agent, but
nothing works...
Tips?
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/a32566df-2725-4c9d-a973-171ccc376ad8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.