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

Hudson /polling build trigger doesn't seem to support parameterized builds like /buildWithParameters does

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Component/s: mercurial-plugin
    • Labels:
      None
    • Environment:
      Windows Server 2008 R2 under Tomcat
    • Similar Issues:

      Description

      I have a Mercurial repository that is polled by Hudson using a post-commit hook in Mercurial.

      It looks like this:

      [hooks]
      changegroup.hudson = "C:\Program Files (x86)\UnxUtils\usr\local\wbin\wget" --non-verbose --spider http://source:8080/job/Messaging/polling | ECHO Result of Hudson Polling Request

      I have recently parameterized the build, so that a mercurial revision id may be passed along. If multiple incoming concurrent changesets, this better allows identification of where a test regression may have occurred, for instance. I have created a string called HgRevId, and I am passing that in as the 'branch' for the Mercurial plugin. This bit seems to work fine.

      I would therefore like the hook to become:

      [hooks]
      changegroup.hudson = "C:\Program Files (x86)\UnxUtils\usr\local\wbin\wget" --non-verbose --spider http://source:8080/job/Messaging/polling?HgRevId=%HG_NODE% | ECHO Result of Hudson Polling Request For Node %HG_NODE%

      However, it seems that there's no way to pass parameters to a polling request build trigger? I tried pollWithParameters and pollingWithParameters with no luck.

      I can use buildWithParameters, but then that doesn't allow me to exclude portions of my repository from causing builds (such as a docs dir):

      [hooks]
      changegroup.hudson = "C:\Program Files (x86)\UnxUtils\usr\local\wbin\wget" --non-verbose --spider http://source:8080/job/Messaging/buildWithParameters?HgRevId=%HG_NODE% | ECHO Result of Hudson Polling Request For Node %HG_NODE%

        Attachments

          Issue Links

            Activity

            Hide
            cjo9900 cjo9900 added a comment -

            The core functionality of the SCM Trigger.poll() does not allow triggers to receive parameters, but the post-commit hooks can receive them.

            In the case you describe you pass the the revision Id as the branch, and this is not taken into account during polling as the poll methods cannot use this information.

            There are two features here that could be implemented:
            1. Pass a named branch via post commit message and then trigger polling only on the jobs that have branch set in their config.
            Add additional checks to MercurialStatus Class[1] for branchId.

            2. Checkout a particular revision in a triggered job.
            Create a Revision Action in the MercurialStatus class [1] that is added to the build when started, if polling triggers it.
            that is fetched during the checkout()[2] phase of the SCM process, and sets the workspace to that revision.
            Similar to how the Subversion plugin does it.

            Removing core and parameterized-trigger components as this is a Mercurial plugin only issue.

            [1] https://github.com/jenkinsci/mercurial-plugin/blob/master/src/main/java/hudson/plugins/mercurial/MercurialStatus.java
            [2] https://github.com/jenkinsci/mercurial-plugin/blob/master/src/main/java/hudson/plugins/mercurial/MercurialSCM.java#L366

            Show
            cjo9900 cjo9900 added a comment - The core functionality of the SCM Trigger.poll() does not allow triggers to receive parameters, but the post-commit hooks can receive them. In the case you describe you pass the the revision Id as the branch, and this is not taken into account during polling as the poll methods cannot use this information. There are two features here that could be implemented: 1. Pass a named branch via post commit message and then trigger polling only on the jobs that have branch set in their config. Add additional checks to MercurialStatus Class [1] for branchId. 2. Checkout a particular revision in a triggered job. Create a Revision Action in the MercurialStatus class [1] that is added to the build when started, if polling triggers it. that is fetched during the checkout() [2] phase of the SCM process, and sets the workspace to that revision. Similar to how the Subversion plugin does it. Removing core and parameterized-trigger components as this is a Mercurial plugin only issue. [1] https://github.com/jenkinsci/mercurial-plugin/blob/master/src/main/java/hudson/plugins/mercurial/MercurialStatus.java [2] https://github.com/jenkinsci/mercurial-plugin/blob/master/src/main/java/hudson/plugins/mercurial/MercurialSCM.java#L366
            Hide
            sirianni Eric Sirianni added a comment -

            Seems like the Git SCM plugin has fixed this issue by using the default value of any parameters (see JENKINS-14276).

            Show
            sirianni Eric Sirianni added a comment - Seems like the Git SCM plugin has fixed this issue by using the default value of any parameters (see JENKINS-14276 ).

              People

              • Assignee:
                jglick Jesse Glick
                Reporter:
                iristyle Iristyle
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: