Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibility Of Specifying Credentials #187

Open
irishgordo opened this issue Aug 30, 2022 · 3 comments
Open

Possibility Of Specifying Credentials #187

irishgordo opened this issue Aug 30, 2022 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@irishgordo
Copy link

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 irishgordo added the documentation Improvements or additions to documentation label Aug 30, 2022
@timja timja transferred this issue from jenkinsci/junit-plugin Sep 3, 2022
@timja
Copy link
Member

timja commented Sep 3, 2022

Relates to #148 and #103

possibly could be closed as a duplicate of #148

@irishgordo
Copy link
Author

irishgordo commented Sep 5, 2022

Hi @timja thanks for linking those additional open links - I'll can go ahead and close this to avoid the spam 😄 if you'd like?
Also! Thanks for your quick response back!
This project is awesome!
A large part of me thinks that it would just be more beneficial to convert the Jenkins jobs/pipelines we have set up to be underneath the GitHub Org based folder to take advantage of all the nice things that gives us with the mix of both the Checks API and also the JUNIT Plugin too - however that changeover in architecture may just take a bit longer to implement - so that's what prompted me asking this question 😅 - thought I think that's probably the best practice.

Would you think a setup like this could be nested underneath the GitHub Org based project?
https://github.com/irishgordo/harvester-installer/pull/1/files
(maybe I'm headed in a bad direction with this?)

Still leveraging the GitHub Credentials that weren't based around the app, so that pull-request comments could trigger builds as well as just leveraging the base PR builds?

I've been trying to wrap my head around how to best take a JobDSL project and say that it belongs to the GitHub Organization based project.

I do really like the frame of thought that the GitHub App credentials allows for 5000-ish / a much-higher API limit than that of pure credentials - but I'm also curious if both GitHub App and GitHub Credentials can be used in conjunction as well as the syntax for structuring the pipelines as something to allow for all entities to be under the GitHub Org (including Jenkinsfile based project - but other jobs defined by JobDSL). As we'd want to have the Configuration as Code Plugin to be able to initially create the jobs if needed that are under that Org + creating that org.

Thanks again for all the insight/help!

@timja
Copy link
Member

timja commented Sep 5, 2022

Would you think a setup like this could be nested underneath the GitHub Org based project?

Yes although it doesn't have to be in a GitHub org project.
You can just change your credentials to be a GitHub app and that will work too...

Still leveraging the GitHub Credentials that weren't based around the app, so that pull-request comments could trigger builds as well as just leveraging the base PR builds?

I think you can use this plugin:
https://plugins.jenkins.io/github-pr-comment-build/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants