Skip to content
Snippets Groups Projects
Commit 78dfc561 authored by Lars Seipel's avatar Lars Seipel
Browse files

Avoid image tags from leaking into the host alias

parent 2f0e5c60
No related branches found
No related tags found
No related merge requests found
Pipeline #5438 failed
......@@ -438,11 +438,16 @@ func (s *executor) setupBuildPod() error {
for i, service := range s.options.Services {
resolvedImage := s.Build.GetAllVariables().ExpandValue(service.Name)
services[i] = s.buildContainer(fmt.Sprintf("svc-%d", i), resolvedImage, service, s.serviceRequests, s.serviceLimits)
hostName := service.Name
// When the service.Name has a Docker image tag, we don't want
// it to end up in the host name.
if i := strings.IndexByte(hostName, ':'); i >= 0 {
hostName = hostName[:i]
}
if service.Alias != "" {
serviceAliases.Hostnames[i] = service.Alias
} else {
serviceAliases.Hostnames[i] = service.Name
hostName = service.Alias
}
serviceAliases.Hostnames[i] = hostName
}
labels := make(map[string]string)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment