Skip to content

implement atmos atlantis generate repo-config --affected-only #303

Closed

Description

Have a question? Please checkout our Slack Community or visit our Slack Archive.

Slack Community

Describe the Feature

it will very useful to expand the atmos describe affected to the Atlantis integration to be able to generate an atlantis.yaml file of only the affected components instead of all the components.

this will be useful to limit the blast radius of possible changes a user can trigger in an attlantis project.

Expected Behavior

atmos atlantis generate repo-config --affected-only --ref refs/heads/main should only generate the atlantis.yaml file base on the branch specified.

Use Case

limit the blast radius of possible changes a user can trigger in an attlantis project.

Alternatives Considered

#!/usr/bin/env bash
atmos describe affected --ref refs/heads/main --file affected.json
stacks=""
components=""
for s in `jq -cr '.[]|.stack' affected.json|uniq`; do stacks+="${s},"; done
for c in `jq -cr '.[]|.component' affected.json|uniq`; do components+="${c},"; done

echo ${stacks%?}
echo ${components%?}

atmos atlantis generate repo-config --config-template config-1 --project-template project-1 --workflow-template workflow-1 --stacks ${stacks%?} --components ${components%?}

Additional Context

(#294)

Activity

  1. osterman commented on Jan 16, 2023

    @osterman
    Member

    PePe Amengual (@jamengual): The downside with this approach would be if the user then merges the PR with the new repo config, then all projects are affected. I think it sounds like a bad idea to modify the repo config to only be for the affected components. Multiple PRs will affect the repo config and you'll encounter lots of branch conflicts that need to be manually resolved. We've previously tried something like this with other stack configurations that were programmatically updated and it was impossible to manage the workflow due to all the conflicts since every PR attempts to modify the same config.

  2. jamengual commented on Jan 16, 2023

    @jamengual
    ContributorAuthor

    Erik Osterman (Cloud Posse) (@osterman) the repo config will not be merged by the PR, this will be a pre-workflow hook that will create a temporary/dynamic atlantis.yaml for the component/s affected but the complete atlantis.yaml will be always created after a successful merge to the main branch by another method ( github action in this case) like a post_workflow_hook

    I know where you are coming from and that was before we had pre-workflow and post-workflow hooks in atlantis, which allow for many things like dynamic generation of atlantis.yaml files.

    https://www.runatlantis.io/docs/pre-workflow-hooks.html
    https://www.runatlantis.io/docs/post-workflow-hooks.html

  3. osterman commented on Feb 1, 2023

    @osterman
    Member

    Aha! that's rad — I can see how that would work. Thanks for pointing it out. Specifically, https://www.runatlantis.io/docs/pre-workflow-hooks.html#dynamic-repo-config-generation

    I'll talk with the PM and see if/how we can get this work done.

  4. changed the title [-]implement atmos atlantis generate repo-config --affected-only[/-] [+]implement `atmos atlantis generate repo-config --affected-only`[/+] on Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions