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

git plugin should NOT tag every build by default

    XMLWordPrintable

Details

    Description

      Git plugin automatically tries to add tags to my Git repository for every build (every 15 minutes or so!). that's very weird it does it automatically by default without me configuring this.
      I don't need hundreds of tags in Git repo... I suggest turning this OFF by default and allowing to configure it in Jenkins UI per build job.

      Attachments

        Issue Links

          Activity

            I noticed after I submitted that comment that it doesn't happen unless the git-publisher is enabled (post-build action). As soon as it's enabled, it starts generating tags of the form "jenkins-${project}-${build_number}-SUCCESS"

            feystorm Patrick Hemmer added a comment - I noticed after I submitted that comment that it doesn't happen unless the git-publisher is enabled (post-build action). As soon as it's enabled, it starts generating tags of the form "jenkins-${project}-${build_number}-SUCCESS"

            Looks like it's from this: https://github.com/jenkinsci/git-plugin/blob/e384fbff87fec3473f7032760dfd0f4ec5285896/src/main/java/hudson/plugins/git/GitPublisher.java#L215
            The code does have a conditional gitSCM.getSkipTag, but I have no clue what controls that.

            feystorm Patrick Hemmer added a comment - Looks like it's from this: https://github.com/jenkinsci/git-plugin/blob/e384fbff87fec3473f7032760dfd0f4ec5285896/src/main/java/hudson/plugins/git/GitPublisher.java#L215 The code does have a conditional gitSCM.getSkipTag , but I have no clue what controls that.
            owenmehegan Owen Mehegan added a comment -

            1. I think if you previously used a version of the git plugin which DID enable tags on builds by default, then simply upgrading to the version where tags are disabled by default would not change that setting in your existing builds. You would need to manually do that.
            2. In either case, I think the tags are only created in your local checkout of the repo. They would not be pushed to the remote repo unless you happened to do a 'git push' or 'git push --tags' as part of your build job, or used the git-publisher action as Patrick points out. In my case we create our own tags for builds, in certain cases, and push those. Each time we did that we would also end up with the superfluous Jenkins tags crapping up the remote repo. I think this is why not everyone saw this auto-tag behavior as such a big deal.

            owenmehegan Owen Mehegan added a comment - 1. I think if you previously used a version of the git plugin which DID enable tags on builds by default, then simply upgrading to the version where tags are disabled by default would not change that setting in your existing builds. You would need to manually do that. 2. In either case, I think the tags are only created in your local checkout of the repo. They would not be pushed to the remote repo unless you happened to do a 'git push' or 'git push --tags' as part of your build job, or used the git-publisher action as Patrick points out. In my case we create our own tags for builds, in certain cases, and push those. Each time we did that we would also end up with the superfluous Jenkins tags crapping up the remote repo. I think this is why not everyone saw this auto-tag behavior as such a big deal.
            markewaite Mark Waite added a comment -

            Adding the Git Publisher step was the magic for me. Once that is added, then the jenkins-job_name-job_number-SUCCESS tag is written for each successful job.

            As far as I can tell, Owen Mehegan is correct that the tags are entirely local to the repository, unless you specifically choose to push the tag. Can you further describe the cause of your concern for those extra tags in the repository?

            markewaite Mark Waite added a comment - Adding the Git Publisher step was the magic for me. Once that is added, then the jenkins-job_name-job_number-SUCCESS tag is written for each successful job. As far as I can tell, Owen Mehegan is correct that the tags are entirely local to the repository, unless you specifically choose to push the tag. Can you further describe the cause of your concern for those extra tags in the repository?

            The problem this causes is with things that use the tags. A good example would be git describe --tags. A build job might use this command to generate a version for the build. However with the jenkins tags getting added in, this breaks as the command returns the wrong tag.

            I've ended up just adding git tag d $(git tag --list 'jenkins*') to my build jobs. It's dirty, but it works.

            feystorm Patrick Hemmer added a comment - The problem this causes is with things that use the tags. A good example would be git describe --tags . A build job might use this command to generate a version for the build. However with the jenkins tags getting added in, this breaks as the command returns the wrong tag. I've ended up just adding git tag d $(git tag --list 'jenkins *') to my build jobs. It's dirty, but it works.

            People

              ndeloof Nicolas De Loof
              alskor Alex Java
              Votes:
              6 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: