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

'github' credentialId doesn't work when creating GitHub org folder

XMLWordPrintable

    • pannonian, iapetus

      As reported by cliffmeyers:

      I've been working on the Github Creation API and have the first simplest flow wired up for creating an org folder. I am encountering a problem although I found the workaround for it. I wanted to run it by you to see what you think.

      First the UI calls this endpoint to get the credential that I previously created:
      http://localhost:8080/jenkins/blue/rest/organizations/jenkins/scm/github/

      It returns an object like this (omitting _class and _links)

      {
          "credentialId": "github",
          "id": "github",
          "uri": "https://api.github.com"
      }
      

      Then I make a call to fetch the orgs which works fine:
      http://localhost:8080/jenkins/blue/rest/organizations/jenkins/scm/github/organizations/?credentialId=github

      Then when I make the creation call I send an object like this:

      {
          "name": "cliffmeyers",
          "$class": "io.jenkins.blueocean.blueocean_github_pipeline.GithubPipelineCreateRequest",
          "scmConfig": {
              "uri": "https://api.github.com",
              "config": {
                  "orgName": "cliffmeyers",
                  "repos": []
              }
          }
      }
      

      This works fine. However if I add the credentialId: 'github' to this it fails saying invalid credential.

            vivek Vivek Pandey
            vivek Vivek Pandey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: