Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-46202

Cannot discover all GitHub repos and their branches with Job DSL anymore

XMLWordPrintable

      Using the job DSL plugin v. 1.64, I can't automatically discover all my repositories and all it's branches within my GitHub organization folder.

      I used the job DSL plugin v. 1.61 before.

       

      organizationFolder('myOrg') {
        triggers {
          periodic(10)
        }
        organizations {
          github {
            apiUri("")
            repoOwner("myOrg")
            scanCredentialsId("github")
            checkoutCredentialsId("github")
          }
        }
      }

       

      This is the configuration view after executing the above script


      scanCredentialsId("") and checkoutCredentialsId("") are now deprecated and replaced by credentialsId("github"). Now, the credentials work. But discovering all repositories and their branches doesn't seem to be possible anymore because the "includes", "excludes" methods also have been deprecated.
      Now, with the following, fixed script, I don't get all the branches anymore:

       

      organizationFolder('myOrg') {
        triggers {
          periodic(10)
        }
        organizations {
          github {
            repoOwner("myOrg")
            credentialsId("github")
          }
        }
      }

       

      This is the configuration page after executing the new script:

      I now manually need to add the checkout behaviour "Discover branches -> All branches"

      How can I automatically discover all repos and their branches using the DSL script?

      I also tried the "fromSource" syntax as this one seems to have more options.

       

      organizationFolder('myOrg') {
        triggers {
          periodic(10)
        }
        organizations {
          fromSource {
            name("myOrg")
            sources {
              github {
                credentialsId("github")
                repoOwner("myOrg")
                repository("")
              }
            }
          }
        }
      }
      

       

      As you can see, I have tried to leave the string in the repository("") method empty, hoping that would cause it to discover all repos within my organization. I also tried asterisk: repository("*") which also led to an error.

            Unassigned Unassigned
            spiderfox Christian H
            Votes:
            1 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: