Skip to content

Commit

Permalink
Don't copy unix sockets in atmos describe affected command (#640)
Browse files Browse the repository at this point in the history
* updates

* updates
  • Loading branch information
aknysh authored Jun 27, 2024
1 parent 84bba88 commit 798bdfb
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 14 deletions.
2 changes: 1 addition & 1 deletion atmos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# are independent settings (supporting both absolute and relative paths).
# If 'base_path' is provided, 'components.terraform.base_path', 'components.helmfile.base_path', 'stacks.base_path' and 'workflows.base_path'
# are considered paths relative to 'base_path'.
base_path: "./examples/quick-start"
base_path: "./examples/quick-start-advanced"

components:
terraform:
Expand Down
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.83.0
ARG ATMOS_VERSION=1.83.1

# Terraform: https://github.com/hashicorp/terraform/releases
ARG TF_VERSION=1.8.5
Expand Down
2 changes: 1 addition & 1 deletion examples/tests/atmos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ schemas:
atmos:
# Can also be set using 'ATMOS_SCHEMAS_ATMOS_MANIFEST' ENV var, or '--schemas-atmos-manifest' command-line argument
# Supports both absolute and relative paths (relative to the `base_path` setting in `atmos.yaml`)
manifest: "../quick-start/stacks/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json"
manifest: "../quick-start-advanced/stacks/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json"

# CLI command aliases
aliases:
Expand Down
10 changes: 10 additions & 0 deletions internal/exec/describe_affected_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,16 @@ func ExecuteDescribeAffectedWithTargetRefCheckout(
if strings.Contains(src, "node_modules") {
return true, nil
}

// Check if the file is a socket and skip it
isSocket, err := u.IsSocket(src)
if err != nil {
return true, err
}
if isSocket {
return true, nil
}

return false, nil
},
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/atlantis/atmos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ schemas:
atmos:
# Can also be set using 'ATMOS_SCHEMAS_ATMOS_MANIFEST' ENV var, or '--schemas-atmos-manifest' command-line arguments
# Supports both absolute and relative paths (relative to the `base_path` setting in `atmos.yaml`)
manifest: "../quick-start/stacks/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json"
manifest: "../quick-start-advanced/stacks/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json"

# `Go` templates in Atmos manifests
# https://atmos.tools/core-concepts/stacks/templates
Expand Down
2 changes: 1 addition & 1 deletion pkg/aws/atmos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ schemas:
atmos:
# Can also be set using 'ATMOS_SCHEMAS_ATMOS_MANIFEST' ENV var, or '--schemas-atmos-manifest' command-line arguments
# Supports both absolute and relative paths (relative to the `base_path` setting in `atmos.yaml`)
manifest: "../quick-start/stacks/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json"
manifest: "../quick-start-advanced/stacks/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json"

# `Go` templates in Atmos manifests
# https://atmos.tools/core-concepts/stacks/templates
Expand Down
2 changes: 1 addition & 1 deletion pkg/component/atmos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ schemas:
atmos:
# Can also be set using 'ATMOS_SCHEMAS_ATMOS_MANIFEST' ENV var, or '--schemas-atmos-manifest' command-line arguments
# Supports both absolute and relative paths (relative to the `base_path` setting in `atmos.yaml`)
manifest: "../quick-start/stacks/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json"
manifest: "../quick-start-advanced/stacks/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json"

# `Go` templates in Atmos manifests
# https://atmos.tools/core-concepts/stacks/templates
Expand Down
2 changes: 1 addition & 1 deletion pkg/describe/atmos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ schemas:
atmos:
# Can also be set using 'ATMOS_SCHEMAS_ATMOS_MANIFEST' ENV var, or '--schemas-atmos-manifest' command-line arguments
# Supports both absolute and relative paths (relative to the `base_path` setting in `atmos.yaml`)
manifest: "../quick-start/stacks/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json"
manifest: "../quick-start-advanced/stacks/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json"

# `Go` templates in Atmos manifests
# https://atmos.tools/core-concepts/stacks/templates
Expand Down
2 changes: 1 addition & 1 deletion pkg/generate/atmos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ schemas:
atmos:
# Can also be set using 'ATMOS_SCHEMAS_ATMOS_MANIFEST' ENV var, or '--schemas-atmos-manifest' command-line arguments
# Supports both absolute and relative paths (relative to the `base_path` setting in `atmos.yaml`)
manifest: "../quick-start/stacks/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json"
manifest: "../quick-start-advanced/stacks/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json"

# `Go` templates in Atmos manifests
# https://atmos.tools/core-concepts/stacks/templates
Expand Down
2 changes: 1 addition & 1 deletion pkg/spacelift/atmos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ schemas:
atmos:
# Can also be set using 'ATMOS_SCHEMAS_ATMOS_MANIFEST' ENV var, or '--schemas-atmos-manifest' command-line arguments
# Supports both absolute and relative paths (relative to the `base_path` setting in `atmos.yaml`)
manifest: "../quick-start/stacks/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json"
manifest: "../quick-start-advanced/stacks/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json"

# `Go` templates in Atmos manifests
# https://atmos.tools/core-concepts/stacks/templates
Expand Down
11 changes: 11 additions & 0 deletions pkg/utils/file_utils.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package utils

import (
"io/fs"
"os"
"path"
"path/filepath"
Expand Down Expand Up @@ -162,3 +163,13 @@ func GetAllYamlFilesInDir(dir string) ([]string, error) {

return res, nil
}

// IsSocket checks if a file is a socket
func IsSocket(path string) (bool, error) {
fileInfo, err := os.Stat(path)
if err != nil {
return false, err
}
isSocket := fileInfo.Mode().Type() == fs.ModeSocket
return isSocket, nil
}
2 changes: 1 addition & 1 deletion pkg/validate/atmos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ schemas:
atmos:
# Can also be set using 'ATMOS_SCHEMAS_ATMOS_MANIFEST' ENV var, or '--schemas-atmos-manifest' command-line arguments
# Supports both absolute and relative paths (relative to the `base_path` setting in `atmos.yaml`)
manifest: "../quick-start/stacks/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json"
manifest: "../quick-start-advanced/stacks/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json"

# `Go` templates in Atmos manifests
# https://atmos.tools/core-concepts/stacks/templates
Expand Down
2 changes: 1 addition & 1 deletion pkg/validate/validate_stacks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestValidateStacksCommand(t *testing.T) {
}

func TestValidateStacksCommandWithAtmosManifestJsonSchema(t *testing.T) {
err := e.ExecuteValidateStacksCmd(cmd.ValidateStacksCmd, []string{"--schemas-atmos-manifest", "../quick-start/stacks/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json"})
err := e.ExecuteValidateStacksCmd(cmd.ValidateStacksCmd, []string{"--schemas-atmos-manifest", "../quick-start-advanced/stacks/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json"})
u.LogError(err)
assert.NotNil(t, err)
}
2 changes: 1 addition & 1 deletion pkg/vender/atmos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ schemas:
atmos:
# Can also be set using 'ATMOS_SCHEMAS_ATMOS_MANIFEST' ENV var, or '--schemas-atmos-manifest' command-line arguments
# Supports both absolute and relative paths (relative to the `base_path` setting in `atmos.yaml`)
manifest: "../quick-start/stacks/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json"
manifest: "../quick-start-advanced/stacks/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json"

# `Go` templates in Atmos manifests
# https://atmos.tools/core-concepts/stacks/templates
Expand Down
2 changes: 1 addition & 1 deletion pkg/workflow/atmos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ schemas:
atmos:
# Can also be set using 'ATMOS_SCHEMAS_ATMOS_MANIFEST' ENV var, or '--schemas-atmos-manifest' command-line arguments
# Supports both absolute and relative paths (relative to the `base_path` setting in `atmos.yaml`)
manifest: "../quick-start/stacks/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json"
manifest: "../quick-start-advanced/stacks/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json"

# `Go` templates in Atmos manifests
# https://atmos.tools/core-concepts/stacks/templates
Expand Down
2 changes: 1 addition & 1 deletion website/docs/cli/commands/describe/describe-affected.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ The payload of the HTTP POST request will be a JSON object with the following sc
{
"component": "vpc",
"component_type": "terraform",
"component_path": "examples/quick-start/components/terraform/vpc",
"component_path": "examples/quick-start-advanced/components/terraform/vpc",
"stack": "plat-ue2-dev",
"stack_slug": "plat-ue2-dev-vpc",
"affected": "stack.vars",
Expand Down

0 comments on commit 798bdfb

Please sign in to comment.