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

Cannot configure Bitbucket ForkPullRequestDiscoveryTrait by using Job DSL dynamic API

      Bitbucket Branch Source plugin has introduced unique symbols, so we are able to configure traits by using Job DSL dynamic API instead of configure block. Unfortunately, ForkPullRequestDiscoveryTrait (bitbucketForkDiscovery) is unavailable. For now the only possible option is to still use configure block:

      branchSources {
          branchSource {
              source {
                  bitbucket {
                      bitbucketServerUrl('https://stash.server.org')
                      credentialsId('bitbucket-credentials')
                      repoOwner('TEST')
                      repository('test-repo')
                          traits {
                              bitbucketBranchDiscovery { strategyId(1) }
                              bitbucketPullRequestDiscovery { strategyId(2) }
                          }
                      }
                  }
              }
          }
      }
      configure {
          def traits = it / sources / data / 'jenkins.branch.BranchSource' / source / traits
          traits << 'com.cloudbees.jenkins.plugins.bitbucket.ForkPullRequestDiscoveryTrait' {
              strategyId(2)
          }
      }
      

      List of available traits in Job DSL Dynamic API Viewer:

      • bitbucketBranchDiscovery
      • bitbucketPublicRepoPullRequestFilter
      • bitbucketPullRequestDiscovery
      • bitbucketSshCheckout
      • bitbucketTagDiscovery
      • bitbucketWebhookConfiguration
      • bitbucketWebhookRegistration

      Missing:

      • bitbucketForkDiscovery ← missing, but possible to execute
      • bitbucketTrustNobody
      • bitbucketTrustTeam
      • bitbucketTrustProject
      • bitbucketTrustEveryone

      I tried:
      1)

      bitbucketForkDiscovery {
          strategyId(2)
          trust('bitbucketTrustTeam')
      } 
      
      groovy.lang.MissingMethodException: No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.trust() is applicable for argument types: (java.lang.String) values: [bitbucketTrustTeam]
      Possible solutions: print(java.lang.Object), use([Ljava.lang.Object;), getAt(java.lang.String), print(java.io.PrintWriter), wait(), dump()
      

      2)

      bitbucketForkDiscovery {
          strategyId(2)
          trust(bitbucketTrustTeam)
      } 
      
      groovy.lang.MissingPropertyException: No such property: bitbucketTrustTeam for class: javaposse.jobdsl.plugin.structs.DescribableContext
      

      3)

      bitbucketForkDiscovery {
          strategyId(2)
          trust(bitbucketTrustTeam())
      } 
      
      groovy.lang.MissingMethodException: No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.bitbucketTrustTeam() is applicable for argument types: () values: []
      

      4)

      bitbucketForkDiscovery {
          strategyId(2)
          trust {
              bitbucketTrustTeam()
          }
      } 
      
      groovy.lang.MissingMethodException: No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.trust() is applicable for argument types: (script$_run_closure1$_closure3$_closure8$_closure9$_closure10$_closure11$_closure14$_closure16) values: [script$_run_closure1$_closure3$_closure8$_closure9$_closure10$_closure11$_closure14$_closure16@6abb68ce]
      Possible solutions: print(java.lang.Object), use([Ljava.lang.Object;), print(java.io.PrintWriter), wait(), dump(), grep()
      

      5)

      bitbucketForkDiscovery {
          strategyId(2)
      } 
      
      javaposse.jobdsl.dsl.DslScriptException: (script, line 30) the following options are required and must be specified: trust
      

          [JENKINS-61119] Cannot configure Bitbucket ForkPullRequestDiscoveryTrait by using Job DSL dynamic API

          Robin Jansohn added a comment -

          I'll second this request. Something is still broken...

          Robin Jansohn added a comment - I'll second this request. Something is still broken...

          is blocked by JENKINS-26535

          Joseph Petersen (old) added a comment - is blocked by JENKINS-26535

          Daniel Steiert added a comment - - edited

          casz, I updated the link to reflect that fact. The linking was saying this ticket blocks JENKINS-26535, which is not the way it should be I guess, correct?

          Daniel Steiert added a comment - - edited casz , I updated the link to reflect that fact. The linking was saying this ticket blocks JENKINS-26535 , which is not the way it should be I guess, correct?

          We have the same problem. Where is the bump button?

          Daniel Steiert added a comment - We have the same problem. Where is the bump button?

          Mark Slipets added a comment -

          +1 to previous comment
          "We have the same problem. Where is the bump button?" huh??

          Mark Slipets added a comment - +1 to previous comment "We have the same problem. Where is the bump button?" huh??

          + same issue here. Would love to have JENKINS-26535 fixed...

          Valentin Delaye added a comment - + same issue here. Would love to have JENKINS-26535 fixed...

            jamietanna Jamie Tanna
            robin_smith Robin Smith
            Votes:
            7 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated: