![]() But if you commit on top of a Branch, it will move to the latest commit. If you commit on top of a Git Tag, the tag will not move. There are a few tricks you can perform with both of them the main similarity is that both point to a specific commit, and the difference is that Git Tag is a static pointer while Branches are not. On the other hand, Git Tags are in some ways similar to Git Branches. It’s the difference between talking about “commit a54b72f” or “commit v1.3.2.” Which one sounds better to you? So yeah, you guessed it: Git Tag lets us identify specific commits by naming them, thus making them more meaningful and user-friendly. In non-techie language, it’s basically the same as writing down the commit sha512 id and labeling it with a name we want. Git Tag is a functionality of Git that lets us snapshot our commits. But why go to that length if Git Tag can help us with that? Git Tag? What’s That? We could always save the sha512 id of the commit and write it down on a piece of paper. We may need to know exactly where we made a specific change we may need to mark the start of a new version maybe we just want to. This is the life of a software engineer.Īmong all those changes we make every day, we’ll want to save some specific points. So, today we’ll add a feature, tomorrow we’ll tweak another one, and the day after, we’ll fix a bug. What does it really mean to develop a piece of software? Essentially, it comes down to adding changes on top of changes and (almost always) using Git along the way to manage them. For now, however, this solution is working for us, we just remove the extra Refspec after the job succeeds.To introduce Git Tags, we’ll need to revisit a concept that we software engineers all know inherently but don’t tend to think about that often. I suspect, for example, that maybe this wouldn't happen if the refspec specifically was +refs/tags/:refs/remotes/origin/tags/ rather than the asterisk catch-all. If anyone finds a more elegant solution, please edit this answer with an update. The only way I could prevent Jenkins from making the unnecessary builds for the tag jobs is to clear the Refspec field (i.e., delete the +refs/tags/*:refs/remotes/origin/tags/*). I have tried configuring the jobs both with and without the "Force polling using workspace" option, and it seemed to have no effect. This leads to a lot of unnecessary re-builds of the same tag jobs over and over again. Update : Unfortunately, this solution does come with an undesirable side-effect for Jenkins CI (v.1.555) and the Git repository push notification mechanism à la Stash Webhook to Jenkins: any time any branch on the repository is updated in a push, the tag build jobs will also fire again. Only when I explicitly specified "get the remote tags" in the Refspec field was the Git plugin able to identify and build from my tag. Although it seemed the git repositories were fetching all the remote information by default when I left it blank, the Git plugin would nevertheless completely fail to find my tag. Under "Branches to build", "Branch specifier", put */tags/ (replacing with your actual tag name).Īdding the Refspec for me turned out to be critical.In the field for Refspec, add the following text: +refs/tags/*:refs/remotes/origin/tags/*.In the "Git Repository" section of your job, under the "Source Code Management" heading, click "Advanced".Make sure you push your tag to the remote repository with git push -tags.I had to cobble together a solution from the various answers plus the "build a Git tag" blog post cited by Thilo. I wanted a job to build for one Git repository for one specific, fixed (i.e., non-parameterized) tag. ![]() ![]() None of these answers were sufficient for me, using Jenkins CI v.1.555, Git Client plugin v.1.6.4, and Git plugin 2.0.4. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |