This is really cool guys. 

I was wondering why

checkout scm

it didn't enable git command to avoid create sh command, but I guess this 
is in progress. it will be good if you can share as troubleshooting in 
pipelines plugin because the integration with Git is a little unclear for a 
newbie like me

On Tuesday, 20 September 2016 10:28:51 UTC+2, Andrey Makeev wrote:
>
>
> I want to share my Jenkins Pipeline setup 
> <https://gist.github.com/amaksoft/b17408303d69c71498eaa39ea2ee3b01> and 
> my solution to publish changes/tags to git repo via SSH (While Git 
> Publish Support <https://issues.jenkins-ci.org/browse/JENKINS-28335> is 
> under development). Please check it out for more info, any improvement 
> ideas are welcome.
>
> In short you just add file *git_push_ssh.groovy* to your project and call 
> method pushSSH() from Jenkinsfile like this:
>
>     env.BRANCH_NAME = "mycoolbranch"// BRANCH_NAME is predefined in 
> multibranch pipeline job
>     env.J_GIT_CONFIG = "true"
>     env.J_USERNAME = "Jenkins CI"
>     env.J_EMAIL = "[email protected] <javascript:>"
>     env.J_CREDS_IDS = '02aa92ec-593e-4a90-ac85-3f43a06cfae3' // Use 
> credentials id from Jenkins
>     def gitLib = load "git_push_ssh.groovy"
>     ...
>     gitLib.pushSSH(commitMsg: "Jenkins build #${env.BUILD_NUMBER}", 
> tagName: "build-${env.BUILD_NUMBER}", files: "changelog.txt 
> someotherfile.txt");
>
>
>
> суббота, 27 августа 2016 г., 4:02:40 UTC+4 пользователь Random Guy написал:
>>
>> I tried withCredentials() method...  its giving an error.. 
>> NoSuchMethodError...
>>
>> java.lang.NoSuchMethodError: No such DSL method 'withCredentials' found
>>
>>  Here is how my method look
>>
>> withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 
>> 'myid', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
>>
>>            sh("git tag -a ${TAG_NAME}")
>>            sh('git push https://${USERNAME}:${PASSWORD}@game-of-life 
>> --tags')
>> }
>>
>> any idea?
>>
>>
>>
>> On Sunday, June 19, 2016 at 8:30:43 AM UTC-7, Mark Waite wrote:
>>>
>>> I found the answer.  Sorry to bother the list.
>>>
>>> Git publisher is not yet supported with pipeline (see 
>>> https://issues.jenkins-ci.org/browse/JENKINS-28335)
>>>
>>> A work around to publish to git from a pipeline is available.  See 
>>> https://github.com/jenkinsci/pipeline-examples/blob/master/pipeline-examples/push-git-repo/pushGitRepo.Groovy
>>>  
>>>
>>> Mark Waite
>>>
>>> On Sunday, June 19, 2016 at 9:02:10 AM UTC-6, Mark Waite wrote:
>>>>
>>>> I've been creating Jenkins jobs as tests of various bug fixes and 
>>>> storing them in a git repository.  Currently, the Jenkins jobs include the 
>>>> definition of the verification steps to confirm the bug is fixed.
>>>>
>>>> The pipeline file seems like a better way to check that the problem is 
>>>> fixed, since the checks for successful job completion can be done in 
>>>> groovy.
>>>>
>>>> One of the bugs I need to check needs to use the git publisher to push 
>>>> a commit back to the originating repository and branch.  In the snippet 
>>>> generator I can see an entry for "publishHTML", but I don't see any entry 
>>>> that would let me use the git publisher to push changes.  A google search 
>>>> also did not show any obvious hints of ways I could use the git publisher.
>>>>
>>>> Are there examples that use the git publisher from a pipeline script?
>>>>
>>>> Thanks,
>>>> Mark Waite
>>>>
>>>

-- 
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/b81da9e6-263b-4fd1-83da-fa14d813f558%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to