feat(runtime-templates): add support for runtime templates in bind mounts (#412)

This commit is contained in:
Pasha Sviderski committed 2026-09-23 15:12:10 +10:00
1 parent 88dda435e7
commit 5c33e4be86
17 files changed
+571 -10

No files matched your search

+10 -1
View File
@@ -538,6 +538,15 @@ func (s *Server) CreateServiceContainer(
containerName = fmt.Sprintf("%s-%s", spec.Name, suffix)
}
desiredSpec := spec
renderedSpec, renderErr := desiredSpec.RenderRuntimeTemplates(api.RuntimeTemplateContext{
Container: api.RuntimeTemplateContainerContext{Name: containerName},
})
if renderErr != nil {
return nil, status.Errorf(codes.InvalidArgument, "render runtime templates: %v", renderErr)
}
spec = renderedSpec
envVars := maps.Clone(spec.Container.Env)
if envVars == nil {
envVars = make(api.EnvVars)
@@ -745,7 +754,7 @@ func (s *Server) CreateServiceContainer(
_ = s.client.ContainerRemove(ctx, resp.ID, container.RemoveOptions{RemoveVolumes: true})
}
specBytes, err := json.Marshal(spec)
specBytes, err := json.Marshal(desiredSpec)
if err != nil {
removeContainer()
return nil, status.Errorf(codes.Internal, "marshal service spec: %v", err)