Skip to content

Conversation

aknysh
Copy link
Member

@aknysh aknysh commented May 25, 2025

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 aknysh self-assigned this May 25, 2025
@aknysh aknysh requested a review from a team as a code owner May 25, 2025 12:56
@aknysh aknysh added the minor New features that do not break anything label May 25, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes May 25, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
pkg/atlantis/atlantis_generate_repo_config_test.go (1)

80-83: Good fix for path resolution in test environments.

This change properly addresses the path resolution issue when tests run in temporary directories. The explicit override ensures the configuration points to the correct fixture location regardless of where the test is executed.

Consider using filepath.Join or similar path utilities for better cross-platform compatibility:

-	atmosConfig.BasePath = "./tests/fixtures/scenarios/complete"
+	atmosConfig.BasePath = filepath.Join(".", "tests", "fixtures", "scenarios", "complete")
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9fd41bf and 0dc369b.

📒 Files selected for processing (1)
  • pkg/atlantis/atlantis_generate_repo_config_test.go (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Build (windows-latest, windows)
  • GitHub Check: Summary

coderabbitai[bot]
coderabbitai bot previously approved these changes May 25, 2025
Copy link

codecov bot commented May 25, 2025

Codecov Report

Attention: Patch coverage is 57.14286% with 60 lines in your changes missing coverage. Please review.

Project coverage is 49.14%. Comparing base (1953e23) to head (bf8517c).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/exec/describe_affected_utils.go 55.81% 54 Missing and 3 partials ⚠️
internal/exec/atlantis_generate_repo_config.go 33.33% 2 Missing ⚠️
internal/exec/vendor_component_utils.go 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1267      +/-   ##
==========================================
+ Coverage   48.40%   49.14%   +0.74%     
==========================================
  Files         233      233              
  Lines       25505    25497       -8     
==========================================
+ Hits        12345    12531     +186     
+ Misses      11554    11305     -249     
- Partials     1606     1661      +55     
Flag Coverage Δ
unittests 49.14% <57.14%> (+0.74%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aknysh aknysh requested a review from osterman May 25, 2025 15:15
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
website/docs/cli/commands/describe/describe-affected.mdx (3)

396-396: Typographical: consider using an em dash
To join two clauses or introduce an example, replace the hyphen after "affected" with an em dash for better readability:

- `affected` - shows the first (in the processing order) section that was changed.
+ `affected` — shows the first (in the processing order) section that was changed.
🧰 Tools
🪛 LanguageTool

[typographical] ~396-~396: To join two clauses or introduce examples, consider using an em dash.
Context: ...other affected component - affected - shows the first (in the processing order...

(DASH_RULE)


598-598: Typographical: em dash for definition
Similarly, use an em dash in the affected_all bullet for consistency:

- `affected_all` - shows all component sections and attributes that were changed
+ `affected_all` — shows all component sections and attributes that were changed
🧰 Tools
🪛 LanguageTool

[typographical] ~598-~598: To join two clauses or introduce examples, consider using an em dash.
Context: ... } ] ``` - affected_all - shows all component sections and attribu...

(DASH_RULE)


600-617: Align JSON example indentation
In the example output, the indentation of the affected_all array items is inconsistent (one item is indented with 12 spaces, the other with 13). Consider normalizing both to two-space indentation within the block for consistency:

-   "affected_all": [
-      "stack.vars",
-      "stack.settings"
-   ]
+  "affected_all": [
+    "stack.vars",
+    "stack.settings"
+  ]
🧰 Tools
🪛 LanguageTool

[style] ~600-~600: Consider shortening or rephrasing this to strengthen your wording.
Context: ...t were changed For example, if you make changes to the vars and settings sections of t...

(MAKE_CHANGES)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0dc369b and 02967b9.

📒 Files selected for processing (1)
  • website/docs/cli/commands/describe/describe-affected.mdx (14 hunks)
🧰 Additional context used
🪛 LanguageTool
website/docs/cli/commands/describe/describe-affected.mdx

[typographical] ~396-~396: To join two clauses or introduce examples, consider using an em dash.
Context: ...other affected component - affected - shows the first (in the processing order...

(DASH_RULE)


[typographical] ~598-~598: To join two clauses or introduce examples, consider using an em dash.
Context: ... } ] ``` - affected_all - shows all component sections and attribu...

(DASH_RULE)


[style] ~600-~600: Consider shortening or rephrasing this to strengthen your wording.
Context: ...t were changed For example, if you make changes to the vars and settings sections of t...

(MAKE_CHANGES)

⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: Build (windows-latest, windows)
  • GitHub Check: Lint (golangci)
  • GitHub Check: Build (ubuntu-latest, linux)
  • GitHub Check: website-deploy-preview
  • GitHub Check: Analyze (go)
  • GitHub Check: Summary
🔇 Additional comments (4)
website/docs/cli/commands/describe/describe-affected.mdx (4)

203-316: Readable definition list for flags
The conversion of the flags section from a table to a definition list (<dl>, <dt>, <dd>) enhances clarity and makes it easier to scan flag names and descriptions. Great improvement for maintainability.


343-343: Document new affected_all field in output schema
The JSON schema has been updated to include "affected_all": []. Ensure the accompanying description below clearly explains its purpose.


619-637: Example for new component is clear
The scenario demonstrating a newly created component and its affected_all entries is well-written and informative.


679-683: Clarify exclusion of abstract and disabled components
Good addition to note that abstract (metadata.type) and disabled (metadata.enabled) components are excluded. This addresses user expectations directly.

coderabbitai[bot]
coderabbitai bot previously approved these changes May 26, 2025
Copy link

mergify bot commented May 26, 2025

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 aknysh merged commit 6bde3fc into main May 26, 2025
51 checks passed
@aknysh aknysh deleted the update-describe-affected branch May 26, 2025 13:20
Copy link

These changes were released in v1.177.0.

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.

2 participants