Skip to content

Update atmos describe affected command - #1267

Merged
Andriy Knysh (aknysh) merged 30 commits into
mainfrom
update-describe-affected
May 26, 2025
Merged

Andriy Knysh (aknysh) merged 30 commits into
mainfrom
update-describe-affected

Conversation

@aknysh

@aknysh Andriy Knysh (aknysh) commented May 25, 2025 •

Copy link
Copy Markdown
Member

what

  • Update atmos describe affected command
  • Add affected_all attribute to the output of atmos describe affected to show all component sections and attributes that were changed
  • Update docs
  • Add unit tests

why

  • Improve usage of the atmos describe affected command in CI/CD, e.g. GitHub actions

  • affected_all will allow detecting everything that was changed for a component in a stack (including Terraform configurations/components/modules) and ack on the changes

    For example, if you make changes to the vars and settings sections of the component component-1 in the
    nonprod stack, and execute atmos describe affected, you will get the following result:

      [
        {
          "component": "component-1",
          "component_type": "terraform",
          "stack": "nonprod",
          "stack_slug": "nonprod-component-1",
          "affected": "stack.vars",
          "affected_all": [
             "stack.vars",
             "stack.settings"
          ]
        }
      ]

    If you create a new Terraform/Tofu component, configure a new Atmos component component-1 in the
    nonprod stack, and execute atmos describe affected, you will get the following result:

    [
      {
        "component": "component-1",
        "component_type": "terraform",
        "stack": "nonprod",
        "stack_slug": "nonprod-component-1",
        "affected": "stack.metadata",
        "affected_all": [
          "component",
          "stack.metadata",
          "stack.vars",
          "stack.env",
          "stack.settings"
        ]
      }
    ]

    where:

    • affected shows that the Atmos component's metadata section was changed
      (since the component is new and the metadata section is the first section that Atmos processes)

    • affected_all shows all the affected sections and attributes:

      • component - the Terraform component (Terraform configuration) was affected (since it was just added)
      • stack.metadata - the Atmos component's metadata section was changed
      • stack.vars - the Atmos component's vars section was changed
      • stack.env - the Atmos component's env section was changed
      • stack.settings - the Atmos component's settings section was changed

Summary by CodeRabbit

  • New Features

    • Added a new output attribute, affected_all, to the output of the describe affected command, providing a list of all changed sections for affected components and stacks.
  • Bug Fixes

    • Improved handling of configuration and references by consistently using pointers for configuration objects.
  • Documentation

    • Updated CLI documentation to include and explain the new affected_all attribute, with revised examples and clarifications.
  • Tests

    • Added new tests for the describe affected command to verify correct behavior and output.
  • Refactor

    • Standardized logging and simplified temporary directory cleanup across multiple internal utilities.
    • Updated function signatures to use pointers for efficiency and consistency.

@aknysh Andriy Knysh (aknysh) self-assigned this May 25, 2025
@aknysh
Andriy Knysh (aknysh) requested a review from a team as a code owner May 25, 2025 12:56
@aknysh Andriy Knysh (aknysh) added the minor New features that do not break anything label May 25, 2025
Comment thread internal/exec/describe_affected_utils.go Fixed
Comment thread internal/exec/describe_affected_utils.go Fixed
sectionName string,
) bool {
if remoteStackSection, ok := remoteStacks[localStackName].(map[string]any); ok {
if remoteStackSection, ok := (*remoteStacks)[localStackName].(map[string]any); ok {

Check warning

Code scanning / golangci-lint

`if ok` has complex nested blocks (complexity: 15)

`if ok` has complex nested blocks (complexity: 15)
@mergify

mergify Bot commented May 26, 2025

Copy link
Copy Markdown
Contributor

Warning

This PR exceeds the recommended limit of 1,000 lines.

Large PRs are difficult to review and may be rejected due to their size.

Please verify that this PR does not address multiple issues.
Consider refactoring it into smaller, more focused PRs to facilitate a smoother review process.

@aknysh
Andriy Knysh (aknysh) merged commit 6bde3fc into main May 26, 2025
@aknysh
Andriy Knysh (aknysh) deleted the update-describe-affected branch May 26, 2025 13:20
@github-actions

Copy link
Copy Markdown

These changes were released in v1.177.0.

This branch was successfully deployed

No deployments
preview — bf8517c9 Deployed May 26, 2025 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

minor New features that do not break anything

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants