Update `atmos validate stacks` command @aknysh (#611)
what
- Update
atmos vendor pull
command - Update
atmos validate stacks
command - Add
--include-dependents
flag toatmos describe affected
command - Update docs
why
-
When executing
atmos vendor pull
, Atmos creates a temp directory to clone the remote repo into.
Atmos usesgo-getter
to download the sources into the temp directory. When cloning from the root of a repo w/o using modules (sub-paths),go-getter
does the following:- If the destination directory does not exist, it creates it and runs
git init
- If the destination directory exists, it should be an already initialized Git repository (otherwise an error will be thrown)
For more details, refer to
- If the destination directory does not exist, it creates it and runs
-
Don't check for duplicate abstract components in the same stack from different stack manifests. Abstract components are never provisioned and serve as blueprints for real components. This is an update (follow up) to the previous PRs:
-
The
--include-dependents
flag allows including dependencies for the affected components
If the command-line flag --include-dependents=true
is passed to the atmos describe affected
command, and there are other components that depend on the affected components in the stack, the command will include a dependents
property (list) for each affected component. The dependents
property is hierarchical - each component in the list will also contain a dependents
property if that component has dependent components as well.
For example, suppose that we have the following configuration for the Atmos components component-1
, component-2
and component-3
in the stack plat-ue2-dev
:
components:
terraform:
component-1:
metadata:
component: "terraform-component-1"
vars: {}
component-2:
metadata:
component: "terraform-component-2"
vars: {}
settings:
depends_on:
1:
component: "component-1"
component-3:
metadata:
component: "terraform-component-3"
vars: {}
settings:
depends_on:
1:
component: "component-2"
In the above configuration, component-3
depends on component-2
, whereas component-2
depends on component-1
.
If all the components are affected (modified) in the current working branch, the atmos describe affected --include-dependents=true
command will produce the following result:
[
{
"component": "component-1",
"stack": "plat-ue2-dev",
"stack_slug": "plat-ue2-dev-component-1",
"included_in_dependents": false,
"dependents": [
{
"component": "component-2",
"stack": "plat-ue2-dev",
"stack_slug": "plat-ue2-dev-component-2",
"dependents": [
{
"component": "component-3",
"stack": "plat-ue2-dev",
"stack_slug": "plat-ue2-dev-component-3"
}
]
}
]
},
{
"component": "component-2",
"stack": "plat-ue2-dev",
"stack_slug": "plat-ue2-dev-component-2",
"included_in_dependents": true,
"dependents": [
{
"component": "component-3",
"stack": "plat-ue2-dev",
"stack_slug": "plat-ue2-dev-component-3"
}
]
},
{
"component": "component-3",
"stack": "plat-ue2-dev",
"stack_slug": "plat-ue2-dev-component-3",
"included_in_dependents": true
}
]
The component-1
component does not depend on any other component, and therefore it has the included_in_dependents
attribute set to false
. The component-2
and component-3
components depend on other components and are included in the dependents
property of the other components, and hence the included_in_dependents
attribute is set to true
.
When processing the above output, you might decide to not plan/apply the component-2
and component-3
components since they are in the dependents
property of the component-1
component. Instead, you might just trigger component-1
and then component-2
and component-3
in the order of dependencies.