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

Allow configuring the network name for project-based containers #561

Merged
merged 12 commits into from
Mar 29, 2023

Conversation

mswintermeyer
Copy link
Contributor

Before this PR

The default network name generated includes an underscore, which is not always valid.

After this PR

==COMMIT_MSG==
Projects using DockerProxyExtension for project-based containers can now override the docker network name used by the proxy
==COMMIT_MSG==

Possible downsides?

@changelog-app
Copy link

changelog-app bot commented Mar 24, 2023

Generate changelog in changelog/@unreleased

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Projects using DockerProxyExtension for project-based containers can now override the docker network name used by the proxy

Check the box to generate changelog(s)

  • Generate changelog entry

Copy link
Collaborator

@SerialVelocity SerialVelocity left a comment

Choose a reason for hiding this comment

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

If the goal is just to have a valid network name, can we just remove invalid characters instead?

@mswintermeyer
Copy link
Contributor Author

If the goal is just to have a valid network name, can we just remove invalid characters instead?

I was hesitant to break back-compat if any client currently asserts that the network looks like they expect.

@@ -66,7 +66,24 @@ public static DockerProxyExtension fromProjectName(ProjectName projectName, Clas
public static DockerProxyExtension fromProjectName(
ProjectName projectName, Class<?> classToLogFor, String imageNameOverride) {
return new DockerProxyExtension(
docker -> new ProjectBasedDockerContainerInfo(docker, projectName, Optional.of(imageNameOverride)),
docker -> new ProjectBasedDockerContainerInfo(
docker, projectName, Optional.empty(), Optional.of(imageNameOverride)),
Copy link
Collaborator

Choose a reason for hiding this comment

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

These parameters are the wrong way around I think

DockerExecutable docker,
ProjectName projectName,
Optional<String> networkNameOverride,
Optional<String> imageNameOverride) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we also do the same here to keep the constructors consistent

@bulldozer-bot bulldozer-bot bot merged commit d544fa9 into develop Mar 29, 2023
@bulldozer-bot bulldozer-bot bot deleted the mw/network-name-override branch March 29, 2023 15:25
@svc-autorelease
Copy link
Collaborator

Released 1.9.0

@SerialVelocity
Copy link
Collaborator

For context, a reverse DNS lookup returns the container name with the network name at the end. This is invalid when it contains an underscore

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

Successfully merging this pull request may close these issues.

4 participants