On a related note, when you want to automate something, you generally want
to think on how you'd do it 'manually'. Here as Mark summarized perfectly,
you just use 'sh' facility. Where plugins shine and where they can and
should be used is when there's a interesting integration to avoid writing
boilerplate in each of your pipeline (like checking out the right Sha for
the thing that actually triggered the current build, etc.).

FWIW, it makes me think about the upcoming session of Michaël Pailloncy at
Jenkins world next September in San Francisco:
https://devopsworldjenkinsworld2018.sched.com/event/FCej/habits-tips-and-tricks-to-efficiently-automate-tasks-with-jenkins?iframe=yes&w=100%&sidebar=yes&bg=no#

Cheers

Le mer. 8 août 2018 à 04:12, Jack Brooks <jbro...@snapapp.com> a écrit :

> Aha! Thanks so much! I will have to get busy on this. I was looking at it
> totally wrong.
>
> On Tue, Aug 7, 2018, 9:10 PM Mark Waite <mark.earl.wa...@gmail.com> wrote:
>
>> The git plugin has no facility to support creating a branch or pushing a
>> branch from a Pipeline step.
>>
>> However, Pipeline can do it with an "sh" or "bat" step (depending on your
>> platform).
>>
>> If your repository URL is an ssh URL ( g...@example.com:dir/repo.git or
>> ssh://g...@example.com/dir/repo.git ) then you would use place the sh or
>> bat step inside an ssh-agent block.  The ssh-agent block starts ssh-agent
>> and then command line git will use ssh-agent to authenticate.
>>
>> If your repository is an http or https URL (
>> https://example.com/dir/repo.git ) then you would use place the sh or
>> bat step inside a withCredentials block.  The withCredentials block
>> extracts username and password from the Jenkins credentials and makes them
>> available as a variable.  Place that variable inside the git URL in the
>> sh or bat step as in "git push
>> https://${USERNAME}:${PASSWORD}@example.com/dir/repo";.  There are
>> examples of withCredentials on the jenkins.io site to give good
>> techniques.
>>
>> Mark Waite
>>
>> On Tue, Aug 7, 2018 at 6:24 PM <jbro...@snapapp.com> wrote:
>>
>>> Hi folks,
>>>
>>> I've googled extensively, but I haven't seen any documentation or
>>> answers on how to create a new git branch in Pipeline. I must be missing
>>> something obvious, but the Git plugin page doesn't indicate anything other
>>> than checking out code with credentials. Has anyone here used Jenkins to
>>> create a branch and then push it to remote?
>>>
>>> Thanks!
>>> Jack
>>>
>>> --
>>> 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 jenkinsci-users+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/jenkinsci-users/22a42e16-f0df-4dad-9e1f-3996cae8d40a%40googlegroups.com
>>> <https://groups.google.com/d/msgid/jenkinsci-users/22a42e16-f0df-4dad-9e1f-3996cae8d40a%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 a topic in the
>> Google Groups "Jenkins Users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/jenkinsci-users/37zGosGowKc/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> jenkinsci-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtFn_4Zte%3DmQ_QLDB4JvGiVbt8GY3WbxaqB9hMTxqjM61g%40mail.gmail.com
>> <https://groups.google.com/d/msgid/jenkinsci-users/CAO49JtFn_4Zte%3DmQ_QLDB4JvGiVbt8GY3WbxaqB9hMTxqjM61g%40mail.gmail.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 jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/CAAk78BQPj2Xmw%3DapYA%2B-Do3yQ4uDRyfXsutshOWgRUw8swpRfA%40mail.gmail.com
> <https://groups.google.com/d/msgid/jenkinsci-users/CAAk78BQPj2Xmw%3DapYA%2B-Do3yQ4uDRyfXsutshOWgRUw8swpRfA%40mail.gmail.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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CANWgJS5LVyv9dH4QKUhw_OTYZQVenNCbuhzaeNc5K6zzrjBtsQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to