-
Notifications
You must be signed in to change notification settings - Fork 486
feat(runners): additions for runners api #226
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
Conversation
jgoldhammer
commented
Aug 4, 2018
- add register and delete runner
- enhance runner entity for ipAdress field
- introduce first runners tests
- add register and delete runner - enhance runner entity for ipAdress field - introduce first runners tests
gmessner
left a comment
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 PR looks great, just one small change requested concerning the use of Preconditions.checkNotNull()
| Boolean runUntagged, Boolean locked, Integer maximumTimeout) throws GitLabApiException { | ||
|
|
||
| Preconditions.checkNotNull(token, "token is necessary for registering a new runner"); | ||
|
|
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.
No need to use Preconditions.checkNotNull() here, .withParam("token", token, true) will throw a exception if token is null or empty.
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 have made the changes, although I am a fan of fast fail code. Clear preconditions make it easier in my eyes for api users.
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.
Thanks for making the change.
Preconditions.checkNotNull() and GitLabApiForm.withParam() will produce almost identical results. With a well-worded exception message telling what parameter name was null or empty. Also, there are literally 1000's of other places this is done, if we wanted to use Preconditions, to be consistent we should apply it everywhere.
Additionally, Preconditions.checkNotNull() does not look for an empty string, GitLabApiForm.withParam() does.
| import org.gitlab4j.api.models.JobStatus; | ||
| import org.gitlab4j.api.models.Runner; | ||
| import org.gitlab4j.api.models.RunnerDetail; | ||
| import org.glassfish.jersey.internal.guava.Preconditions; |
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.
Do not need to import this if you make the suggested change in registerRunner() below
|
@jgoldhammer |
|
@jgoldhammer |