fix: Additional comments for source-linked deployment

This commit is contained in:
Ilya Kuznetsov 2025-01-10 15:24:54 +01:00
parent dc3a157fdc
commit 37e3b1b20e
2 changed files with 3 additions and 0 deletions

View File

@ -56,6 +56,7 @@ func (m *applySourceLinkedDeploymentPreset) Apply(ctx context.Context, b *bundle
b.Config.Presets.SourceLinkedDeployment = &enabled b.Config.Presets.SourceLinkedDeployment = &enabled
} }
// This mutator runs before workspace paths are defaulted so it's safe to check for the user-defined value
if b.Config.Workspace.FilePath != "" && config.IsExplicitlyEnabled(b.Config.Presets.SourceLinkedDeployment) { if b.Config.Workspace.FilePath != "" && config.IsExplicitlyEnabled(b.Config.Presets.SourceLinkedDeployment) {
path := dyn.NewPath(dyn.Key("targets"), dyn.Key(target), dyn.Key("workspace"), dyn.Key("file_path")) path := dyn.NewPath(dyn.Key("targets"), dyn.Key(target), dyn.Key("workspace"), dyn.Key("file_path"))
@ -63,6 +64,7 @@ func (m *applySourceLinkedDeploymentPreset) Apply(ctx context.Context, b *bundle
diag.Diagnostic{ diag.Diagnostic{
Severity: diag.Warning, Severity: diag.Warning,
Summary: "workspace.file_path setting will be ignored in source-linked deployment mode", Summary: "workspace.file_path setting will be ignored in source-linked deployment mode",
Detail: "In source-linked deployment files are not copied to the destination and resources use source files instead",
Paths: []dyn.Path{ Paths: []dyn.Path{
path[2:], path[2:],
}, },

View File

@ -54,6 +54,7 @@ func (m *compute) Apply(_ context.Context, b *bundle.Bundle) diag.Diagnostics {
// Set file upload destination of the bundle in metadata // Set file upload destination of the bundle in metadata
b.Metadata.Config.Workspace.FilePath = b.Config.Workspace.FilePath b.Metadata.Config.Workspace.FilePath = b.Config.Workspace.FilePath
// In source-linked deployment files are not copied and resources use source files, therefore we use sync path as file path in metadata
if config.IsExplicitlyEnabled(b.Config.Presets.SourceLinkedDeployment) { if config.IsExplicitlyEnabled(b.Config.Presets.SourceLinkedDeployment) {
b.Metadata.Config.Workspace.FilePath = b.SyncRootPath b.Metadata.Config.Workspace.FilePath = b.SyncRootPath
} }