Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
mcalhoun committed Jan 10, 2025
2 parents 5dc689b + c399118 commit a78551f
Show file tree
Hide file tree
Showing 133 changed files with 2,638 additions and 352 deletions.
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[*]
insert_final_newline = true
end_of_line = lf

# Override for Makefile
[{Makefile,makefile,GNUmakefile}]
Expand Down
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
* text eol=lf
docs linguist-documentation=true
website/src/components/screengrabs/**.html linguist-generated=true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@
.direnv/

.atmos/cache.yaml
**/cache.*.txt
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2020-2024 Cloud Posse, LLC
Copyright 2020-2025 Cloud Posse, LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
14 changes: 8 additions & 6 deletions 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: "."
base_path: ""

vendor:
# Path to vendor configuration file or directory containing vendor files
Expand Down Expand Up @@ -272,19 +272,21 @@ schemas:
opa:
# Can also be set using 'ATMOS_SCHEMAS_OPA_BASE_PATH' ENV var, or '--schemas-opa-dir' command-line argument
# Supports both absolute and relative paths
# If not specified in `atmos.yaml` in `schemas.atmos.manifest`, an embedded schema will be used
base_path: "stacks/schemas/opa"
# JSON Schema to validate Atmos manifests
# https://atmos.tools/cli/schemas/
# https://atmos.tools/cli/commands/validate/stacks/
# https://atmos.tools/quick-start/advanced/configure-validation/
# https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json
# https://json-schema.org/draft/2020-12/release-notes
# https://www.schemastore.org/json
# https://github.com/SchemaStore/schemastore
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: "stacks/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json"
# 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`)
# Supports URLs like https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json
# manifest: "stacks/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json"
# manifest: "https://atmos.tools/schemas/atmos/atmos-manifest/1.0/atmos-manifest.json"

# `Go` templates in Atmos manifests
# https://atmos.tools/core-concepts/stacks/templates
Expand Down
5 changes: 4 additions & 1 deletion cmd/about.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ var aboutCmd = &cobra.Command{
return fmt.Errorf("failed to render about documentation: %w", err)
}

