Use custom detailsURL in checks when configured#3354
Conversation
this piggybacks on jenkinsci/checks-api-plugin#329 which mad it possible to include a custom details url on the checks info. This change should make it possible to either carry the custom url if defined through to sub steps of withChecks. Additionally, the publishChecks and recordIssues steps will accept a details url directly when called independantly of `withChecks` in which case they will update the checksinfo as well. Resolves: jenkinsci#3352
|
supersedes: #3353 |
| @CheckForNull | ||
| private ChecksInfo checksInfo; | ||
|
|
||
| @CheckForNull |
There was a problem hiding this comment.
@CheckForNull probably not necessary
| private String icon = StringUtils.EMPTY; // @since 12.0.0: by default no custom icon is set | ||
| private String scm = StringUtils.EMPTY; | ||
|
|
||
| @CheckForNull |
There was a problem hiding this comment.
@CheckForNull probably not necessary
| private boolean stopBuild; // @since 12.10010: by default, pipeline execution will not be stopped | ||
| private String scm = StringUtils.EMPTY; | ||
|
|
||
| @CheckForNull |
There was a problem hiding this comment.
Wasn't the idea in jenkinsci/checks-api-plugin#328 that no configuration is required in a plugin anymore? I.e. we only need to change the code in WarningsChecksPublisher to extract the new property from the ChecksInfo class. There should be no new property in the plugins itself?
I.e., with jenkinsci/checks-api-plugin#329 you can run the step:
steps {
withChecks(name: 'test', detailsURL: 'http://codedependant.net') {
recordTests ...
recordCoverage ...
recordIssues ...
}
}
| <dependency> | ||
| <groupId>io.jenkins.plugins</groupId> | ||
| <artifactId>checks-api</artifactId> | ||
| <version>415.vf022234a_931d</version> |
There was a problem hiding this comment.
| <version>415.vf022234a_931d</version> | |
| <!-- TODO remove explicit version once it's available in BOM --> | |
| <version>415.vf022234a_931d</version> |
☀️ Quality MonitorTests Coverage for New Code 〰️ Line Coverage: 95.65% — 1 missed lines Coverage for Whole Project 〰️ Line Coverage: 80.85% Style Bugs Vulnerabilities 🛡️ OWASP Dependency Check: 276 vulnerabilities Software Metrics 🌀 Cyclomatic Complexity: 2644 (total) 📌 Reference ResultsDelta reports computed against the reference results of be73fb8 in workflow run 26680622135. 🚦 Quality GatesOverall Status: ❌ FAILURE✅ Passed Gates
❌ Failed Gates
Created by Quality Monitor v4.15.0 (#82d77af). More details are shown in the GitHub Checks Result. |
Thats is an option. It seemed reasonable to me to be able to do the same thing if I wasn't using recordIssues(
...
, detailsURL: "http://example.com/issues"
)turtles all the way down I guess. |
Hmm, this causes a lot of code duplication in a lot of plugins just to provide a convenience call. I'm not sure if it is worth the effort. What do you think @timja? This would imply changes in all those reporting plugins like JUnit, etc. |
@uhafner Thoughts? I'm willing to work my way through the reporting plugins if others are not. |
Sorry missed this, I would expect the |
This is also my impression. So @esatterwhite, can you change the implementation so that only the new checks API object is read? Then we need no configuration in the warnings plugin. (If this does not work out we can still create a followup that adds a new property). |
This should make it possible to specify a detailsURL property to the recordIssues and publishIssues step functions.
When issues are published via the checks api - this details url is hard coded to point to the jenkins ui for the build in question.
in cases when jenkins isn't exposed to the public, this link causes a lot of confusion.
In particular if running jenkins against github repos, and jenkins isn't accessible to the public, these links are also not accessible. This aims to provide a way to provide a custom url that to change the link so the link points to to something that is publically available.
I tried to include applicable tests to validate that the changes were in doing what I think / expect them to. making sure the defaults case still produces the expected url, and that providing an override is honored.
Resolves: #3352
Submitter checklist