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

Workflow integration for Parameterized Trigger

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Currently hudson.plugins.parameterizedtrigger.BuildTriggerConfig and related classes is designed to assume that the downstream project is an AbstractProject, preventing it from triggering a WorkflowJob in schedule (see also perform, perform2, DescriptorImpl.doCheckProjects, etc.).

      This could probably be relaxed by just checking for a Job & Queue.Task from which you can schedule a job with a little difficulty (check ParameterizedJob.getQuietPeriod and Job.isBuildable); or perhaps SCMTriggerItem whose scheduleBuild2 is more convenient.

      Should work smoothly for TriggerBuilder. For BuildTrigger, can work to the extent that canDeclare is made to be false, so that the triggering is done explicitly rather than via DependencyDeclarer (and thus the DependencyGraph, which at least for now is restricted to AbstractProject).

        Attachments

          Issue Links

            Activity

            Hide
            ikedam ikedam added a comment -

            Problems happen when simply replaced AbstractProject to Job:

            • Job doesn't provide scheduleBuild2 (in BuildTriggerConfig#schedule)
            • Job doesn't provide getQueuePeriod (in BuildTriggerConfig#schedule)
            • Job doesn't provide findNearest (in BuildTriggerConfig.DescriptorImpl#doCheckProjects)
            • DependencyGraph works only for AbstractProject.
            Show
            ikedam ikedam added a comment - Problems happen when simply replaced AbstractProject to Job : Job doesn't provide scheduleBuild2 (in BuildTriggerConfig#schedule ) Job doesn't provide getQueuePeriod (in BuildTriggerConfig#schedule ) Job doesn't provide findNearest (in BuildTriggerConfig.DescriptorImpl#doCheckProjects ) DependencyGraph works only for AbstractProject .
            Hide
            ikedam ikedam added a comment -

            What I cannot understand:

            • WorkflowJob doesn't inherit AbstractProject.
            • AbstractProject doesn't implements SCMTriggerItem.
              • SCMTriggerItem (since Jenkins 1.568) provides scheduleBuild2 and getQuietPeriod, and looks a good replacement for AbstractProject.
            • DependencyGraph works only for AbstractProject.
              • Does workflow-plugin provides alternate way to define dependencies between workflow projects?
            Show
            ikedam ikedam added a comment - What I cannot understand: WorkflowJob doesn't inherit AbstractProject . AbstractProject doesn't implements SCMTriggerItem . SCMTriggerItem (since Jenkins 1.568) provides scheduleBuild2 and getQuietPeriod , and looks a good replacement for AbstractProject . DependencyGraph works only for AbstractProject . Does workflow-plugin provides alternate way to define dependencies between workflow projects?
            Hide
            jglick Jesse Glick added a comment -

            Job doesn't provide scheduleBuild2

            Job doesn't provide getQueuePeriod [getQuietPeriod?]

            ParameterizedJobMixIn provides both. SCMTriggerItem is not appropriate here.

            Job doesn't provide findNearest

            This should really be deprecated, and callers directed to use the more general Items.findNearest.

            DependencyGraph works only for AbstractProject.

            True; until this core refactoring is done, this mode would simply not be supported for workflows. See the third paragraph of my original description.

            AbstractProject doesn't implements SCMTriggerItem

            It is implement by Project. At any rate, as above, do not pay attention to this interface here.

            Does workflow-plugin provides alternate way to define dependencies between workflow projects?

            Other than the fact that a workflow can build another and provide an UpstreamCause, no, there is no DependencyGraph support. Again, for TriggerBuilder (and one mode of BuildTrigger) this does not matter.

            Show
            jglick Jesse Glick added a comment - Job doesn't provide scheduleBuild2 Job doesn't provide getQueuePeriod [getQuietPeriod?] ParameterizedJobMixIn provides both. SCMTriggerItem is not appropriate here. Job doesn't provide findNearest This should really be deprecated, and callers directed to use the more general Items.findNearest . DependencyGraph works only for AbstractProject. True; until this core refactoring is done, this mode would simply not be supported for workflows. See the third paragraph of my original description. AbstractProject doesn't implements SCMTriggerItem It is implement by Project . At any rate, as above, do not pay attention to this interface here. Does workflow-plugin provides alternate way to define dependencies between workflow projects? Other than the fact that a workflow can build another and provide an UpstreamCause , no, there is no DependencyGraph support. Again, for TriggerBuilder (and one mode of BuildTrigger ) this does not matter.
            Hide
            jglick Jesse Glick added a comment -
            Show
            jglick Jesse Glick added a comment - https://github.com/jenkinsci/build-token-root-plugin/commit/e859e2f1cb51b203f8e13932f76ac0a69b2e75e5 may be helpful as an example of ParameterizedJobMixIn usage.
            Hide
            mabahj Markus added a comment - - edited

            Any one that has a workaround for the lack of Workflow integration for Parameterized Trigger? The triggering can be solved, but I have problems passing parameters to a downstream Workflow without the Parameterized Trigger plugin. ("Who actually triggered me?")

            Edit: My workaround seems to be set up the downstream workflow job as a normal parametrized job. These parameters are available directly as variables. I'll then use the REST API and curl to trigger the "downstream" job with parameters.

            Show
            mabahj Markus added a comment - - edited Any one that has a workaround for the lack of Workflow integration for Parameterized Trigger? The triggering can be solved, but I have problems passing parameters to a downstream Workflow without the Parameterized Trigger plugin. ("Who actually triggered me?") Edit: My workaround seems to be set up the downstream workflow job as a normal parametrized job. These parameters are available directly as variables. I'll then use the REST API and curl to trigger the "downstream" job with parameters.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Sam Van Oort
            Path:
            pom.xml
            src/main/java/hudson/plugins/parameterizedtrigger/BlockableBuildTriggerConfig.java
            src/main/java/hudson/plugins/parameterizedtrigger/BuildTrigger.java
            src/main/java/hudson/plugins/parameterizedtrigger/BuildTriggerConfig.java
            src/main/java/hudson/plugins/parameterizedtrigger/DefaultParameterValuesActionsTransform.java
            src/main/java/hudson/plugins/parameterizedtrigger/ITransformProjectParametersAction.java
            src/main/java/hudson/plugins/parameterizedtrigger/ProjectSpecificParameterValuesActionTransform.java
            src/main/java/hudson/plugins/parameterizedtrigger/ProjectSpecificParametersActionFactory.java
            src/main/java/hudson/plugins/parameterizedtrigger/TriggerBuilder.java
            src/main/resources/hudson/plugins/parameterizedtrigger/BuildTriggerConfig/config.jelly
            src/test/java/hudson/plugins/parameterizedtrigger/test/BuildTriggerConfigTest.java
            src/test/java/hudson/plugins/parameterizedtrigger/test/TriggerBuilderTest.java
            http://jenkins-ci.org/commit/parameterized-trigger-plugin/5f0492121b03f68000f85ec04340a853e660ed59
            Log:
            Merge pull request #87 from svanoort/feature-workflow-compatibility

            JENKINS-26050 Fix Workflow compatibility for Parameterized Trigger

            Compare: https://github.com/jenkinsci/parameterized-trigger-plugin/compare/df0ee6e4a68b...5f0492121b03

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Sam Van Oort Path: pom.xml src/main/java/hudson/plugins/parameterizedtrigger/BlockableBuildTriggerConfig.java src/main/java/hudson/plugins/parameterizedtrigger/BuildTrigger.java src/main/java/hudson/plugins/parameterizedtrigger/BuildTriggerConfig.java src/main/java/hudson/plugins/parameterizedtrigger/DefaultParameterValuesActionsTransform.java src/main/java/hudson/plugins/parameterizedtrigger/ITransformProjectParametersAction.java src/main/java/hudson/plugins/parameterizedtrigger/ProjectSpecificParameterValuesActionTransform.java src/main/java/hudson/plugins/parameterizedtrigger/ProjectSpecificParametersActionFactory.java src/main/java/hudson/plugins/parameterizedtrigger/TriggerBuilder.java src/main/resources/hudson/plugins/parameterizedtrigger/BuildTriggerConfig/config.jelly src/test/java/hudson/plugins/parameterizedtrigger/test/BuildTriggerConfigTest.java src/test/java/hudson/plugins/parameterizedtrigger/test/TriggerBuilderTest.java http://jenkins-ci.org/commit/parameterized-trigger-plugin/5f0492121b03f68000f85ec04340a853e660ed59 Log: Merge pull request #87 from svanoort/feature-workflow-compatibility JENKINS-26050 Fix Workflow compatibility for Parameterized Trigger Compare: https://github.com/jenkinsci/parameterized-trigger-plugin/compare/df0ee6e4a68b...5f0492121b03
            Hide
            svanoort Sam Van Oort added a comment -
            Show
            svanoort Sam Van Oort added a comment - Resolved with https://github.com/jenkinsci/parameterized-trigger-plugin/pull/87 As of version 2.28
            Hide
            veen Vegard Endresen added a comment -

            Version 2.28 works, nice!

            As a comment the upstream/downstream relationships is not visible in the web browser/API. I think this would be nice to have.

            Show
            veen Vegard Endresen added a comment - Version 2.28 works, nice! As a comment the upstream/downstream relationships is not visible in the web browser/API. I think this would be nice to have.
            Hide
            jglick Jesse Glick added a comment -

            the upstream/downstream relationships is not visible in the web browser/API

            This is not possible from the plugin currently since DependencyGraph is currently limited to AbstractProject. I filed JENKINS-29913 to track it.

            Show
            jglick Jesse Glick added a comment - the upstream/downstream relationships is not visible in the web browser/API This is not possible from the plugin currently since DependencyGraph is currently limited to AbstractProject . I filed JENKINS-29913 to track it.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            COMPATIBILITY.md
            http://jenkins-ci.org/commit/workflow-plugin/ad0ae293d06a22284930bf6bb4f7096b2f357771
            Log:
            JENKINS-26050 Noting release.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: COMPATIBILITY.md http://jenkins-ci.org/commit/workflow-plugin/ad0ae293d06a22284930bf6bb4f7096b2f357771 Log: JENKINS-26050 Noting release.
            Hide
            qtruong77 Quang Truong added a comment -

            Should we add update to BuildInfoExporterAction.java to support for Workflow too? We still use AbstractProject and AbstractBuild instead of Job and Run so BuildInfoExporterAction.getTriggeredProjects() and BuildInfoExporterAction.getTriggeredBuilds() will return a non-empty list but the workflow item is a null item.

            Show
            qtruong77 Quang Truong added a comment - Should we add update to BuildInfoExporterAction.java to support for Workflow too? We still use AbstractProject and AbstractBuild instead of Job and Run so BuildInfoExporterAction.getTriggeredProjects() and BuildInfoExporterAction.getTriggeredBuilds() will return a non-empty list but the workflow item is a null item.

              People

              • Assignee:
                svanoort Sam Van Oort
                Reporter:
                jglick Jesse Glick
              • Votes:
                15 Vote for this issue
                Watchers:
                21 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: