Same as JENKINS-48336 and JENKINS-48337, traits is not implemented to be used with DSL.

      Workaround is to use configure blocks:

      configure { organizationFolder ->
              organizationFolder / navigators / 'com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMNavigator' / traits << 'com.cloudbees.jenkins.plugins.bitbucket.BranchDiscoveryTrait'{
                  strategyId('3')
              }
          }
          configure { organizationFolder ->
              organizationFolder / navigators / 'com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMNavigator' / traits << 'com.cloudbees.jenkins.plugins.bitbucket.OriginPullRequestDiscoveryTrait'{
                  strategyId('2')
              }
          }
          configure { organizationFolder ->
              organizationFolder / navigators / 'com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMNavigator' / traits << 'com.cloudbees.jenkins.plugins.bitbucket.ForkPullRequestDiscoveryTrait'{
              strategyId('2')
              }
          }
          configure { organizationFolder ->
              organizationFolder / navigators / 'com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMNavigator' / traits << 'com.cloudbees.jenkins.plugins.bitbucket.SSHCheckoutTrait'{
                  credentialsId('my_id')
              }
          }
          configure { organizationFolder ->
              organizationFolder / navigators / 'com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMNavigator' / traits << 'com.cloudbees.jenkins.plugins.bitbucket.WebhookRegistrationTrait'{
                  mode('DISABLE')
              }
          }
      

          [JENKINS-48360] Missing DSL for traits

          Nuno Costa created issue -

          Stefan Bethke added a comment -

          There's more traits missing: ForkPullRequestDiscoveryTrait, BranchDiscoveryTrait, and probably more. I could not figure out why some traits show up in the API explorer while others do not. Otherwise, I'd be happy to prepare a pull request.

          Stefan Bethke added a comment - There's more traits missing: ForkPullRequestDiscoveryTrait, BranchDiscoveryTrait, and probably more. I could not figure out why some traits show up in the API explorer while others do not. Otherwise, I'd be happy to prepare a pull request.
          Daniel Spilker made changes -
          Link New: This issue duplicates JENKINS-45860 [ JENKINS-45860 ]
          Daniel Spilker made changes -
          Resolution New: Duplicate [ 3 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          Daniel Spilker made changes -
          Status Original: Resolved [ 5 ] New: Closed [ 6 ]

            daspilker Daniel Spilker
            ncosta Nuno Costa
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: