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

variable substitution in repository URLs

    Details

    • Similar Issues:

      Description

      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.

        Attachments

          Issue Links

            Activity

            Hide
            jglick 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.

            Show
            jglick 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.
            Hide
            aikomastboom 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

            Show
            aikomastboom 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
            Hide
            jglick Jesse Glick added a comment -

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

            Show
            jglick Jesse Glick added a comment - Possibly fixed by https://github.com/jenkinsci/mercurial-plugin/pull/60 so recheck in 1.51-beta-2.
            Hide
            kirinya 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

            Show
            kirinya 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

              People

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

                Dates

                • Created:
                  Updated: