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

GitHubCommitStatusSetter uses wrong credentials

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • github-plugin
    • None
    • github-plugin 1.34.1

      Our Setup:

      1. CloudBees CI Managed Controller and GitHub Enterprise 
      2. I configured the pipeline to checkout our main source code repo with credentials A.
      3. In addition some Jenkins libraries are loaded via git with credentials B. (This is globally configured by our IT)
      4. I want to call GitHubCommitStatusSetter manually to send the state of some stages.
      5. Credentials A: permissions for our source code repo
      6. Credentials B: permissions for shared Jenkins libs
      7. Only one GitHub Enterprise (but different repos/organizations)

      What happens:

      1. The pipeline ("continuous-integration/jenkins/pr-merge") PENDING state is send via credentials A.
      2. Jenkinsfile is obtain via credentials A.
      3. Jenkins libraries are loaded via credentials B.
      4. source code repo is cloned via credentials A.
      5. Calls in Pipeline of GitHubCommitStatusSetter use credentials B.
        1. Need to set ManuallyEnteredRepositorySource and ManuallyEnteredShaSource
      6. At end of pipeline the ("continuous-integration/jenkins/pr-merge") SUCCESS state is send via credentials A.

      The issue:

      If credentials B contain permissions for our repo, then is works (but I can see in GitHub that the "continuous-integration/jenkins/pr-merge" state and the others are send from different service accounts). Unfortunately, the permissions had to be removed.

      What is actually happening now: The pipeline calls to GitHubCommitStatusSetter fail with credentials B:

      WARNING com.cloudbees.jenkins.GitHubRepositoryName$1 applyNullSafe
      Failed to obtain repository com.cloudbees.jenkins.GitHubRepositoryName$1@7b787643
      java.io.FileNotFoundException: https://.../api/v3/repos/our-org/our-repo
          at org.kohsuke.github.GitHubConnectorResponseErrorHandler$1.onError(GitHubConnectorResponseErrorHandler.java:54)
          at org.kohsuke.github.GitHubClient.detectKnownErrors(GitHubClient.java:424)
          at org.kohsuke.github.GitHubClient.sendRequest(GitHubClient.java:386)
      Caused: org.kohsuke.github.GHFileNotFoundException: https://.../api/v3/repos/our-org/our-repo {"message":"Not Found","documentation_url":"https://docs.github.com/enterprise/3.3/rest/reference/repos#get-a-repository"}
      ...

      Be able to set the credentials like requested in JENKINS-67779 would also help here.

            lanwen Kirill Merkushev
            michaelkorn Michael Korn
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: