Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add withChecks step #49
Add withChecks step #49
Changes from all commits
dad6572
7b78a3b
80e6a26
f4b246a
637b847
c76461f
d37be34
69a09ff
d38dbf6
a45182e
e724c04
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It still should be a SNAPSHOT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sem-ver plugin will warn about compatibility if add SNAPSHOT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to take more than one args? cause I saw code like https://github.com/jenkinsci/workflow-cps-plugin/blob/master/src/main/java/org/jenkinsci/plugins/workflow/cps/DSL.java#L702
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes it can take more than one, normally you would use a databoundsetter for any optional parameters
Then the syntax would be:
if there's only one mandatory field in constructor then you can omit the parameter name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So should we make all params optional in case that in the future, some users may only want to inject a certain field like conclusion instead of name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we do that then the user will have to specify the name in a more verbose way,
withChecks(name: 'hello')
rather thanwithChecks('hello')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specify the name wouldn't be annoying for users IMO but make it mandatory will be an issue for future changes?
Also, it seems the snippet generator will always specify name
@mrginglymus What do you think? Do you think there will be situations where you do not want to specify the name but the status (e.g. publish several checks in the same status (say in progress) but with different names in the closure)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be fine to be mandatory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the support of the callback, this step may be much more useful (but I'm not sure if that goes beyond this step's scope) than just injecting the properties: it can be used as a progress reporter for the steps in Its closure.
Then, here is an issue:
We cannot publish checks on success since we definitely don't want a simple success report check to overwrite what's inside the block (in the context of this API, we don't know about checks updating even if we support that in implementation).
If we don't publish success, however, a simple closure in which no step publishes checks using the injected name will leave the check uncompleted forever. (as said before, if the progress reporter feature goes beyond the scope, then this should the users' problem)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not our problem I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's reasonable to expect users to be responsible for sending a success message (or indeed a failure message) within their invocation of
withChecks
. I did wonder about adding to the publisher API the ability to get the current conclusion (https://github.com/jenkinsci/github-checks-plugin/pull/87/files#diff-9c475e3093c11ae9324debf6c824b9c15277a027428e5c7ed60ad6ac2ac25284R131-R134) so that we could query that in onSuccess and send a generic 'success' check if nothing else was set.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems not feasible, since in the context of the API, we don't expect the implementation to possess the
ChecksDetails
alone the build, and if we take that as a users' responsible, there is no need to add thegetConclusion
method only for this feature IMO.