Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tagging a GitHub project through Jenkins

Our team has recently moved from a locally hosted Subversion repository to a private GitHub repository. In the past, when we had a build that we were ready to mark as 'released', we would use the 'Tag this build' sidebar link to add a SVN tag on the contents of the build.

With the move to GitHub, I have tagging of a build working in Jenkins, but it only seems to tag the build locally. The tag displays up if I run git tag in the workspace directory, but it never gets pushed to GitHub.

Is there a way to have Jenkins push a tag to a remote repository whenever the build is tagged through Jenkins?

like image 307
Jason Gritman Avatar asked Dec 19 '11 17:12

Jason Gritman


People also ask

How do I pass tag name in Jenkins pipeline?

In the "Git Repository" section of your job, under the "Source Code Management" heading, click "Advanced". Under "Branches to build", "Branch specifier", put */tags/<TAG_TO_BUILD> (replacing <TAG_TO_BUILD> with your actual tag name).

How do I link my GitHub repository to Jenkins?

Step 1: go to your GitHub repository and click on 'Settings'. Step 2: Click on Webhooks and then click on 'Add webhook'. Step 3: In the 'Payload URL' field, paste your Jenkins environment URL. At the end of this URL add /github-webhook/.


1 Answers

Select 'Push GIT tags back to origin repository' from the post-build actions (this is required to update your centralised git repo with the results of the build).

https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin#GitPlugin-AdvancedFeatures

like image 87
manojlds Avatar answered Oct 02 '22 17:10

manojlds