Skip to content

Configuration ignores app credential override #360

@ioanav104

Description

@ioanav104

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:

public Optional<StandardUsernameCredentials> findGitHubAppCredentials(final Job<?, ?> job, final String credentialsId) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions