-
-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update atmos describe affected
command. Update docs
#590
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Conflicts: # examples/quick-start/Dockerfile
osterman
reviewed
Apr 30, 2024
osterman
reviewed
Apr 30, 2024
osterman
reviewed
Apr 30, 2024
osterman
reviewed
Apr 30, 2024
osterman
reviewed
Apr 30, 2024
osterman
reviewed
Apr 30, 2024
osterman
reviewed
Apr 30, 2024
osterman
reviewed
Apr 30, 2024
osterman
reviewed
Apr 30, 2024
osterman
reviewed
Apr 30, 2024
address comments Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]>
osterman
previously approved these changes
Apr 30, 2024
osterman
approved these changes
Apr 30, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
what
Update
atmos describe affected
commandAdd
--clone-target-ref
flag to theatmos describe affected
commandUpdate docs. Add "Remote State Backend" doc
why
"Remote State Backend" doc describes how to override Terraform Backend Configuration to access components remote state, and how to do Brownfield development in Atmos
Simplify the
atmos describe affected
command to not force it to clone the remote target reference (branch or tag), but instead just check it out (assuming the target reference is already on the local file system)Add
--clone-target-ref
flag to theatmos describe affected
command for backwards compatibility. If the flag is passed, the command behaves as the old version (clones the target reference first from the remote origin)breaking changes
If the
atmos describe affected
command was used in a GitHub Action (similar to https://github.com/cloudposse/github-action-atmos-affected-stacks), and the action performed a shallow Git clone (instead of a deep clone), it will break with an error that the target reference (branch) does not exist on the file system. There are a few ways to fix it:Use the flag
--clone-target-ref=true
to force the command to clone the target reference from the remote origin (this flag is addd for backwards compatibility)atmos describe affected --clone-target-ref=true
Update the GitHub Action to perform a deep-clone instead of a shallow-clone
Perform a clone of the target branch into a separate directory and use the
--repo-path=<dir>
command line parameter to specify the path to the already cloned target repository (refer to https://atmos.tools/cli/commands/describe/affected#flags)description
The
atmos describe affected
command uses two different Git commits to produce a list of affected Atmos components and stacks.For the first commit, the command assumes that the current repo root is a Git checkout. An error will be thrown if the
current repo is not a Git repository (the
.git/
folder does not exist or is configured incorrectly).The second commit can be specified on the command line by using the
--ref
(Git References) or--sha
(commit SHA) flags. The--sha
takes precedence over the--ref
flag.How does it work?
The command performs the following:
If the
--repo-path
flag is passed, the command uses it as the path to the already cloned target repo with which to compare the current working branch. I this case, the command will not clone and checkout the target reference, but instead will use the already cloned one to compare the current branch with. In this case, the--ref
,--sha
,--ssh-key
and--ssh-key-password
flags are not used, and an error will be thrown if the--repo-path
flag and any of the--ref
,--sha
,--ssh-key
or--ssh-key-password
flags are provided at the same timeOtherwise, if the
--clone-target-ref=true
flag is specified, the command clones (into a temp directory) the remote target with which to compare the current working branch. If the--ref
flag or the commit SHA flag--sha
are provided, the command uses them to clone and checkout the remote target. Otherwise, theHEAD
of the remote origin is used (refs/remotes/origin/HEAD
Git ref, usually themain
branch)Otherwise, (if the
--repo-path
and--clone-target-ref=true
flags are not passed), the command does not clone anything from the remote origin, but instead just copies the current repo into a temp directory and checks out the target reference with which to compare the current working branch. If the--ref
flag or the commit SHA flag--sha
are provided, the command uses them to check out. Otherwise, theHEAD
of the remote origin is used (refs/remotes/origin/HEAD
Git ref, usually themain
branch). This requires that the target reference is already cloned by Git, and the information about it exists in the.git
directory (in case of using a non-default branch as the target, Git deep clone needs to be executed instead of a shallow clone). This is the recommended way to execute theatmos describe affected
command since it allows working with private repositories without providing the SSH credentials (--ssh-key
and--ssh-key-password
flags), since in this case Atmos does not access the remote origin and instead just checks out the target reference (which is already on the local file system)The command deep-merges all stack configurations from both sources: the current working branch and the target reference
The command searches for changes in the component directories
The command compares each stack manifest section of the stack configurations from both sources looking for differences
And finally, the command outputs a JSON or YAML document consisting of a list of the affected components and stacks and what caused it to be affected