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

Allow push of tags created during the build

    XMLWordPrintable

    Details

    • Similar Issues:

      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

            Hide
            vitoandolini Vito Andolini added a comment - - edited

            The help text for the "Add Tag" section of the "Git Publisher" Post-Build Action states:

            Specify tags to push at the completion of the build.

            If the "Create Tag" or "Update tag" option is selected, the tag will be created or updated and pushed at the completion of the build, and the push will fail if a tag with the given name already exists. If the "Create Tag" option is not selected, the push will fail if the tag does not already exist.

            Environment variables may be used in the tag name - they will be replaced at build time.

            The repository name needs to be one of the repositories configured in the SCM section above.

            I have found that environment variables can be used in the tag message, but not the name. I don't understand why the plug-in would require the tag name to be hard-coded - who would go configure the job before each build to add a hard-coded tag name?

            Show
            vitoandolini Vito Andolini added a comment - - edited The help text for the "Add Tag" section of the "Git Publisher" Post-Build Action states: Specify tags to push at the completion of the build. If the "Create Tag" or "Update tag" option is selected, the tag will be created or updated and pushed at the completion of the build, and the push will fail if a tag with the given name already exists. If the "Create Tag" option is not selected, the push will fail if the tag does not already exist. Environment variables may be used in the tag name - they will be replaced at build time. The repository name needs to be one of the repositories configured in the SCM section above. I have found that environment variables can be used in the tag message, but not the name. I don't understand why the plug-in would require the tag name to be hard-coded - who would go configure the job before each build to add a hard-coded tag name?
            Hide
            marcellodesales Marcello de Sales added a comment - - edited

            Hi there,

            I'm coming from Node.js community... I use the following command when I finish a build: (https://docs.npmjs.com/cli/version)

            • Building Develop Branch:
            npm version prerelease -m "Upgrade by CI"
            

            This will create a new commit, with a tag of the version increment for the current version, say, from 1.3.4, to 1.3.4-0. So, that can be ANY tag during the development cycle. Therefore, I also need to have the ability to publish ANY tag created by npm CLI.

            thanks!

            Show
            marcellodesales Marcello de Sales added a comment - - edited Hi there, I'm coming from Node.js community... I use the following command when I finish a build: ( https://docs.npmjs.com/cli/version ) Building Develop Branch: npm version prerelease -m "Upgrade by CI" This will create a new commit, with a tag of the version increment for the current version, say, from 1.3.4, to 1.3.4-0. So, that can be ANY tag during the development cycle. Therefore, I also need to have the ability to publish ANY tag created by npm CLI. thanks!
            Hide
            hirviid David Van Gompel added a comment - - edited

            For anyone who's interested, I've found a workaround:

            1. Add something like this to your shell script:

            #!/bin/sh
            APP_BUILD_NUMBER=`npm version patch`
            echo APP_BUILD_NUMBER=${APP_BUILD_NUMBER} > build.properties
            

            2. then add build step Inject environment variables and set Properties File Path to `$WORKSPACE/build.properties`

            3. after that, $APP_BUILD_NUMBER is accessible in all build steps as environment variable. Click `Add tag` in Git Publisher (Post-build action) and set tag to push to $APP_BUILD_NUMBER.

            Show
            hirviid David Van Gompel added a comment - - edited For anyone who's interested, I've found a workaround: 1. Add something like this to your shell script: #!/bin/sh APP_BUILD_NUMBER=`npm version patch` echo APP_BUILD_NUMBER=${APP_BUILD_NUMBER} > build.properties 2. then add build step Inject environment variables and set Properties File Path to `$WORKSPACE/build.properties` 3. after that, $APP_BUILD_NUMBER is accessible in all build steps as environment variable. Click `Add tag` in Git Publisher (Post-build action) and set tag to push to $APP_BUILD_NUMBER.
            Hide
            jhas Jon Has added a comment -

            It was sure easier if this feature would exist.

            Using the jgitflow:release-start/finish creates a tag in the build process, but doesn't push it to remote git.

            This feature would make it easier instead of configuring git ssh with the jenkins machine + manually call git commands (because git commands requires password, which cannot be done in an automatic job)

            Show
            jhas Jon Has added a comment - It was sure easier if this feature would exist. Using the jgitflow:release-start/finish creates a tag in the build process, but doesn't push it to remote git. This feature would make it easier instead of configuring git ssh with the jenkins machine + manually call git commands (because git commands requires password, which cannot be done in an automatic job)
            Hide
            kevlan Kevin Lannen added a comment -

            This should be a simple call to `git push <remote-name> --tags` Why is this still an open issue 3 years after it was reported? I'm using zest releaser for python and it adds tags to commits it creates but there's no way to push these tags up that I can find.

            Show
            kevlan Kevin Lannen added a comment - This should be a simple call to `git push <remote-name> --tags` Why is this still an open issue 3 years after it was reported? I'm using zest releaser for python and it adds tags to commits it creates but there's no way to push these tags up that I can find.

              People

              • Assignee:
                Unassigned
                Reporter:
                mario_mancino Mario Mancino
              • Votes:
                8 Vote for this issue
                Watchers:
                11 Start watching this issue

                Dates

                • Created:
                  Updated: