Closed ZeBidule closed 4 years ago
Don't use >
it becomes one long string.
Use |
a literal block
Also this seems more like a Job DSL issue 😓
I'd suggest using file
or url
block instead
jobs:
- file: /src/jobdsl/organisations.groovy
OK thanks for your really quick answers :)
I have tried the both solutions and i still have the same error :
groovy.lang.MissingMethodException: No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.traits() is applicable for argument types: (script$_run_closure1$_closure2$_closure3$_closure4) values: [script$_run_closure1$_closure2$_closure3$_closure4@39a9c913]
Downgrade cloudbees-bitbucket-branch-source to something before 2.6.0 😓
OK, i try the downgrade...
I manage to avoid the error by removing the traits
section and replacing it with the none declarative-compatible syntax but I doesn't work for the recursiveSubmodules
option :
jobs:
- script: >
organizationFolder('Bitbucket Organization Folder') {
description("Bitbucket orga folder configured with JCasC")
displayName('My Project')
organizations {
bitbucket {
serverUrl("https://$BITBUCKET_URL")
repoOwner("OWN")
credentialsId("bitbucket-http")
}
}
// "Traits" ("Behaviours" in the GUI) that are NOT "declarative-compatible"
// For some 'traits, we need to configure this stuff by hand until JobDSL handles it
// https://issues.jenkins.io/browse/JENKINS-45504
configure { node ->
def traits = node / navigators / 'com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMNavigator' / traits
traits << 'com.cloudbees.jenkins.plugins.bitbucket.BranchDiscoveryTrait' {
strategyId('3')
}
traits << 'com.cloudbees.jenkins.plugins.bitbucket.SSHCheckoutTrait' {
credentialsId('bitbucket-ssh')
}
traits << 'jenkins.scm.impl.trait.WildcardSCMSourceFilterTrait' {
includes('myjob')
excludes('')
}
traits << 'com.cloudbees.jenkins.plugins.bitbucket.WebhookRegistrationTrait' {
mode('ITEM')
}
traits << 'jenkins.plugins.git.traits.SubmoduleOptionTrait' {
extension << 'hudson.plugins.git.extensions.impl.SubmoduleOption' {
recursiveSubmodules('true')
}
}
}
Ok the declarative-compatible traits syntax works with cloudbees-bitbucket-branch-source version 2.5.0 so the regression appeared in version 2.6.0. Sorry for the inconvenience, I just figure out that an issue was already created in their repository : https://github.com/jenkinsci/bitbucket-branch-source-plugin/issues/258
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Should be fixed in recent version of cloudbees-bitbucket-branch-source https://github.com/jenkinsci/bitbucket-branch-source-plugin/releases/tag/cloudbees-bitbucket-branch-source-2.7.0
Description
Got
groovy.lang.MissingMethodException: No signature of method
(see stack trace attached: error_casc.log) when applying the following job DSL configuration extracted from your bitbucket example :