github-plugin icon indicating copy to clipboard operation
github-plugin copied to clipboard

[JENKINS-53824] GitHubCommitStatusSetter not working as expected with GHE

Open jenkins-infra-bot opened this issue 7 years ago • 2 comments

When using the GitHubCommitStatusSetter in conjunction with GitHub-Folder, GitHub Enterprise, and pipeline, the results are not as expected.

First tests using the examples from the plugin page didn't lead to an error but also not to the desired result. Using the following code:

 

step([
    $class: 'GitHubCommitStatusSetter',
    contextSource: [
$class : 'ManuallyEnteredCommitContextSource',
context: 'ci/jenkins/my-custom-status'
    ],
    statusResultSource: [
$class : 'ConditionalStatusResultSource',
results: [
    [
$class : 'AnyBuildResult',
message: 'My message',
state  : 'PENDING'
    ]
]
    ]
])

 

Led to the following console output:

 

[Set GitHub commit status (universal)] PENDING on repos [] (sha:0259c98) with context:ci/jenkins/my-custom-status

 

And no status was set on the commit. After following most of the suggested workarounds on the web (Manual Repo, Manual SHA etc) it still showed nothing.

From looking at the code of the plugin and the logs of AnyRepo, it seemed that the step did not find the correct server.

Going to the Configuration of Jenkins and looking at the configuration for GitHub. It seems that the GitHub Server config section now also allows enterprise servers as well but there is still the GitHub Enterprise section (where my server was listed).

After some playing, I found that when I add the GHE server to the GitHub Server section as well, the commit status is working as expected.

I also found that when I removed the entry in the GHE section (since it seemed to be working just fine with just the GitHub Servers section), GitHub Folders were failing and I was no longer able to select a server within the GitHub Folder config.


Originally reported by olira, imported from: GitHubCommitStatusSetter not working as expected with GHE
  • assignee: lanwen
  • status: Open
  • priority: Minor
  • component(s): github-plugin
  • resolution: Unresolved
  • votes: 1
  • watchers: 2
  • imported: 2025-12-08
Raw content of original issue

When using the GitHubCommitStatusSetter in conjunction with GitHub-Folder, GitHub Enterprise, and pipeline, the results are not as expected.

First tests using the examples from the plugin page didn't lead to an error but also not to the desired result. Using the following code:

 

step([
    $class: 'GitHubCommitStatusSetter',
    contextSource: [
        $class : 'ManuallyEnteredCommitContextSource',
        context: 'ci/jenkins/my-custom-status'
    ],
    statusResultSource: [
        $class : 'ConditionalStatusResultSource',
        results: [
            [
                $class : 'AnyBuildResult',
                message: 'My message',
                state  : 'PENDING'
            ]
        ]
    ]
])

 

Led to the following console output:

 

[Set GitHub commit status (universal)] PENDING on repos [] (sha:0259c98) with context:ci/jenkins/my-custom-status

 

And no status was set on the commit. After following most of the suggested workarounds on the web (Manual Repo, Manual SHA etc) it still showed nothing.

From looking at the code of the plugin and the logs of AnyRepo, it seemed that the step did not find the correct server.

Going to the Configuration of Jenkins and looking at the configuration for GitHub. It seems that the GitHub Server config section now also allows enterprise servers as well but there is still the GitHub Enterprise section (where my server was listed).

After some playing, I found that when I add the GHE server to the GitHub Server section as well, the commit status is working as expected.

I also found that when I removed the entry in the GHE section (since it seemed to be working just fine with just the GitHub Servers section), GitHub Folders were failing and I was no longer able to select a server within the GitHub Folder config.

environment
Jenkins 2.107.3<br/>
github-plugin 1.29.2

jenkins-infra-bot avatar Sep 27 '18 17:09 jenkins-infra-bot

kewp:
  • Original comment link
  • Raw content of original comment:

    I have the exact same issue. Not with public Github repos, though...

I have the exact same issue. Not with public Github repos, though...

jenkins-infra-bot avatar Dec 11 '18 17:12 jenkins-infra-bot

kewp:
  • Original comment link
  • Raw content of original comment:

    I got it working! Try using a token with ALL the repo permissions (status, deployment, public_repo, invite)!

I got it working! Try using a token with ALL the repo permissions (status, deployment, public_repo, invite)!

jenkins-infra-bot avatar Dec 12 '18 13:12 jenkins-infra-bot