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')
}
}