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

Possibility Of Specifying Credentials

Open irishgordo opened this issue 2 years ago • 0 comments

Describe your use-case which is not covered by existing documentation.

Hi there,

I was wondering if there is the possibility of specifying the credentials for junit when it publishes to GitHub Checks?

Since the project is maybe not "org" based but knowing that - using my setup GitHub App Credential:

               withCredentials([usernamePassword(credentialsId: 'jenkins-irishgordo',
                                            usernameVariable: 'GITHUB_APP',
                                            passwordVariable: 'GITHUB_ACCESS_TOKEN')]) { 
               }

In the withCredentials block on the pipeline -> stages -> stage -> steps. I know that I'm capable of making a raw curl -X POST to https://api.github.com/repos/-usr-/repo/check-runs

Is there anyway to inject credentials into:

                withChecks('API Tests'){
                    junit checksName: 'api-tests', testResults: 'tests/api_latest.xml'
                }

I guess the use-case is right now - that a Jenkinsfile - builds a JobDSL based "pipelineJob" - that then that injects a basic declaritive pipeline script .groovy. The triggers are setup on the JobDSL based Groovy file, with githubPullRequest -> since this is all outside of an Organization folder - I'm just wondering if selecting the credential to use could be a stand-in segway.

Thanks for any info / help / insight! I really appreciate it all! I also really appreciate that there is the ability to pulbish your junit results out to GitHub Checks, I think it's fantastic not having to head over to Jenkins to see the failures of the tests but instead have the tests runs propegeate to the Checks tab in GitHub.

Reference any relevant documentation, other materials or issues/pull requests that can be used for inspiration.

No response

irishgordo avatar Aug 30 '22 22:08 irishgordo