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

implement organizationChildTriggersProperty

    XMLWordPrintable

Details

    Description

      would be great to configure organizationChildTriggersProperty via CasC, like so maybe?

       

      organizationChildTriggersProperty {
         templates {
           interval('1h')
         }
      }

       

      Attachments

        Issue Links

          Activity

            I tried the following;

            properties {
                organizationChildTriggersProperty {
                  periodicFolderTrigger {
                    interval('5m')
                  }
                }
              }
            

            and got this error:

            19:54:09 ERROR: (bitbucket.groovy, line 61) No signature of method: periodicFolderTrigger() is applicable for argument types:
            

            When I look at job-DSL api guide in my instance `organizationChildTriggersProperty` is listed, but it has no properties listed underneath it.
            Is there perhaps a missing `@DataBoundConstructor` in the code to expose the triggers?
            https://github.com/jenkinsci/branch-api-plugin/blob/master/src/main/java/jenkins/branch/OrganizationChildTriggersProperty.java#L67

            broon_nick Nicholas Brown added a comment - I tried the following; properties { organizationChildTriggersProperty { periodicFolderTrigger { interval('5m') } } } and got this error: 19:54:09 ERROR: (bitbucket.groovy, line 61) No signature of method: periodicFolderTrigger() is applicable for argument types: When I look at job-DSL api guide in my instance `organizationChildTriggersProperty` is listed, but it has no properties listed underneath it. Is there perhaps a missing `@DataBoundConstructor` in the code to expose the triggers? https://github.com/jenkinsci/branch-api-plugin/blob/master/src/main/java/jenkins/branch/OrganizationChildTriggersProperty.java#L67
            broon_nick Nicholas Brown added a comment - Looks like someone asked something similar here: https://gitter.im/jenkinsci/configuration-as-code-plugin?at=5d434c8c7a151629e107ea94

            The problem is that the @DataBoundConstructor in jenkins.branch.OrganizationChildTriggersProperty uses type parameters which are not supported by Structs plugin (JENKINS-26535).

            As a workaround, the constructor could probably be changed to List<Trigger> templates.

            https://github.com/jenkinsci/branch-api-plugin/blob/branch-api-2.5.7/src/main/java/jenkins/branch/OrganizationChildTriggersProperty.java#L80

            daspilker Daniel Spilker added a comment - The problem is that the @DataBoundConstructor in jenkins.branch.OrganizationChildTriggersProperty uses type parameters which are not supported by Structs plugin ( JENKINS-26535 ). As a workaround, the constructor could probably be changed to List<Trigger> templates . https://github.com/jenkinsci/branch-api-plugin/blob/branch-api-2.5.7/src/main/java/jenkins/branch/OrganizationChildTriggersProperty.java#L80

            I wonder if there is work around in job DSL using a `configure { }` statement to set organizationChildTriggersProperty ?

             
            JENKINS-26535 and https://github.com/jenkinsci/structs-plugin/pull/52 don't look like they'll be fixed any time soon.

            nickbrown Nicholas Brown added a comment - I wonder if there is work around in job DSL using a `configure { }` statement to set organizationChildTriggersProperty ?   JENKINS-26535  and https://github.com/jenkinsci/structs-plugin/pull/52  don't look like they'll be fixed any time soon.
            gp8 Gijo added a comment -

            You may try this for DSL configure method:

             configure { node ->
                 def templates = node / 'properties' / 'jenkins.branch.OrganizationChildHealthMetricsProperty' / templates
                 templates << 'com.cloudbees.hudson.plugins.folder.health.WorstChildHealthMetric' {
                     nonRecursive false
                 }
             }
             configure { node ->
                 def templates = node / 'properties' / 'jenkins.branch.OrganizationChildTriggersProperty' / templates
                 templates << 'com.cloudbees.hudson.plugins.folder.computed.PeriodicFolderTrigger' {
                     spec('* * * * *')
                     interval('300000')
                 }
             }
            
            
            gp8 Gijo added a comment - You may try this for DSL configure method: configure { node -> def templates = node / 'properties' / 'jenkins.branch.OrganizationChildHealthMetricsProperty' / templates templates << 'com.cloudbees.hudson.plugins.folder.health.WorstChildHealthMetric' { nonRecursive false } } configure { node -> def templates = node / 'properties' / 'jenkins.branch.OrganizationChildTriggersProperty' / templates templates << 'com.cloudbees.hudson.plugins.folder.computed.PeriodicFolderTrigger' { spec( '* * * * *' ) interval( '300000' ) } }

            People

              lifeofguenter Günter Grodotzki
              lifeofguenter Günter Grodotzki
              Votes:
              4 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated: