question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dsl-testing :: javaposse.jobdsl.dsl.DslScriptException with OrganizationFolder

See original GitHub issue
  • Jenkins version ‘2.222.4’

  • Plugin version ‘2.7.0’

Description

trying to establish testing for our job-dsl scripts we are running into issues with plugin bitbucket-branch-source. Using the job-dsl playground http://job-dsl.herokuapp.com/ with the following snippet we see the very same exception we get in our test-setup.

job-dsl snippet

organizationFolder('foo') {
    displayName('Foobar')

    organizations {
        bitbucket {
            serverUrl('https://stash.foobar.com')
            repoOwner('foo')
            credentialsId('stash-token')

            traits {
                sourceWildcardFilter {
                    includes('sample-project')
                    excludes('')
                }
            }
        }
    }
}

exception

javaposse.jobdsl.dsl.DslScriptException: (script, line 5) No signature of method: javaposse.jobdsl.dsl.helpers.workflow.ScmNavigatorsContext.bitbucket() is applicable for argument types: (script$_run_closure1$_closure2$_closure3) values: [script$_run_closure1$_closure2$_closure3@756dbb50]

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
jam01commented, Jan 8, 2021

Did you happen to solve this? Seeing the same issue with gitea, and wondering if it might be related.

0reactions
pniederlagcommented, Nov 5, 2022

Working Example

#!/usr/bin/env groovy
organizationFolder('example-org-folder') {
    displayName('Org Folder')
    description('automatic Jenkinsfile processing for org folder')
    organizations {
        bitbucket {
            credentialsId('my-credential-id')
            repoOwner('XYZ')
            serverUrl('https://fancy.example.com')
            traits {
              // - nonsense, due to traits with same name in different scopes, see configure block below
            }
        }
    }
    //projectFactories {
    //  workflowMultiBranchProjectFactory {
    //    scriptPath('Jenkinsfile')
    //  }
    //}
    orphanedItemStrategy {
        discardOldItems {
            daysToKeep(7)
            numToKeep(3)
        }
    }
    // discover Branches (workaround due to JENKINS-46202)
    configure { node ->
        // node represents <jenkins.branch.OrganizationFolder>
        def traits = node / 'navigators' / 'com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMNavigator' / 'traits'
        traits << 'com.cloudbees.jenkins.plugins.bitbucket.BranchDiscoveryTrait' {
           strategyId(3) // detect all branches
        }
        traits << 'com.cloudbees.jenkins.plugins.bitbucket.OriginPullRequestDiscoveryTrait' {
          strategyId(1)
        }
        traits << 'com.cloudbees.jenkins.plugins.bitbucket.TagDiscoveryTrait' {

        }
        traits << 'jenkins.plugins.git.traits.CloneOptionTrait' {
          // we must add something else than only noTags(false) in order to get it working
          'extension'(class: 'hudson.plugins.git.extensions.impl.CloneOption') {
            noTags(false)
            honorRefspec(false)
            timeout("15")
            shallow(false)
            reference("")
            depth(0)
          }
        }

        // Set child scan triggers to 15 minutes
        node / 'properties' << 'jenkins.branch.OrganizationChildTriggersProperty' {
          templates {
            'com.cloudbees.hudson.plugins.folder.computed.PeriodicFolderTrigger' {
              spec('H/5 * * * *')
              interval('900000')
            }
          }
        }

        // Add build strategies
        node / 'buildStrategies' << 'jenkins.branch.buildstrategies.basic.AllBranchBuildStrategyImpl' {
          strategies {
            'jenkins.branch.buildstrategies.basic.AnyBranchBuildStrategyImpl' {
              strategies {
                'jenkins.branch.buildstrategies.basic.TagBuildStrategyImpl' {
                  atLeastMillis(-1)
                  atMostMillis(604800000)
                }
                'jenkins.branch.buildstrategies.basic.BranchBuildStrategyImpl' {}
              }
            }
            'jenkins.branch.buildstrategies.basic.SkipInitialBuildOnFirstBranchIndexing' {}
          }
        }
    }
    //properties {
      //organizationChildTriggersProperty {
      //  periodicFolderTrigger {
      //    interval("15m")
      //  }
      //}
    //}
    triggers {
      periodicFolderTrigger {
        interval("1d")
      }
    }
}

Read more comments on GitHub >

github_iconTop Results From Across the Web

Missing DSL for NoTriggerOrganizationFolderProperty
While trying the implement DSL configuration using Bitbucket Branch, I'm not able to implement NoTriggerOrganizationFolderProperty propertie. ERROR: (script, ...
Read more >
DslScriptLoader to test Automatically generated DSL
I am using gradle to test that groovy scripts are valid and building. One of my scripts contains an element representing an 'Automatically...
Read more >
organizationFolder - Jenkins Job DSL Plugin
Creates or updates an organization folder job. Examples. organizationFolder('example') { description('This contains branch source jobs for Bitbucket and GitHub') ...
Read more >
gradle test fail when using slackNotifier in Jenkins Job DSL ...
removed incorrect reply. EDIT. I see I missed the point. The new approach is to reuse the @DataBoundConstructor exposed by plugins, ...
Read more >
Job DSL and organizationFolder with Github : r/jenkinsci
I am trying to config my OrganizationFolder using Job DSL using configuration because of this ticket . My problem is the configuration block ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found