Note: this is done in a declarative pipeline.
jglick, thoughts?
On Friday, March 24, 2017 at 2:37:57 PM UTC+3, Idan Adar wrote:
>
> 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/82ba7859-bdde-4a55-a6b1-40e92b057be4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.