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

programatically add GitHub Enterprise Servers in Jenkins

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • Jenkins ver. 2.138
      Blueocean 1.8.2
      GitHub Branch Source 2.3.6

       
      Hi,

       

      I cannot reproduce programatically this action: Manage Jenkins -> Configure System -> GitHub Enterprise Servers -> Add

      How can I do this in groovy?

      My attempt is:

      import org.jenkinsci.plugins.github_branch_source.Endpoint
      import org.jenkinsci.plugins.github_branch_source.GitHubConfiguration
      
      Endpoint endpoint = new Endpoint("http://test.com", "test")
      GitHubConfiguration ghc = new GitHubConfiguration()
      ghc.addEndpoint(endpoint)
      ghc.save()

      But it doesnt create required configuration.

       UPDATE
      in jenkins_home directory I can see file 

      org.jenkinsci.plugins.github_branch_source.GitHubConfiguration.xml with following content:

      <?xml version='1.1' encoding='UTF-8'?>
      <org.jenkinsci.plugins.github__branch__source.GitHubConfiguration plugin="github-branch-source@2.3.6">
        <endpoints>
          <org.jenkinsci.plugins.github__branch__source.Endpoint>
            <name>test</name>
            <apiUri>http://test.com</apiUri>
          </org.jenkinsci.plugins.github__branch__source.Endpoint>
        </endpoints>
      </org.jenkinsci.plugins.github__branch__source.GitHubConfiguration>

      But I still cannot see anything in Jenkins -> Manage Jenkins page.

            lanwen Kirill Merkushev
            spugachev Stanislav Pugachov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: