Unfortunately it fails with ERROR: No branch repo to push to defined

On Friday, March 24, 2017 at 3:34:34 PM UTC+3, Mark Waite wrote:
>
> That seems reasonable.  I haven't evaluated that pull request, so I don't 
> know the steps for sure, that's just my assumption.
>
> Mark Waite
>
> On Fri, Mar 24, 2017 at 6:32 AM Idan Adar <[email protected] <javascript:>> 
> wrote:
>
>> More context:
>>
>> sh "npm --no-git-tag-version version minor"
>>                   
>> // commit the updated version number back to GHE
>> sh "git commit -am 'Bumped version number [ci skip]'"
>> gitPublisher branchesToPush: [[branchName: 'master']], credentialsId: 
>> 'caf2691d-42c7-4d10-acf0-cf5fcc2575a4', url: 'https://***'
>>
>>
>> On Friday, March 24, 2017 at 3:29:56 PM UTC+3, Idan Adar wrote:
>>>
>>> So, a scenario: assuming I have checked out the master branch, ran some 
>>> unit tests and if all is okay I published to npm... 
>>> I now up the version number in package.json and I want this change 
>>> pushed back to master... using this plugin and the following generated 
>>> snippet:
>>>
>>> gitPublisher branchesToPush: [[branchName: 'master']], credentialsId: 
>>> 'caf2691d-42c7-4d10-acf0-cf5fcc2575a4', url: '****'
>>>
>>> The master branch should be updated the changed file?
>>>
>>> On Friday, March 24, 2017 at 3:16:36 PM UTC+3, Mark Waite wrote:
>>>>
>>>> I suspect that the "Pipeline Syntax" link will display a new step "Git 
>>>> Publisher" which can then be used to generate the Jenkinsfile syntax for 
>>>> the Git Publisher.
>>>>
>>>> If you're using declarative, then I suspect that it's user interface 
>>>> will also show a Git Publisher step.
>>>>
>>>> Mark Waite
>>>>
>>>> On Fri, Mar 24, 2017 at 6:11 AM Idan Adar <[email protected]> wrote:
>>>>
>>>>> I can try. 
>>>>> What are the instructions after updating the plugin?
>>>>>
>>>>>
>>>>> On Friday, March 24, 2017 at 3:05:35 PM UTC+3, Mark Waite wrote:
>>>>>
>>>>>> PR452 is a pending pull request for the git plugin which adds 
>>>>>> GitPublisher support to pipeline.
>>>>>>
>>>>>> If you're willing to download and test 
>>>>>> https://ci.jenkins.io/job/Plugins/job/git-plugin/view/change-requests/job/PR-452/lastSuccessfulBuild/artifact/target/git.hpi
>>>>>>  , 
>>>>>> you could provide feedback on that pull request to tell if it works for 
>>>>>> you 
>>>>>> or not.
>>>>>>
>>>>>> Mark Waite
>>>>>>
>>>>>> On Fri, Mar 24, 2017 at 5:50 AM Idan Adar <[email protected]> wrote:
>>>>>>
>>>>> Examples: 
>>>>>>>
>>>>>>> git push '****:****@https://github.****.git/ 
>>>>>>> <https://github.ibm.com/security-services/certificate-management-utils.git/>'
>>>>>>>
>>>>>>>
>>>>>>> But it says: fatal: I don't handle protocol '****:****@https'
>>>>>>>
>>>>>>> Then also tried:
>>>>>>>
>>>>>>> git remote set-url origin https://****:****@github.****.git 
>>>>>>> <https://****:****@github.ibm.com:security-services/certificate-management-utils.git>
>>>>>>> git push origin master
>>>>>>>
>>>>>>>
>>>>>>> But it fails with:
>>>>>>> fatal: unable to access 'https://****:****@github.****.com:****.git/ 
>>>>>>> <https://****:****@github.ibm.com:security-services/certificate-management-utils.git/>':
>>>>>>>  
>>>>>>> Could not resolve host: ****:****@github.****.com; Name or service not 
>>>>>>> known
>>>>>>>
>>>>>>> With sshagent:
>>>>>>>
>>>>>>> git remote set-url origin git@github.****.com:****.git
>>>>>>> + git push origin master
>>>>>>> Host key verification failed.
>>>>>>> fatal: Could not read from remote repository.
>>>>>>>
>>>>>>>
>>>>>>> On Friday, March 24, 2017 at 2:44:58 PM UTC+3, Idan Adar wrote:
>>>>>>>>
>>>>>>>> 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/16980860-a0fc-42d0-b091-eb5f607001fd%40googlegroups.com
>>>>>>>  
>>>>>>> <https://groups.google.com/d/msgid/jenkinsci-users/16980860-a0fc-42d0-b091-eb5f607001fd%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>> .
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>
>>>>>> -- 
>>>>> 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/193a2714-f9f3-48c5-8eb8-06df36c4febc%40googlegroups.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/jenkinsci-users/193a2714-f9f3-48c5-8eb8-06df36c4febc%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>> -- 
>> 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] <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/f94f0eab-895d-4b54-bf95-7c2270b2234f%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jenkinsci-users/f94f0eab-895d-4b54-bf95-7c2270b2234f%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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/acb8f0e1-e048-44a3-8150-aab1949134db%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to