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.

        1. image-2017-08-15-13-25-53-698.png
          71 kB
          Christian H
        2. image-2017-08-15-13-29-22-823.png
          27 kB
          Christian H
        3. image-2017-08-15-13-31-29-296.png
          31 kB
          Christian H
        4. image-2017-08-15-13-39-11-179.png
          31 kB
          Christian H
        5. image-2017-08-15-13-40-17-137.png
          31 kB
          Christian H
        6. multibranch-config-manual.xml
          4 kB
          Steffen Gebert

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

              Created:
              Updated:
              Resolved: