example of github organizationFolder DSL

1,125 views
Skip to first unread message

Edward Raigosa

unread,
Sep 11, 2017, 12:10:39 PM9/11/17
to job-dsl-plugin
Hi,   I'm trying to setup github job creation dsl for the context organizationFolder so that any of my github projects that has a Jenkinsfile can automatically get a build job.

I'm looking for examples on the latest for how to do this with the 1.65 plugin.
I'm hoping someone can share how to do this with the github {} context inside organizations {}.

In particular, I'm looking for a way to configure the additional behaviors under github called:

Discover branches
Discover pull requests from forks  & trust
Discover pull requests from origin
Filter by name (with regular expression)

I've tried a few permutations with fromSources{} and traits{} however, this only seems to configure single known repos, and I'm looking for something a little more dynamic.

Any help would be appreciated.

Thanks!

Carlos Tadeu Panato Jr

unread,
Sep 12, 2017, 4:38:29 AM9/12/17
to job-dsl-plugin
did you try something like this?

organizationFolder(String name) {
  organizations {
    github {
      repoOwner(repo owner name)
      apiUri("")
      buildForkPRMerge(true)
      buildOriginBranch(true)
      buildOriginBranchWithPR(true)
      buildOriginPRHead(boolean value)
      buildOriginPRMerge(true)
      credentialsId(your creds)
      scanCredentialsId(your creds)

      excludes(String value) // to exclude branchs to not build
      includes(String value) // to allow branchs to build
      pattern(String value) // or a pattern

Edward Raigosa

unread,
Sep 14, 2017, 4:41:41 PM9/14/17
to job-dsl-plugin
Thanks Carlos, 

Yep thats the standard one I was testing with, but it didn't seem to update the behaviors anymore...at least not in the latest release.  Was wondering if others were seeing that as well.

Edward

Daniel Spilker

unread,
Oct 5, 2017, 2:59:19 PM10/5/17
to job-dsl...@googlegroups.com
These "behaviors" are called "traits" internally. See organizationFolder -> organizations -> fromSource -> sources -> github -> traits in the embedded API viewer.

Currently it's not possible to configure all traits. That's tracks as JENKINS-45504.

Daniel

--
You received this message because you are subscribed to the Google Groups "job-dsl-plugin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to job-dsl-plugin+unsubscribe@googlegroups.com.
To post to this group, send email to job-dsl-plugin@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/job-dsl-plugin/b73265df-bf6b-4d31-9a2b-ade05adb1719%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages