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

Conditional tagging (simple and easy)

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • svn-tag-plugin
    • None

      My use case is as follows:

      I have a parameterized build (freestyle project) and I would like to be able to decide, based on the parameters selected by the user, whether to tag the build or not.

      The only solution I found involves the use of the "Environment Script Plugin" to inject an environment variable in the build process and then pick it up with the tagging plugin.

      Roughly:

      (1) The environment script configuration looks like this ("Generate environment variables from script")

      if some_condition; then
      echo BUILD_TAG_URL="http://my.svn.server/repo/tags/$NAME/Build-$BUILD_NUMBER"
      else
      echo BUILD_TAG_URL="<do_not_tag_me>"
      fi

      (2) The configuration for subversion tagging looks like this:

      tag_base_url = ${env['BUILD_TAG_URL']}

      It works, in the sense that the tagging obviously fails when the tag URL is set to something plain invalid like "<do_not_tag_me>".

      I was wondering if you could put together a more elegant solution to conditional tagging; could be as simple as not tagging a build if the tag base URL expands to an empty string (my case), or something more elaborate (tag or not, based on a condition).

            k2nakamura k2nakamura
            a_biardi Andrea Biardi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: