Skip to content

Commit

Permalink
Introduce Atmos YAML functions !include and !env (#943)
Browse files Browse the repository at this point in the history
* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates

* updates
  • Loading branch information
aknysh authored Jan 20, 2025
1 parent 07c9e71 commit 15bad9a
Show file tree
Hide file tree
Showing 37 changed files with 1,001 additions and 309 deletions.
2 changes: 1 addition & 1 deletion examples/quick-start-advanced/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ARG GEODESIC_OS=debian
# https://atmos.tools/
# https://github.com/cloudposse/atmos
# https://github.com/cloudposse/atmos/releases
ARG ATMOS_VERSION=1.149.0
ARG ATMOS_VERSION=1.153.0

# Terraform: https://github.com/hashicorp/terraform/releases
ARG TF_VERSION=1.5.7
Expand Down
14 changes: 7 additions & 7 deletions go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 14 additions & 14 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/exec/describe_affected.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ func ExecuteDescribeAffectedCmd(cmd *cobra.Command, args []string) error {
return err
}

res, err := u.EvaluateYqExpression(atmosConfig, affected, a.Query)
res, err := u.EvaluateYqExpression(&atmosConfig, affected, a.Query)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/exec/describe_component.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func ExecuteDescribeComponentCmd(cmd *cobra.Command, args []string) error {
return err
}

res, err = u.EvaluateYqExpression(atmosConfig, componentSection, query)
res, err = u.EvaluateYqExpression(&atmosConfig, componentSection, query)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/exec/describe_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func ExecuteDescribeConfigCmd(cmd *cobra.Command, args []string) error {
var res any

if query != "" {
res, err = u.EvaluateYqExpression(atmosConfig, atmosConfig, query)
res, err = u.EvaluateYqExpression(&atmosConfig, atmosConfig, query)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/exec/describe_dependents.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func ExecuteDescribeDependentsCmd(cmd *cobra.Command, args []string) error {
var res any

if query != "" {
res, err = u.EvaluateYqExpression(atmosConfig, dependents, query)
res, err = u.EvaluateYqExpression(&atmosConfig, dependents, query)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/exec/describe_stacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func ExecuteDescribeStacksCmd(cmd *cobra.Command, args []string) error {
var res any

if query != "" {
res, err = u.EvaluateYqExpression(atmosConfig, finalStacksMap, query)
res, err = u.EvaluateYqExpression(&atmosConfig, finalStacksMap, query)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/exec/describe_workflows.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func ExecuteDescribeWorkflowsCmd(cmd *cobra.Command, args []string) error {
}

if query != "" {
res, err = u.EvaluateYqExpression(atmosConfig, res, query)
res, err = u.EvaluateYqExpression(&atmosConfig, res, query)
if err != nil {
return err
}
Expand Down
34 changes: 34 additions & 0 deletions internal/exec/file_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ package exec
import (
"fmt"
"io"
"net/url"
"os"
"path/filepath"
"runtime"
"strings"

"github.com/cloudposse/atmos/pkg/schema"
u "github.com/cloudposse/atmos/pkg/utils"
Expand Down Expand Up @@ -63,3 +67,33 @@ func printOrWriteToFile(

return nil
}

// SanitizeFileName replaces invalid characters and query strings with underscores for Windows.
func SanitizeFileName(uri string) string {
// Parse the URI to handle paths and query strings properly
parsed, err := url.Parse(uri)
if err != nil {
// Fallback to basic filepath.Base if URI parsing fails
return filepath.Base(uri)
}

// Extract the path component of the URI
base := filepath.Base(parsed.Path)

// This logic applies only to Windows
if runtime.GOOS != "windows" {
return base
}

// Replace invalid characters for Windows
base = strings.Map(func(r rune) rune {
switch r {
case '\\', '/', ':', '*', '?', '"', '<', '>', '|':
return '_'
default:
return r
}
}, base)

return base
}
Loading

0 comments on commit 15bad9a

Please sign in to comment.