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

get credential using findCredentialById, passing context #324

Conversation

LeoQuote
Copy link

@LeoQuote LeoQuote commented Apr 3, 2023

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

like jenkinsci/github-branch-source-plugin#527 , this pr use findCredentialById to get credential, and the build context is also passed, make it possible to use the plugin without organization name.

@LeoQuote LeoQuote requested a review from a team as a code owner April 3, 2023 12:18
@codecov
Copy link

codecov bot commented Apr 3, 2023

Codecov Report

Merging #324 (fbfc326) into master (23ee21e) will decrease coverage by 0.24%.
The diff coverage is 72.72%.

@@             Coverage Diff              @@
##             master     #324      +/-   ##
============================================
- Coverage     80.79%   80.56%   -0.24%     
- Complexity      170      171       +1     
============================================
  Files            16       16              
  Lines           526      535       +9     
  Branches         49       51       +2     
============================================
+ Hits            425      431       +6     
- Misses           79       81       +2     
- Partials         22       23       +1     
Impacted Files Coverage Δ
...ins/plugins/checks/github/GitHubChecksContext.java 100.00% <ø> (ø)
...va/io/jenkins/plugins/checks/github/SCMFacade.java 55.55% <72.72%> (+1.85%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@LeoQuote LeoQuote marked this pull request as draft April 3, 2023 12:33
@LeoQuote
Copy link
Author

LeoQuote commented Apr 3, 2023

seems to be an error

java.lang.ClassCastException: class hudson.scm.NullSCM cannot be cast to class hudson.plugins.git.GitSCM (hudson.scm.NullSCM is in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @6fdbe764; hudson.plugins.git.GitSCM is in unnamed module of loader jenkins.util.URLClassLoader2 @a76e90f)
        at io.jenkins.plugins.checks.github.SCMFacade.findGitHubAppCredentials(SCMFacade.java:132)
        at io.jenkins.plugins.checks.github.GitHubChecksContext.findGitHubAppCredentials(GitHubChecksContext.java:114)
        at io.jenkins.plugins.checks.github.GitHubChecksContext.hasGitHubAppCredentials(GitHubChecksContext.java:89)
        at io.jenkins.plugins.checks.github.GitHubChecksContext.hasValidCredentials(GitHubChecksContext.java:103)
        at io.jenkins.plugins.checks.github.GitHubSCMSourceChecksContext.isValid(GitHubSCMSourceChecksContext.java:79)
        at io.jenkins.plugins.checks.github.GitHubChecksPublisherFactory.createPublisher(GitHubChecksPublisherFactory.java:64)
        at io.jenkins.plugins.checks.github.GitHubChecksPublisherFactory.createPublisher(GitHubChecksPublisherFactory.java:47)
        at io.jenkins.plugins.checks.api.ChecksPublisherFactory.lambda$fromRun$0(ChecksPublisherFactory.java:89)

@LeoQuote
Copy link
Author

LeoQuote commented Apr 3, 2023

The error above has been fixed

@LeoQuote
Copy link
Author

LeoQuote commented Apr 7, 2023

java.lang.ClassCastException: class hudson.scm.NullSCM cannot be cast to class hudson.plugins.git.GitSCM (hudson.scm.NullSCM is in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @61bcd567; hudson.plugins.git.GitSCM is in unnamed module of loader jenkins.util.URLClassLoader2 @1d00af3e)
	at io.jenkins.plugins.checks.github.SCMFacade.findGitHubAppCredentials(SCMFacade.java:132)
	at io.jenkins.plugins.checks.github.GitHubChecksContext.findGitHubAppCredentials(GitHubChecksContext.java:114)
	at io.jenkins.plugins.checks.github.GitHubChecksContext.hasGitHubAppCredentials(GitHubChecksContext.java:89)
	at io.jenkins.plugins.checks.github.GitHubChecksContext.hasValidCredentials(GitHubChecksContext.java:103)
	at io.jenkins.plugins.checks.github.GitHubSCMSourceChecksContext.isValid(GitHubSCMSourceChecksContext.java:79)
	at io.jenkins.plugins.checks.github.GitHubChecksPublisherFactory.createPublisher(GitHubChecksPublisherFactory.java:64)
	at io.jenkins.plugins.checks.github.GitHubChecksPublisherFactory.createPublisher(GitHubChecksPublisherFactory.java:47)
	at io.jenkins.plugins.checks.api.ChecksPublisherFactory.lambda$fromRun$0(ChecksPublisherFactory.java:89)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
	at java.base/java.util.Spliterators$IteratorSpliterator.tryAdvance(Spliterators.java:1812)
	at java.base/java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:127)
	at java.base/java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:502)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:488)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543)
	at io.jenkins.plugins.checks.api.ChecksPublisherFactory.fromRun(ChecksPublisherFactory.java:92)
	at io.jenkins.plugins.checks.api.ChecksPublisherFactory.fromRun(ChecksPublisherFactory.java:69)
	at io.jenkins.plugins.analysis.core.steps.WarningChecksPublisher.publishChecks(WarningChecksPublisher.java:81)
	at io.jenkins.plugins.analysis.core.steps.IssuesRecorder.publishResult(IssuesRecorder.java:865)
	at io.jenkins.plugins.analysis.core.steps.IssuesRecorder.record(IssuesRecorder.java:781)
	at io.jenkins.plugins.analysis.core.steps.IssuesRecorder.perform(IssuesRecorder.java:743)
	at io.jenkins.plugins.analysis.core.steps.RecordIssuesStep$Execution.run(RecordIssuesStep.java:1159)
	at io.jenkins.plugins.analysis.core.steps.RecordIssuesStep$Execution.run(RecordIssuesStep.java:1115)
	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)

hmmm strange, the error still appears occasionally ...

@LeoQuote
Copy link
Author

I’m not capable to fix all the issues , closing 🥹

@LeoQuote LeoQuote closed this May 22, 2023
@LeoQuote LeoQuote deleted the get_credential_using_findCredentialById branch May 22, 2023 15:06
@jglick
Copy link
Member

jglick commented May 22, 2023

@LeoQuote can you at least file something in https://github.com/jenkinsci/github-checks-plugin/issues/new/choose describing what bug or RFE you consider this to be solving, in case someone else wants to try?

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

Successfully merging this pull request may close these issues.

2 participants