Skip to content

Commit

Permalink
fix: Detailed message for using source-linked deployment with file_pa…
Browse files Browse the repository at this point in the history
…th specified (#2119)

## Changes

Resolves remaining comments from here
#2046


[This](#2046 (comment))
and
[this](#2046 (comment))
are on hold until Pieter's response

## Tests
<!-- How is this tested? -->
  • Loading branch information
ilyakuz-db authored Jan 20, 2025
1 parent 69f3c0a commit 84a7305
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,18 @@ func (m *applySourceLinkedDeploymentPreset) Apply(ctx context.Context, b *bundle
return diags
}

// 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) {
path := dyn.NewPath(dyn.Key("targets"), dyn.Key(target), dyn.Key("workspace"), dyn.Key("file_path"))

path := dyn.NewPath(dyn.Key("workspace"), dyn.Key("file_path"))
diags = diags.Append(
diag.Diagnostic{
Severity: diag.Warning,
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{
path[2:],
path,
},
Locations: b.Config.GetLocations(path[2:].String()),
Locations: b.Config.GetLocations(path.String()),
},
)
}
Expand Down
1 change: 1 addition & 0 deletions bundle/deploy/metadata/compute.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func (m *compute) Apply(_ context.Context, b *bundle.Bundle) diag.Diagnostics {

// Set file upload destination of the bundle in metadata
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) {
b.Metadata.Config.Workspace.FilePath = b.SyncRootPath
}
Expand Down

0 comments on commit 84a7305

Please sign in to comment.