Skip to content
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

Add --upload flag to atmos describe affected command #631

Merged
merged 13 commits into from
Jun 23, 2024
Merged

Conversation

aknysh
Copy link
Member

@aknysh aknysh commented Jun 21, 2024

what

why

If the --upload=true command-line flag is passed, Atmos will upload the affected components and stacks to a specified HTTP endpoint.

The endpoint can process the affected components and their dependencies in a CI/CD pipeline (e.g. execute terraform apply on all the affected components in the stacks and all the dependencies).

Atmos will perform an HTTP POST request to the URL ${ATMOS_PRO_BASE_URL}/${ATMOS_PRO_ENDPOINT}, where the base URL is defined by the ATMOS_PRO_BASE_URL environment variable, and the URL path is defined by the ATMOS_PRO_ENDPOINT environment variable.

An Authorization header Authorization: Bearer $ATMOS_PRO_TOKEN will be added to the HTTP request (if the ATMOS_PRO_TOKEN environment variable is set) to provide credentials to authenticate with the server.

NOTE: If the --upload=true command-line flag is passed, the --include-dependencies and --include-settings flags are automatically set to true, so the affected components will be uploaded with their dependencies and settings (if they are configured in Atmos stack manifests).

The payload of the HTTP POST request will be a JSON object with the following schema:

  {
     "base_sha": "6746ba4df9e87690c33297fe740011e5ccefc1f9",
     "head_sha": "5360d911d9bac669095eee1ca1888c3ef5291084",
     "repo_url": "https://github.com/cloudposse/atmos",
     "repo_host": "github.com",
     "repo_name": "atmos",
     "repo_owner": "cloudposse",
     "stacks": [
        {
          "component": "vpc",
          "component_type": "terraform",
          "component_path": "examples/quick-start/components/terraform/vpc",
          "stack": "plat-ue2-dev",
          "stack_slug": "plat-ue2-dev-vpc",
          "affected": "stack.vars",
          "included_in_dependents": false,
          "dependents": [],
          "settings": {}
        }
    ]
 }

where:

  • base_sha - the Git commit SHA of the base branch against which the changes in the current commit are compared

  • head_sha - the SHA of the current Git commit

  • repo_url - the URL of the current repository

  • repo_host - the host of the current repository

  • repo_name - the name of the current repository

  • repo_owner - the owner of the current repository

  • stacks - a list of affected components and stacks with their dependencies

@aknysh aknysh added the minor New features that do not break anything label Jun 21, 2024
@aknysh aknysh requested a review from osterman June 21, 2024 00:10
@aknysh aknysh self-assigned this Jun 21, 2024
@aknysh aknysh requested review from a team as code owners June 21, 2024 00:10
@aknysh aknysh requested review from hans-d and joe-niland June 21, 2024 00:10
@aknysh aknysh requested a review from mcalhoun June 21, 2024 00:10
Copy link
Member

@mcalhoun mcalhoun left a comment

Choose a reason for hiding this comment

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

It's looking really good! I left a few comments and asked for some changes.

website/docs/cli/commands/describe/describe-affected.mdx Outdated Show resolved Hide resolved
website/docs/cli/configuration.mdx Outdated Show resolved Hide resolved
Copy link
Member

@mcalhoun mcalhoun left a comment

Choose a reason for hiding this comment

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

I made a couple more small comments/requests for change and then this looks good to merge to me. Thanks!

internal/exec/describe_affected.go Show resolved Hide resolved
internal/exec/describe_affected.go Outdated Show resolved Hide resolved
Copy link
Member

@mcalhoun mcalhoun left a comment

Choose a reason for hiding this comment

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

Approving the PR, but still don't agree that we shouldn't warn/error when the API token isn't set (see my comment).

@aknysh aknysh merged commit 2290855 into main Jun 23, 2024
14 checks passed
@aknysh aknysh deleted the atmos-pro-1 branch June 23, 2024 01:32
Copy link

These changes were released in v1.82.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.

3 participants