Skip to content

Commit 7a8ec90

Browse files
author
R. Tyler Croy
authored
Merge pull request #56 from blaisep/gist/push-git-repo
Add an example using injected credentials
2 parents bffea0a + 442d228 commit 7a8ec90

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed
Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
# Synopsis
22

33
This demonstrates how to push a tag (or branch, etc) to a remote Git
4-
repository from within a Pipeline job. Currently it only contains an
5-
example for pushing using username and password to authenticate.
4+
repository from within a Pipeline job. The authentication step may vary between projects. This example illustrates injected credentials and also username / password authentication.
65

76
# Note
87

8+
If you inject a credential associated with your Git repo, use the Snippet Generator to select the plain `Git` option and it will return a snippet with this gem:
9+
10+
```java
11+
stage('Checkout') {
12+
git branch: 'lts-1.532', credentialsId: '82aa2d26-ef4b-4a6a-a05f-2e1090b9ce17', url: '[email protected]:jenkinsci/maven-plugin.git'
13+
}
14+
```
915
This is not ideal - there is an open JIRA,
10-
https://issues.jenkins-ci.org/browse/JENKINS-28335, for getting the
11-
GitPublisher Jenkins functionality working with Pipeline.
16+
https://issues.jenkins-ci.org/browse/JENKINS-28335, for getting the GitPublisher Jenkins functionality working with Pipeline.
1217

1318
# Credit
1419

1520
Based on Stackoverflow answer at http://stackoverflow.com/questions/33570075/tag-a-repo-from-a-jenkins-workflow-script
21+
Injected credentials gist at https://gist.github.com/blaisep/eb8aa720b06eff4f095e4b64326961b5#file-jenkins-pipeline-git-cred-md

0 commit comments

Comments
 (0)