feat: allow for custamizable detailsURL in withChecks#329
Conversation
693c36c to
bbeefef
Compare
timja
left a comment
There was a problem hiding this comment.
not tested fully end 2 end but I've checked the UI and it looks fine.
Few minor comments.
de59939 to
b96c787
Compare
uhafner
left a comment
There was a problem hiding this comment.
The only thing I don't understand is the change in AbstractStatusChecksProperties. Maybe you can elaborate?
| @@ -0,0 +1 @@ | |||
| <p>Override the default Jenkins build URL.</p> | |||
There was a problem hiding this comment.
| <p>Override the default Jenkins build URL.</p> | |
| <div>Override the default Jenkins build URL.</div> |
There was a problem hiding this comment.
What's the deciding factor, for my own curiosity
|
|
||
| /** | ||
| * Returns a custom URL to override the default global Jenkins URL | ||
| * | ||
| * @param job | ||
| * A jenkins job. | ||
| * @return a custom destination URL template string or null to use the default | ||
| */ | ||
| @CheckForNull | ||
| public String getCustomDetailsUrl(final Job<?, ?> job) { | ||
| return null; | ||
| } |
There was a problem hiding this comment.
Why is this code needed? It is not used in production code.
There was a problem hiding this comment.
Based on the description - being the point of extension, and that name is handled here, it seemed fitting make it possible for other plugins to pull the custom url if it was provided
withChecks(
name: 'my-check'
, detailsURL: 'http://some-domain.com/help'
){
junit pattern: 'files/*.xml'
}
Currently, doing this, the junit plugin will blow away the custom url set by withChecks.
How checks information are passed around between discrete plugins is pretty hazy to me. This seemed like it was part of it. If this isn't needed, I can remove it.
| import static org.mockito.Mockito.mock; | ||
| import io.jenkins.plugins.util.IntegrationTestWithJenkinsPerTest; | ||
|
|
||
| public class AbstractStatusChecksPropertiesTest extends IntegrationTestWithJenkinsPerTest { |
There was a problem hiding this comment.
I'm not sure why these tests are useful
| AbstractStatusChecksProperties properties = new AbstractStatusChecksProperties() { | ||
| @Override | ||
| public boolean isApplicable(Job<?, ?> job) { | ||
| return true; | ||
| } | ||
|
|
||
| @Override | ||
| public String getName(Job<?, ?> job) { | ||
| return "Test"; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean isSkipped(Job<?, ?> job) { | ||
| return false; | ||
| } | ||
| }; |
There was a problem hiding this comment.
Use a Mockito spy here: Mockito.spy(AbstractStatusChecksProperties.class)
There was a problem hiding this comment.
should I just remove this, if it isn't particularly useful?
When using the withChecks wrapper the details url always points to the jenkins ui for the build. in cases where jenkins is behind a comany firewall or other network boundaries, this can be a bit frustrating for people outside the firewall on public facing repositories. Having the details url point to something that is accessible is very useful, but it is only possible with publishChecks. This aims to add the same functionality through the withChecks step. Resolves: jenkinsci#328
b96c787 to
bf542d8
Compare
When using the withChecks wrapper the details url always points to the jenkins ui for the build. in cases where jenkins is behind a comany firewall or other network boundaries, this can be a bit frustrating for people outside the firewall on public facing repositories. Having the details url point to something that is accessible is very useful, but it is only possible with publishChecks.
This aims to add the same functionality through the withChecks step.
Resolves: #328
Testing done
pipeline { agent any stages { stage('Hello') { steps { withChecks( name: 'test', detailsURL: 'http://codedependant.net' ) { echo 'Hello World' echo 'ls -alh' } } } } }Reference build: https://github.com/esatterwhite/jenkins-checks-test/pull/1/checks?check_run_id=77236702409
It also still works with the original function signature syntax
Reference build: https://github.com/esatterwhite/jenkins-checks-test/pull/2/checks?check_run_id=77240137433
Submitter checklist