Skip to content

Conversation

@jgoldhammer
Copy link
Contributor

  • 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
Copy link
Collaborator

@gmessner gmessner left a 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");

Copy link
Collaborator

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.

Copy link
Contributor Author

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.

Copy link
Collaborator

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;
Copy link
Collaborator

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

@gmessner gmessner merged commit 8d917f1 into gitlab4j:master Aug 4, 2018
@gmessner
Copy link
Collaborator

gmessner commented Aug 4, 2018

@jgoldhammer
Thanks again for the contribution. I especially appreciate the inclusion of unit tests.

@gmessner
Copy link
Collaborator

gmessner commented Aug 4, 2018

@jgoldhammer
I've released 4.8.38 with your changes merged. It may take up to 24 hours for it to show up in the mvn repos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants