Skip to content

feat: Atmos List Instances, Pro Upload - #1254

Merged
Andriy Knysh (aknysh) merged 213 commits into
mainfrom
feat/atmos-list-upload
Sep 24, 2025
Merged

Andriy Knysh (aknysh) merged 213 commits into
mainfrom
feat/atmos-list-upload

Conversation

@milldr

@milldr Dan Miller (milldr) commented May 15, 2025 •

Copy link
Copy Markdown
Contributor

what

New command for atmos list instances

Includes option for --upload

  • If --upload, send the result to Atmos Pro

New arg for atmos terraform plan, --upload-status

  • Upload the result of a Terraform plan to Atmos Pro

Other changes:

This pull request introduces new functionality for uploading Terraform plan results and Atmos instances to the Pro API, improves error handling throughout the codebase, and refactors several areas for clarity and maintainability. The most notable changes are the addition of status upload logic for Terraform plans, new error definitions for Pro API interactions, and the creation of a new command for listing Atmos instances. Below are the key changes grouped by theme.

Pro API Integration and Terraform Plan Status Upload:

  • Added logic to upload Terraform plan results to the Pro API, including a new uploadStatus function and a flag (upload-status) for the plan command in cmd/terraform_commands.go and internal/exec/pro.go. This enables reporting of plan status and drift detection to the Pro API. [1] [2]
  • Implemented the shouldUploadStatus function to determine when status should be uploaded, based on command type and component settings.

Error Handling Improvements:

  • Added comprehensive new error definitions for Pro API client, exec, and list package errors in errors/errors.go, and refactored error wrapping to provide more context throughout the exec logic. [1] [2] [3] [4] [5] [6]

Atmos Instances Listing Command:

  • Introduced a new list instances command in cmd/list_instances.go to list Atmos instances and optionally upload them to the Pro API. This includes flag handling and integration with the existing list command structure.

API Client Construction Refactoring:

  • Refactored API client construction to remove the logger dependency, simplifying calls to NewAtmosProAPIClientFromEnv and related usage in internal/exec/describe_affected.go and internal/exec/pro.go. [1] [2] [3] [4]

Minor Codebase Cleanups:

  • Removed unused imports and improved import ordering in multiple files, such as cmd/cmd_utils.go, cmd/terraform_commands.go, and internal/exec/describe_affected.go. [1] [2] [3]

These changes collectively improve the reliability, maintainability, and feature set of the Atmos CLI, especially around integration with the Pro API and error visibility.

why

We want to build drift detection into Atmos Pro. In order to do this, we need to upload an object similar to the describe affected object. This object needs specific component instances for specific stacks

With atmos list instances --upload, we can find all component and stacks with drift detection and upload to Atmos Pro

With atmos terraform plan --upload-status, we can return the result of whether or not there is drift to AP

references

screenshots

CleanShot 2025-09-11 at 17 56 22@2x

Summary by CodeRabbit

  • New Features

    • New "list instances" command (TTY table + CSV) with optional upload of Pro-enabled instances and per-instance status uploads; plan command adds an upload-status flag.
  • Improvements

    • Pro uploads include run ID and Git SHA, use consistent HTTP timeouts, and yield clearer error/log messages.
    • Expanded schema/config support for Pro workflows, Atlantis, commands, markdown and vendor components; new Atmos‑Pro fixtures and templates.
  • Bug Fixes

    • List output now prefers nested vars when generating columns.
  • Tests

    • Many new unit/integration tests and updated golden snapshots for list and Pro flows.

@mergify

mergify Bot commented May 15, 2025

Copy link
Copy Markdown
Contributor

💥 This pull request now has conflicts. Could you fix it Dan Miller (@milldr)? 🙏

@mergify mergify Bot added conflict This PR has conflicts triage Needs triage labels May 15, 2025
@milldr Dan Miller (milldr) added the minor New features that do not break anything label May 15, 2025
@mergify mergify Bot removed the conflict This PR has conflicts label May 15, 2025
Comment thread cmd/list_deployments.go Fixed
Comment thread pkg/list/list_deployments.go Fixed
Comment thread pkg/list/list_deployments.go Fixed
Comment thread pkg/list/list_deployments.go Fixed
Comment thread pkg/list/list_deployments.go Fixed
Comment thread pkg/pro/api_client.go Fixed
Comment thread pkg/pro/api_client.go Fixed
Comment thread pkg/pro/requests.go Fixed
Comment thread pkg/schema/schema.go Fixed
Comment thread pkg/schema/schema.go Fixed
@codecov

codecov Bot commented May 15, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 62.39316% with 264 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.98%. Comparing base (e494ebc) to head (da27903).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
pkg/list/list_instances.go 53.36% 94 Missing and 3 partials ⚠️
pkg/git/git.go 0.00% 35 Missing ⚠️
internal/exec/pro.go 55.38% 26 Missing and 3 partials ⚠️
pkg/pro/api_client.go 86.07% 17 Missing and 5 partials ⚠️
cmd/list_instances.go 33.33% 18 Missing ⚠️
pkg/pro/api_client_instance_status.go 60.00% 12 Missing and 6 partials ⚠️
pkg/pro/api_client_instances.go 58.33% 10 Missing and 5 partials ⚠️
pkg/list/format/table.go 0.00% 12 Missing ⚠️
internal/exec/terraform.go 79.16% 9 Missing and 1 partial ⚠️
pkg/utils/slice_utils.go 92.72% 3 Missing and 1 partial ⚠️
... and 2 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1254      +/-   ##
==========================================
+ Coverage   56.71%   56.98%   +0.26%     
==========================================
  Files         280      284       +4     
  Lines       29708    30286     +578     
==========================================
+ Hits        16850    17259     +409     
- Misses      11045    11200     +155     
- Partials     1813     1827      +14     
Flag Coverage Δ
unittests 56.98% <62.39%> (+0.26%) ⬆️

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.

Comment thread pkg/list/list_deployments.go Fixed
Comment thread pkg/list/list_deployments.go Fixed
Comment thread pkg/list/list_deployments_test.go Fixed
Comment thread pkg/list/list_deployments_test.go Fixed
Comment thread pkg/list/list_deployments_test.go Fixed
Comment thread pkg/list/list_deployments_test.go Fixed
Comment thread pkg/list/list_deployments_test.go Fixed
Comment thread pkg/list/list_deployments_test.go Fixed
@coderabbitai coderabbitai Bot mentioned this pull request Jun 11, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-release Do not create a new release (wait for additional code changes) size/xl Extra large size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants