organizationFolder and githubPush trigger

25 views
Skip to first unread message

Rod Oliver

unread,
Dec 22, 2022, 7:27:41 AM12/22/22
to job-dsl-plugin
I am running Jenkins v2.361.4 with Job DSL plugin v1.81 and GitHub plugin v1.36.0. I am able to setup an organizational folder with JobDSL against my company's GHE instance with the DSL below.

organizationFolder('myorg') {
  displayName('Pipeline development GitHub organisation')
  description('tPipeline development GitHub organisation')
  organizations {
    github {
      repoOwner('myorg')
      apiUri('https://github.example.com/api/v3')
      credentialsId('github-cnd-ci-dev-su')
      traits {
        gitHubBranchDiscovery{
          strategyId(3)
        }
        gitHubPullRequestDiscovery{
          strategyId(3)
        }
        headWildcardFilter {
          excludes('')
          includes('')
        }
      }
    }
  }
}


According to "https://<Jenkins URK>/plugin/job-dsl/api-viewer/index.html#path/organizationFolder-triggers" "githubPush()" is available. However when I update the DSL to that below:

organizationFolder('myorg') {
  displayName('Pipeline development GitHub organisation')
  description('tPipeline development GitHub organisation')
  organizations {
    github {
      repoOwner('myorg')
      apiUri('https://github.example.com/api/v3')
      credentialsId('github-cnd-ci-dev-su')
      traits {
        gitHubBranchDiscovery{
          strategyId(3)
        }
        gitHubPullRequestDiscovery{
          strategyId(3)
        }
        headWildcardFilter {
          excludes('')
          includes('')
        }
      }
    }
  }
  triggers {
    githubPush()
  }
 
}


I get an error in Jenkins (which runs the pipeline to execute the JOb DSL script "java.lang.ClassCastException: class jenkins.branch.OrganizationFolder cannot be cast to class hudson.model.Job (jenkins.branch.OrganizationFolder is in unnamed module of loader jenkins.util.URLClassLoader2 @35d00cd9; hudson.model.Job is in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @4264b240)".

Can anyone suggest a reason for this and a mechanism to trigger an organization scan when there is a push in GitHub?

Rod
Reply all
Reply to author
Forward
0 new messages