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

Having trouble customizing GitHub Checks page view #215

Closed
grvvy opened this issue Oct 27, 2021 · 14 comments
Closed

Having trouble customizing GitHub Checks page view #215

grvvy opened this issue Oct 27, 2021 · 14 comments
Labels
documentation Improvements or additions to documentation

Comments

@grvvy
Copy link

grvvy commented Oct 27, 2021

Summary

I'm new to Jenkins/CI and web/REST development in general, but I set up a multibranch pipeline project and a basic GH app connected to cmee to handle my webhooks.

I then installed the Checks API plugin along with the GitHub Checks plugin and I'm successfully seeing some output in my Checks view on GitHub:

Screenshot from 2021-10-26 16-38-29

Since then I've skimmed some GH App documentation and watched the final demo video but I'm having trouble figuring out how to customize this view. I see the "Consume API - Create Checks" section but I'm not sure where that code implementation would even go.

Is there a way to view the code that is being run in the background that's giving me this default view after installing the app?.

I'm also not sure if that's totally necessary or if I'm missing something simple to achieve a nicer looking checks page like this one:

Screenshot from 2021-10-26 16-59-16

Some specific examples of the improvements I'd like to have from the second screenshot are: clickable build steps that display some build log info instead of plain bullet points outlining my pipeline stages.

Pipeline defined here

My only theory is that maybe it doesn't handle the fact that each stage simply runs a shell script and so the nice features of the second screenshot aren't working; but I'm also unsure if those are supposed to work by default right after installing the plugin.

Cheers!

@grvvy grvvy added the documentation Improvements or additions to documentation label Oct 27, 2021
@KalleOlaviNiemitalo
Copy link

The Markdown text for the checks report is generated by FlowExecutionAnalyzer in checks-api-plugin. If you want a different format, then it could be implemented in a few ways:

  • Edit checks-api-plugin so that FlowExecutionAnalyzer formats the Markdown differently. I have a stalled PR Simplify status checks output for "error" and "unstable" steps checks-api-plugin#125 that changes it somewhat but doesn't add bullet points.
  • Edit checks-api-plugin to make the Markdown formatting an extension point, and publish another plugin that formats it differently.
  • Disable "status checks" in the project in Jenkins, and instead write a pipeline library to format the Markdown and use the publishChecks step to publish it to GitHub. This would be difficult to implement.

I'm not sure it would be possible for FlowExecutionAnalyzer to generate bullet points for pipeline stages or steps that haven't even started yet.

@grvvy
Copy link
Author

grvvy commented Oct 27, 2021

Thanks for the response.

I don't necessarily want to add bullet points, but I in fact don't like that the view I'm getting has the non-expandable bullet points for my build stages instead of the expandable sections with highlighted build logs in the latter screenshot.

Is the checks view supposed to look more like the second screenshot by default?

@grvvy
Copy link
Author

grvvy commented Oct 27, 2021

Ah, just realized that I'm comparing my Checks view with the Actions view of the other repo and that their "Jenkins" view under Checks does look similar to mine.

@grvvy
Copy link
Author

grvvy commented Oct 27, 2021

Slightly related: If I'm looking to Consume the API to ie. add more checks as listed in the Consumer Guide, where does that java go? I haven't had to write any java up until now after having set up everything listed above so I'm a bit lost on that.

@KalleOlaviNiemitalo
Copy link

The Java code would go in a plugin for Jenkins. It may also be possible to use those APIs from Groovy but I think the security restrictions would then require placing the Groovy code in a global pipeline library rather than directly in Jenkinsfile.

For per-project use, the publishChecks step is available.

@grvvy
Copy link
Author

grvvy commented Oct 28, 2021

Gotcha, so it seems like writing new java is more for building new plugins whereas pipeline configuration allows users to customize what additional information gets sent to the Checks view in github?

@grvvy
Copy link
Author

grvvy commented Oct 28, 2021

Is there a way to view the pipeline or code responsible for producing this tests view and pipeline view for reference?

@KalleOlaviNiemitalo
Copy link

Those URLs starting with https://ci.jenkins.io/blue/ are handled by https://github.com/jenkinsci/blueocean-plugin, I believe. I don't know where exactly they are implemented in there. If you are planning to implement similar UI in a checks report published to GitHub, that may be difficult because GitHub is likely to have restrictions on the HTML elements that you can use there.

@grvvy
Copy link
Author

grvvy commented Oct 29, 2021

Oh wow thank you! I'm not looking to implement it myself I was just searching for a better looking UI for when github contributors click details links on builds and wasn't sure what to look for.

@grvvy grvvy closed this as completed Oct 29, 2021
@SaranshIam
Copy link

Hi @KalleOlaviNiemitalo

The Markdown text for the checks report is generated by FlowExecutionAnalyzer in checks-api-plugin. If you want a different format, then it could be implemented in a few ways:

  • Edit checks-api-plugin so that FlowExecutionAnalyzer formats the Markdown differently. I have a stalled PR Simplify status checks output for "error" and "unstable" steps checks-api-plugin#125 that changes it somewhat but doesn't add bullet points.
  • Edit checks-api-plugin to make the Markdown formatting an extension point, and publish another plugin that formats it differently.
  • Disable "status checks" in the project in Jenkins, and instead write a pipeline library to format the Markdown and use the publishChecks step to publish it to GitHub. This would be difficult to implement.

I'm not sure it would be possible for FlowExecutionAnalyzer to generate bullet points for pipeline stages or steps that haven't even started yet.

Can you guide me on how should I display a table on the github checks page.
I can create a markdown shared lib. in my pipeline , but I am not sure how to display it on github checks page.

@KalleOlaviNiemitalo
Copy link

@SaranshIam, if you want to add a table to a check that Jenkins already publishes to GitHub, I think you need to edit the Java code in some plugin: github-checks, checks-api, or whatever plugin publishes the check to checks-api.

If you instead want to publish an entirely new check that includes a table, the publishChecks step will be the easiest way to do that from a pipeline.

@SaranshIam
Copy link

@KalleOlaviNiemitalo Thank You!
I am publishing entirely new checks , but I still do not understand how publishChecks will help me output it in a table format?
I mean which of the parameters that the plugin takes would help me to format output as a table?

@KalleOlaviNiemitalo
Copy link

The summary and text parameters of the publishChecks step support Markdown. I think you could input your table via one of those.

@SaranshIam
Copy link

Ok I will try this. Thanks a lot for all the help @KalleOlaviNiemitalo !!

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

3 participants