fmt.Fprint(os.Stdout, out)
_, err = fmt.Fprint(os.Stdout, out)
if err != nil {
return err
}
return nil
},
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/atlantis.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
// atlantisCmd executes Atlantis commands
var atlantisCmd = &cobra.Command{
Use: "atlantis",
Short: "Execute 'atlantis' commands",
Long: `This command executes Atlantis integration commands`,
Short: "Generate and manage Atlantis configurations",
Long: `Generate and manage Atlantis configurations that use Atmos under the hood to run Terraform workflows, bringing the power of Atmos to Atlantis for streamlined infrastructure automation.`,
FParseErrWhitelist: struct{ UnknownFlags bool }{UnknownFlags: false},
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/atlantis_generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
// atlantisGenerateCmd generates various Atlantis configurations
var atlantisGenerateCmd = &cobra.Command{
Use: "generate",
Short: "Execute 'atlantis generate' commands",
Long: "This command generates various Atlantis configurations",
Short: "Generate Atlantis configuration files",
Long: "This command generates configuration files to automate and streamline Terraform workflows with Atlantis.",
FParseErrWhitelist: struct{ UnknownFlags bool }{UnknownFlags: false},
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/atlantis_generate_repo_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
// atlantisGenerateRepoConfigCmd generates repository configuration for Atlantis
var atlantisGenerateRepoConfigCmd = &cobra.Command{
Use: "repo-config",
Short: "Execute 'atlantis generate repo-config`",
Long: "This command generates repository configuration for Atlantis",
Short: "Generate repository configuration for Atlantis",
Long: "Generate the repository configuration file required for Atlantis to manage Terraform repositories.",
FParseErrWhitelist: struct{ UnknownFlags bool }{UnknownFlags: false},
Run: func(cmd *cobra.Command, args []string) {
// Check Atmos configuration
Expand Down
4 changes: 2 additions & 2 deletions cmd/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
// awsCmd executes 'aws' CLI commands
var awsCmd = &cobra.Command{
Use: "aws",
Short: "Execute 'aws' commands",
Long: `This command executes 'aws' CLI commands`,
Short: "Run AWS-specific commands for interacting with cloud resources",
Long: `This command allows interaction with AWS resources through various CLI commands.`,
FParseErrWhitelist: struct{ UnknownFlags bool }{UnknownFlags: false},
}

Expand Down
11 changes: 8 additions & 3 deletions cmd/aws_eks.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ import (

// awsCmd executes 'aws eks' CLI commands
var awsEksCmd = &cobra.Command{
Use: "eks",
Short: "Execute 'aws eks' commands",
Long: `This command executes 'aws eks' CLI commands`,
Use: "eks",
Short: "Run AWS EKS CLI commands for cluster management",
Long: `Manage Amazon EKS clusters using AWS CLI, including configuring kubeconfig and performing cluster-related operations.
You can use this command to interact with AWS EKS, including operations like configuring kubeconfig, managing clusters, and more.
For a list of available AWS EKS commands, refer to the Atmos documentation:
https://atmos.tools/cli/commands/aws/eks-update-kubeconfig`,
FParseErrWhitelist: struct{ UnknownFlags bool }{UnknownFlags: false},
}

Expand Down
3 changes: 1 addition & 2 deletions cmd/aws_eks_update_kubeconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import (
// awsEksCmdUpdateKubeconfigCmd executes 'aws eks update-kubeconfig' command
var awsEksCmdUpdateKubeconfigCmd = &cobra.Command{
Use: "update-kubeconfig",
Short: "Execute 'aws eks update-kubeconfig' command",

Short: "Update 'kubeconfig' for an EKS cluster using AWS CLI",
Long: `This command executes 'aws eks update-kubeconfig' to download 'kubeconfig' from an EKS cluster and saves it to a file. The command executes 'aws eks update-kubeconfig' in three different ways:
1. If all the required parameters (cluster name and AWS profile/role) are provided on the command-line,
Expand Down
6 changes: 3 additions & 3 deletions cmd/cmd_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import (
"strings"
"time"

"github.com/fatih/color"
"github.com/spf13/cobra"

e "github.com/cloudposse/atmos/internal/exec"
tuiUtils "github.com/cloudposse/atmos/internal/tui/utils"
cfg "github.com/cloudposse/atmos/pkg/config"
"github.com/cloudposse/atmos/pkg/schema"
"github.com/cloudposse/atmos/pkg/ui/theme"
u "github.com/cloudposse/atmos/pkg/utils"
"github.com/cloudposse/atmos/pkg/version"
)
Expand Down Expand Up @@ -448,8 +448,8 @@ func checkAtmosConfig(opts ...AtmosValidateOption) {

// printMessageForMissingAtmosConfig prints Atmos logo and instructions on how to configure and start using Atmos
func printMessageForMissingAtmosConfig(atmosConfig schema.AtmosConfiguration) {
c1 := color.New(color.FgCyan)
c2 := color.New(color.FgGreen)
c1 := theme.Colors.Info
c2 := theme.Colors.Success

fmt.Println()
err := tuiUtils.PrintStyledText("ATMOS")
Expand Down
2 changes: 1 addition & 1 deletion cmd/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

var completionCmd = &cobra.Command{
Use: "completion [bash|zsh|fish|powershell]",
Short: "Generate completion script for Bash, Zsh, Fish and PowerShell",
Short: "Generate autocompletion scripts for Bash, Zsh, Fish, and PowerShell",
Long: "This command generates completion scripts for Bash, Zsh, Fish and PowerShell",
DisableFlagsInUseLine: true,
ValidArgs: []string{"bash", "zsh", "fish", "powershell"},
Expand Down
6 changes: 4 additions & 2 deletions cmd/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import (
// describeCmd describes configuration for stacks and components
var describeCmd = &cobra.Command{
Use: "describe",
Short: "Execute 'describe' commands",
Long: `This command shows configuration for CLI, stacks and components`,
Short: "Show details about Atmos configurations and components",
Long: `Display configuration details for Atmos CLI, stacks, and components.`,
FParseErrWhitelist: struct{ UnknownFlags bool }{UnknownFlags: false},
}

func init() {
describeCmd.PersistentFlags().StringP("query", "q", "", "Query the results of an 'atmos describe' command using 'yq' expressions: atmos describe <subcommand> --query <yq-expression>")

RootCmd.AddCommand(describeCmd)
}
4 changes: 2 additions & 2 deletions cmd/describe_affected.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
// describeAffectedCmd produces a list of the affected Atmos components and stacks given two Git commits
var describeAffectedCmd = &cobra.Command{
Use: "affected",
Short: "Execute 'describe affected' command",
Long: `This command produces a list of the affected Atmos components and stacks given two Git commits: atmos describe affected [options]`,
Short: "List Atmos components and stacks affected by two Git commits",
Long: "Identify and list Atmos components and stacks impacted by changes between two Git commits.",
FParseErrWhitelist: struct{ UnknownFlags bool }{UnknownFlags: false},
Run: func(cmd *cobra.Command, args []string) {
// Check Atmos configuration
Expand Down
4 changes: 2 additions & 2 deletions cmd/describe_component.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
// describeComponentCmd describes configuration for components
var describeComponentCmd = &cobra.Command{
Use: "component",
Short: "Execute 'describe component' command",
Long: `This command shows configuration for an Atmos component in an Atmos stack: atmos describe component <component> -s <stack>`,
Short: "Show configuration details for an Atmos component in a stack",
Long: `Display the configuration details for a specific Atmos component within a designated Atmos stack, including its dependencies, settings, and overrides.`,
FParseErrWhitelist: struct{ UnknownFlags bool }{UnknownFlags: false},
Run: func(cmd *cobra.Command, args []string) {
// Check Atmos configuration
Expand Down
4 changes: 2 additions & 2 deletions cmd/describe_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
// describeComponentCmd describes configuration for components
var describeConfigCmd = &cobra.Command{
Use: "config",
Short: "Execute 'describe config' command",
Long: `This command shows the final (deep-merged) CLI configuration: atmos describe config`,
Short: "Display the final merged CLI configuration",
Long: "This command displays the final, deep-merged CLI configuration after combining all relevant configuration files.",
FParseErrWhitelist: struct{ UnknownFlags bool }{UnknownFlags: false},
Run: func(cmd *cobra.Command, args []string) {
err := e.ExecuteDescribeConfigCmd(cmd, args)
Expand Down
4 changes: 2 additions & 2 deletions cmd/describe_dependents.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
var describeDependentsCmd = &cobra.Command{
Use: "dependents",
Aliases: []string{"dependants"},
Short: "Execute 'describe dependents' command",
Long: `This command produces a list of Atmos components in Atmos stacks that depend on the provided Atmos component: atmos describe dependents [options]`,
Short: "List Atmos components that depend on a given component",
Long: "This command generates a list of Atmos components within stacks that depend on the specified Atmos component.",
FParseErrWhitelist: struct{ UnknownFlags bool }{UnknownFlags: false},
Run: func(cmd *cobra.Command, args []string) {
// Check Atmos configuration
Expand Down
4 changes: 2 additions & 2 deletions cmd/describe_stacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
// describeStacksCmd describes configuration for stacks and components in the stacks
var describeStacksCmd = &cobra.Command{
Use: "stacks",
Short: "Execute 'describe stacks' command",
Long: `This command shows configuration for atmos stacks and components in the stacks: atmos describe stacks [options]`,
Short: "Display configuration for Atmos stacks and their components",
Long: "This command shows the configuration details for Atmos stacks and the components within those stacks.",
FParseErrWhitelist: struct{ UnknownFlags bool }{UnknownFlags: false},
Run: func(cmd *cobra.Command, args []string) {
// Check Atmos configuration
Expand Down
4 changes: 2 additions & 2 deletions cmd/describe_workflows.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
// describeWorkflowsCmd executes 'atmos describe workflows' CLI commands
var describeWorkflowsCmd = &cobra.Command{
Use: "workflows",
Short: "Execute 'describe workflows' commands",
Long: `This command executes 'atmos describe workflows' CLI command`,
Short: "List Atmos workflows and their associated files",
Long: "List all Atmos workflows, showing their associated files and workflow names for easy reference.",
Example: "describe workflows\n" +
"describe workflows --format json\n" +
"describe workflows -f yaml\n" +
Expand Down
2 changes: 1 addition & 1 deletion cmd/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const atmosDocsURL = "https://atmos.tools"
// docsCmd opens the Atmos docs and can display component documentation
var docsCmd = &cobra.Command{
Use: "docs",
Short: "Open the Atmos docs or display component documentation",
Short: "Open Atmos documentation or display component-specific docs",
Long: `This command opens the Atmos docs or displays the documentation for a specified Atmos component.`,
Example: "atmos docs vpc",
Args: cobra.MaximumNArgs(1),
Expand Down
4 changes: 2 additions & 2 deletions cmd/helmfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
var helmfileCmd = &cobra.Command{
Use: "helmfile",
Aliases: []string{"hf"},
Short: "Execute 'helmfile' commands",
Long: `This command runs Helmfile commands`,
Short: "Manage Helmfile-based Kubernetes deployments",
Long: `This command runs Helmfile commands to manage Kubernetes deployments using Helmfile.`,
FParseErrWhitelist: struct{ UnknownFlags bool }{UnknownFlags: true},
Run: func(cmd *cobra.Command, args []string) {

Expand Down
4 changes: 2 additions & 2 deletions cmd/helmfile_generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
// helmfileGenerateCmd generates configurations for helmfile components
var helmfileGenerateCmd = &cobra.Command{
Use: "generate",
Short: "Execute 'helmfile generate' commands",
Long: "This command generates configurations for helmfile components",
Short: "Generate configurations for Helmfile components",
Long: "This command generates various configuration files for Helmfile components in Atmos.",
FParseErrWhitelist: struct{ UnknownFlags bool }{UnknownFlags: false},
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/helmfile_generate_varfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
// helmfileGenerateVarfileCmd generates varfile for a helmfile component
var helmfileGenerateVarfileCmd = &cobra.Command{
Use: "varfile",
Short: "Execute 'helmfile generate varfile' command",
Long: `This command generates a varfile for an atmos helmfile component: atmos helmfile generate varfile <component> -s <stack> -f <file>`,
Short: "Generate a values file for a Helmfile component",
Long: "This command generates a values file for a specified Helmfile component.",
FParseErrWhitelist: struct{ UnknownFlags bool }{UnknownFlags: false},
Run: func(cmd *cobra.Command, args []string) {
// Check Atmos configuration
Expand Down
4 changes: 2 additions & 2 deletions cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
// listCmd commands list stacks and components
var listCmd = &cobra.Command{
Use: "list",
Short: "Execute 'list' commands",
Long: `This command lists stacks and components`,
Short: "List available stacks and components",
Long: `Display a list of all available stacks and components defined in your project.`,
FParseErrWhitelist: struct{ UnknownFlags bool }{UnknownFlags: false},
}

Expand Down
26 changes: 17 additions & 9 deletions cmd/list_components.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,56 @@ package cmd
import (
"fmt"

"github.com/fatih/color"
"github.com/spf13/cobra"

e "github.com/cloudposse/atmos/internal/exec"
"github.com/cloudposse/atmos/pkg/config"
l "github.com/cloudposse/atmos/pkg/list"
"github.com/cloudposse/atmos/pkg/schema"
"github.com/cloudposse/atmos/pkg/ui/theme"
u "github.com/cloudposse/atmos/pkg/utils"
"github.com/fatih/color"
"github.com/spf13/cobra"
)

// listComponentsCmd lists atmos components
var listComponentsCmd = &cobra.Command{
Use: "components",
Short: "Execute 'list components' command",
Long: `This command lists all Atmos components or filters components by stacks.`,
Short: "List all Atmos components or filter by stack",
Long: "List Atmos components, with options to filter results by specific stacks.",
Example: "atmos list components\n" +
"atmos list components -s <stack>",
Run: func(cmd *cobra.Command, args []string) {
// Check Atmos configuration
checkAtmosConfig()

stackFlag, _ := cmd.Flags().GetString("stack")
flags := cmd.Flags()

stackFlag, err := flags.GetString("stack")
if err != nil {
u.PrintMessageInColor(fmt.Sprintf("Error getting the 'stack' flag: %v", err), color.New(color.FgRed))
return
}

configAndStacksInfo := schema.ConfigAndStacksInfo{}
atmosConfig, err := config.InitCliConfig(configAndStacksInfo, true)
if err != nil {
u.PrintMessageInColor(fmt.Sprintf("Error initializing CLI config: %v", err), color.New(color.FgRed))
u.PrintMessageInColor(fmt.Sprintf("Error initializing CLI config: %v", err), theme.Colors.Error)
return
}

stacksMap, err := e.ExecuteDescribeStacks(atmosConfig, "", nil, nil, nil, false, false, false)
if err != nil {
u.PrintMessageInColor(fmt.Sprintf("Error describing stacks: %v", err), color.New(color.FgRed))
u.PrintMessageInColor(fmt.Sprintf("Error describing stacks: %v", err), theme.Colors.Error)
return
}

output, err := l.FilterAndListComponents(stackFlag, stacksMap)
if err != nil {
u.PrintMessageInColor(fmt.Sprintf("Error: %v"+"\n", err), color.New(color.FgYellow))
u.PrintMessageInColor(fmt.Sprintf("Error: %v"+"\n", err), theme.Colors.Warning)
return
}

u.PrintMessageInColor(output, color.New(color.FgGreen))
u.PrintMessageInColor(output, theme.Colors.Success)
},
}

Expand Down
Loading

0 comments on commit a78551f

Please sign in to comment.