Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-28335

Step to run Git commands w/ credentials & tool (was: GitPublisher support)

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      It would be nice to be able to use the GitPublisher inside a workflow as it is possible in other jobs.

      This requires the plugin to be upgrade to Jenkins core 1.580.1+, to implement the jenkins.tasks.SimpleBuildStep in GitPublisher

        Attachments

          Issue Links

            Activity

            Hide
            taylor01 David Taylor added a comment -

            Claus Schneider we've looked at the pre-tested plugin and we're not sure if it will fit with what we're trying to do. we really just need a way to push changes back to Bitbucket without using SSH keys from the build machine. The Git Plugin / Git Publisher plugin should allow for this but we're not sure how to implement it yet.

            Show
            taylor01 David Taylor added a comment - Claus Schneider we've looked at the pre-tested plugin and we're not sure if it will fit with what we're trying to do. we really just need a way to push changes back to Bitbucket without using SSH keys from the build machine. The Git Plugin / Git Publisher plugin should allow for this but we're not sure how to implement it yet.
            Hide
            jglick Jesse Glick added a comment -

            As already noted in this issue, you can already use withCredentials or sshagent to accomplish this use case. This enhancement would simply make it more convenient.

            Show
            jglick Jesse Glick added a comment - As already noted in this issue, you can already use withCredentials or sshagent to accomplish this use case. This enhancement would simply make it more convenient.
            Hide
            zeninr Ruslan Zenin added a comment - - edited

            Hi Jesse Glick . would it be possible to provide a sample pipeline script how we can accomplish "git push withCredentials or sshagent"? There is a use case for my team to build projects and change some of the artifacts and then push back to the SCM.
            Thank you in advance!
            Note: I found this example: https://jenkins.io/doc/pipeline/examples/#push-git-repo

            withCredentials([usernamePassword(credentialsId: 'git-pass-credentials-ID', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')]) { sh("git tag -a some_tag -m 'Jenkins'") sh('git push https://${GIT_USERNAME}:${GIT_PASSWORD}@<REPO> --tags') }

            Show
            zeninr Ruslan Zenin added a comment - - edited Hi Jesse Glick  . would it be possible to provide a sample pipeline script how we can accomplish "git push withCredentials or sshagent" ? There is a use case for my team to build projects and change some of the artifacts and then push back to the SCM. Thank you in advance! Note: I found this example: https://jenkins.io/doc/pipeline/examples/#push-git-repo withCredentials( [usernamePassword(credentialsId: 'git-pass-credentials-ID', passwordVariable: 'GIT_PASSWORD', usernameVariable: 'GIT_USERNAME')] ) { sh("git tag -a some_tag -m 'Jenkins'") sh('git push https://$ {GIT_USERNAME}:${GIT_PASSWORD}@<REPO> --tags') }
            Hide
            kodstark Kamil Demecki added a comment -

            Ruslan Zenin Above there are examples working for me with ssh key. I didn't check how to use credentials with password if you are asking about this case specific.

            sshagent(['credentiald-id-using-ssh-key']) 
             {
                sh('git command or program calling git inside') 
             }
            
            Show
            kodstark Kamil Demecki added a comment - Ruslan Zenin Above there are examples working for me with ssh key. I didn't check how to use credentials with password if you are asking about this case specific. sshagent([ 'credentiald-id-using-ssh-key' ]) {     sh( 'git command or program calling git inside' ) }
            Hide
            zeninr Ruslan Zenin added a comment - - edited

            Kamil Demecki Thank you! That worked for me!

            Show
            zeninr Ruslan Zenin added a comment - - edited Kamil Demecki Thank you! That worked for me!

              People

              • Assignee:
                Unassigned
                Reporter:
                alecharp Adrien Lecharpentier
              • Votes:
                118 Vote for this issue
                Watchers:
                130 Start watching this issue

                Dates

                • Created:
                  Updated: