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

Allow push of tags created during the build

    XMLWordPrintable

Details

    • git plugin 4.8.0

    Description

      Currently the GIT Plugin only allows to create pre-defined tags, but not to push all tags created during a build.

      Attachments

        Issue Links

          Activity

            markewaite Mark Waite added a comment - - edited

            The GSoC project is currently developing the ssh private key binding to match the username / password binding. We expect to be complete in the next 4-6 weeks. If you'd like to assist with the testing, you're welcome to work with us on PR-1111. You could experiment with the current pre-release build of that pull request to see if it already addresses your need.

            Alternately, you could add a username / password credential to your Jenkins job and configure it to push through the https interface using the username / password credential

            markewaite Mark Waite added a comment - - edited The GSoC project is currently developing the ssh private key binding to match the username / password binding. We expect to be complete in the next 4-6 weeks. If you'd like to assist with the testing, you're welcome to work with us on PR-1111 . You could experiment with the current pre-release build of that pull request to see if it already addresses your need. Alternately, you could add a username / password credential to your Jenkins job and configure it to push through the https interface using the username / password credential
            reda_alaoui Réda Housni Alaoui added a comment - - edited

            We have been dealing with this issue for years.

            Our workaround has been to have a post build step in the form of the following shell script:

            git pull origin master
            git push origin master --tags

            But with this, we depend on the private key of the machine running the job. It does not scale well with multiple agents.

            Even with the added git ssh private key binding, I don't see how this will allow my shell script to keep working as is. I sense that I am gonna need to tweak it some way. If that is the case, the script will probably stop being portable across Linux/Windows.

            If I can keep my shell as is, that should be ok. If I could drop the shell for something more framed, that would be a lot better.

            reda_alaoui Réda Housni Alaoui added a comment - - edited We have been dealing with this issue for years. Our workaround has been to have a post build step in the form of the following shell script: git pull origin master git push origin master --tags But with this, we depend on the private key of the machine running the job. It does not scale well with multiple agents. Even with the added git ssh private key binding, I don't see how this will allow my shell script to keep working as is. I sense that I am gonna need to tweak it some way. If that is the case, the script will probably stop being portable across Linux/Windows. If I can keep my shell as is, that should be ok. If I could drop the shell for something more framed, that would be a lot better.
            markewaite Mark Waite added a comment -

            One of the freestyle projects that I used for my testing was configured to push tags. I even used the XShell plugin so that I could run the same freestyle project on Windows and on Linux. In that case, the command I used was

            git push --tags
            

            That command works in both batch and in shell and keeps the freestyle project simple.

            The freestyle usage is described at https://plugins.jenkins.io/git/#git-bindings. It makes the credential available to all the build steps in the freestyle project. I placed my "git push" in an xshell build step that was the last build step of the job.

            markewaite Mark Waite added a comment - One of the freestyle projects that I used for my testing was configured to push tags. I even used the XShell plugin so that I could run the same freestyle project on Windows and on Linux. In that case, the command I used was git push --tags That command works in both batch and in shell and keeps the freestyle project simple. The freestyle usage is described at https://plugins.jenkins.io/git/#git-bindings . It makes the credential available to all the build steps in the freestyle project. I placed my "git push" in an xshell build step that was the last build step of the job.

            I suppose the example you are talking about was using git username/password binding.

            I suppose it will work the same once https://ci.jenkins.io/job/Plugins/job/git-plugin/view/change-requests/job/PR-1111/ is merged?

            reda_alaoui Réda Housni Alaoui added a comment - I suppose the example you are talking about was using git username/password binding. I suppose it will work the same once https://ci.jenkins.io/job/Plugins/job/git-plugin/view/change-requests/job/PR-1111/  is merged?
            reda_alaoui Réda Housni Alaoui added a comment - - edited

            Since https://ci.jenkins.io/job/Plugins/job/git-plugin/view/change-requests/job/PR-1111/ is not ready yet, https://github.com/jenkinsci/git-plugin/pull/1126 was rejected and some people may prefer a simple UI to a shell script, I just published https://github.com/jenkinsci/git-push-plugin/ .

            https://github.com/jenkinsci/git-push-plugin/ precisely fullfill the need described in this ticket, which is pushing (using the configured scm git credentials) all tags (and commits) created by the build (be it npm, yarn, maven, ...) without knowing their names before the build begins.

            reda_alaoui Réda Housni Alaoui added a comment - - edited Since https://ci.jenkins.io/job/Plugins/job/git-plugin/view/change-requests/job/PR-1111/  is not ready yet, https://github.com/jenkinsci/git-plugin/pull/1126  was rejected and some people may prefer a simple UI to a shell script, I just published https://github.com/jenkinsci/git-push-plugin/  . https://github.com/jenkinsci/git-push-plugin/ precisely fullfill the need described in this ticket, which is pushing (using the configured scm git credentials) all tags (and commits) created by the build (be it npm, yarn, maven, ...) without knowing their names before the build begins.

            People

              Unassigned Unassigned
              mario_mancino Mario Mancino
              Votes:
              9 Vote for this issue
              Watchers:
              14 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: