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

missing elements in job dsl 'organizationFolder'

    Details

    • Type: Improvement
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: job-dsl-plugin
    • Labels:
      None
    • Environment:
      Jenkins:2.138.2
      job-dsl:1.70
      cloudbees-bitbucket-branch-source:2.2.15
      basic-branch-build-strategies:1.1.1
    • Similar Issues:
    • Released As:
      job-dsl 1.75

      Description

      While configuring our bitbucket organization folder, I came across a couple of places where I needed to use the configure block because it did not work the way I expected:

      • 'organizationFolder' / 'triggers' / 'periodic' not working as expected, no matter what value I use, it always falls back to 1 minute
      • 'organizationFolder' / 'traits' does not support BranchDiscoveryTrait
      • 'organizationFolder' does not support 'buildStrategies'
      organizationFolder('org') {
          description('This contains branch source jobs for Bitbucket')
          displayName('org')
          // triggers {
          //     // not working, using configure block below
          //     periodic(28800000)
          // }
          organizations {
              bitbucket {
                repoOwner('myorg')
                credentialsId('BITBUCKET_CRED')
                traits {
                   // BranchDiscoveryTrait not available using configure block below
                }
              }
          }
          // buildStrategies not available using configure block below
      
          // discover Branches (workaround due to JENKINS-46202)
          configure { node ->
              // node represents <jenkins.branch.OrganizationFolder>     
      
              // Behaviours > 'Discover branches' > 'All branches'   
              def traits = node / 'navigators' / 'com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMNavigator' / 'traits'
              traits << 'com.cloudbees.jenkins.plugins.bitbucket.BranchDiscoveryTrait' {
                  strategyId(3) // detect all branches
              }
      
              // scan all repos at least once a day
              def triggers = node / 'triggers'
              triggers << 'com.cloudbees.hudson.plugins.folder.computed.PeriodicFolderTrigger' {
                  spec('H H * * *')
                  interval(86400000)
              }
      
              // make sure all branches get build
              def buildStrategies = node / 'buildStrategies' 
              buildStrategies << 'jenkins.branch.buildstrategies.basic.BranchBuildStrategyImpl' {}
          }    
      }
      

        Attachments

          Issue Links

            Activity

            Show
            daspilker Daniel Spilker added a comment - https://github.com/jenkinsci/job-dsl-plugin/pull/1185
            Hide
            daspilker Daniel Spilker added a comment -

            The periodic trigger will be fixed as part of JENKINS-55429.

            The problem with traits has already been reported as JENKINS-45504.

            Show
            daspilker Daniel Spilker added a comment - The periodic trigger will be fixed as part of JENKINS-55429 . The problem with traits has already been reported as JENKINS-45504 .

              People

              • Assignee:
                daspilker Daniel Spilker
                Reporter:
                imod Dominik Bartholdi
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: