• Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Major Major
    • mercurial-plugin
    • None

      I'd like to use a Choice Parameter to select the Mercurial URL to clone from. Something like:

      repository=foo

      Mercurial URL: http://server/${repository}

      but the variable doesn't get substituted:

      abort: HTTP Error 404: Not Found
      ERROR: Failed to clone http://server/${repository}

      Searching the bug database I found JENKINS-9686 which is kind of related. A quick look at the code tells me this is just not implemented but supporting it seems trivial.

          [JENKINS-23497] variable substitution in repository URLs

          Jesse Glick added a comment -

          Could be supported. Doing this mostly defeats the purpose of using the Mercurial plugin at all, as opposed to just adding a shell step to run hg clone directly, since changelogs and updates and polling would not work in such a job. I am guessing that what you really want to do is to create a series of jobs sharing mostly the same configuration but using different repository URLs, which is better accomplished with other plugins: Templates (if using Jenkins Enterprise), or Job DSL, etc.

          Jesse Glick added a comment - Could be supported. Doing this mostly defeats the purpose of using the Mercurial plugin at all, as opposed to just adding a shell step to run hg clone directly, since changelogs and updates and polling would not work in such a job. I am guessing that what you really want to do is to create a series of jobs sharing mostly the same configuration but using different repository URLs, which is better accomplished with other plugins: Templates (if using Jenkins Enterprise), or Job DSL, etc.

          Aiko Mastboom added a comment -

          It appears the variable does indeed get substituted now, and cloning commences.
          However a check is done against unresolved variable in the url.

          Building in workspace /var/lib/jenkins/.jenkins/workspaces/6e4967dca30e
          [6e4967dca30e] $ hg showconfig paths.default
          ERROR: Workspace reports paths.default as http://hg/reponame
          which looks different than http://hg/${REPO}
          so falling back to fresh clone rather than incremental update
          $ hg clone --rev 6e4967dca30e --noupdate http://hg/${REPO} /var/lib/jenkins/.jenkins/workspaces/6e4967dca30e
          adding changesets
          adding manifests
          adding file changes

          jenkins ver. 1.570
          mercurial plugin ver. 1.50

          Aiko Mastboom added a comment - It appears the variable does indeed get substituted now, and cloning commences. However a check is done against unresolved variable in the url. Building in workspace /var/lib/jenkins/.jenkins/workspaces/6e4967dca30e [6e4967dca30e] $ hg showconfig paths.default ERROR: Workspace reports paths.default as http://hg/reponame which looks different than http://hg/$ {REPO} so falling back to fresh clone rather than incremental update $ hg clone --rev 6e4967dca30e --noupdate http://hg/$ {REPO} /var/lib/jenkins/.jenkins/workspaces/6e4967dca30e adding changesets adding manifests adding file changes jenkins ver. 1.570 mercurial plugin ver. 1.50

          Jesse Glick added a comment -

          Possibly fixed by https://github.com/jenkinsci/mercurial-plugin/pull/60 so recheck in 1.51-beta-2.

          Jesse Glick added a comment - Possibly fixed by https://github.com/jenkinsci/mercurial-plugin/pull/60 so recheck in 1.51-beta-2.

          Lisi Blümelhuber added a comment - - edited

          At my company, we use EZ Templates Plugin to administrate our builds - the repository URL ist replaced by a String Choice parameter.

          Unfortunately, this collides with PUSH notifications by the Mercurial Plugin, as the variable obviously is not substituted.

          So, a call to 

          <jenkins-url>/notifyCommit?url=<repo-name>

          leads to: "No Mercurial jobs found using repository", although multiple fitting builds are available.

          Used versions are:

          Jenkins 2.19.1
          Mercurial plugin 1.56

          Lisi Blümelhuber added a comment - - edited At my company, we use EZ Templates Plugin to administrate our builds - the repository URL ist replaced by a String Choice parameter. Unfortunately, this collides with PUSH notifications by the Mercurial Plugin, as the variable obviously is not substituted. So, a call to  <jenkins-url>/notifyCommit?url=<repo-name> leads to: "No Mercurial jobs found using repository", although multiple fitting builds are available. Used versions are: Jenkins 2.19.1 Mercurial plugin 1.56

            jglick Jesse Glick
            twisti Chris Thalinger
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: