Skip to content
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

Enable Labels in Container Config #750

Merged
merged 6 commits into from
Aug 1, 2018
Merged

Conversation

loosebazooka
Copy link
Member

@loosebazooka loosebazooka commented Jul 31, 2018

  • only exposes in core the opportunity to add labels
  • this PR does NOT
    • pass through labels from a base image (should be in followup)
    • enable frontend labels access (should be in followup)

part of #751

- only exposes in core the opportunity to add labels
- this PR does NOT
  - pass through labels from a base image (should be in followup)
  - enable frontend labels access (should be in followup)
@@ -98,6 +99,23 @@ public Builder setExposedPorts(@Nullable List<Port> exposedPorts) {
return this;
}

/**
* Sets the container's exposed ports.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover copy-pasted comment?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy-pasta strikes again, I'll fix these.

}
return this;
}

/**
* Sets the items in the "ExposedPorts" field in the container configuration.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

@loosebazooka loosebazooka mentioned this pull request Jul 31, 2018
6 tasks
Map<String, String> badLabels = new HashMap<>();
badLabels.put("label-key", null);
BuildConfiguration.builder(Mockito.mock(BuildLogger.class))
.setContainerConfiguration(ContainerConfiguration.builder().setLabels(badLabels).build());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The try block should only be focused on the method being tested. I actually think BuildConfiguration.builder() doesn't play a role. Maybe

Map<String, String> badLabels = ...
badLabels.put(...)
Builder builder = ContainerConfiguration.builder();
try {
  builder.setLabels(badLabels);
  Assert.fail(...);
} catch (...) {

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, makes sense.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hrmm... looks like we might need to cleanup this whole test class :\

@@ -110,15 +111,26 @@
* @param exposedPorts the list of exposed ports to add
* @return this
*/
public Builder<T> setExposedPorts(@Nullable ImmutableList<Port> exposedPorts) {
public Builder<T> setExposedPorts(@Nullable List<Port> exposedPorts) {
if (exposedPorts == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we could do the same thing here as with labels and use a ternary operator.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was going to, but figured it should be in a followup. This ImmutableList -> List change probably shouldn't be part of this PR either. I might go through and do some cleanup after this.

@loosebazooka loosebazooka merged commit 81ee810 into master Aug 1, 2018
@coollog coollog deleted the allowLabelsInContainerConfig branch August 22, 2018 14:29
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.

4 participants