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

Configuration ignores app credential override

Open ioanav104 opened this issue 2 years ago • 0 comments

Jenkins and plugins versions report

Environment
Jenkins: 2.401.3
OS: Linux - 5.4.0-1093-aws
Java: 11.0.19 - Eclipse Adoptium (OpenJDK 64-Bit Server VM)

github-checks:545.v79a_a_68b_ca_682

What Operating System are you using (both controller, and any agents involved in the problem)?

Ubuntu 18 for the agents and the controller

Reproduction steps

  1. Set up a job to use SSH credentials to pull from GitHub
  2. In the GitHub checks configuration, override the credentials to point to app credentials
  3. Stop a job while it's building
  4. After the first job failure all subsequent jobs fail to report the build result to GitHub with the error:
[GitHub Checks] Failed Publishing GitHub checks: java.io.IOException: Unsupported credential type: com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey

Which means it is ignoring the credential override after the first failure.

Expected Results

All jobs should be using the override for the credential id, instead of the credentials used to pull the code.

Actual Results

[GitHub Checks] Failed Publishing GitHub checks: java.io.IOException: Unsupported credential type: com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey

Presumably using the wrong credentials.

Anything else?

I suspect the problem started with https://github.com/jenkinsci/github-checks-plugin/pull/341/files Specifically, I think findGitHubAppCredentials is returning the first credentials (SSH Key type) instead of the app credentials configured: https://github.com/jenkinsci/github-checks-plugin/blob/8d1713321e3db97eb07ff398400fb80efc5f6c24/src/main/java/io/jenkins/plugins/checks/github/SCMFacade.java#L126

ioanav104 avatar Oct 02 '23 12:10 ioanav104