You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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%?}
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.
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.
Activity
osterman commentedon Jan 16, 2023
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.
jamengual commentedon Jan 16, 2023
Erik Osterman (Cloud Posse) (@osterman) the repo config will not be merged by the PR, this will be a
pre-workflowhook that will create a temporary/dynamicatlantis.yamlfor the component/s affected but the completeatlantis.yamlwill be always created after a successful merge to themainbranch by another method ( github action in this case) like apost_workflow_hookI know where you are coming from and that was before we had
pre-workflowandpost-workflowhooks inatlantis, which allow for many things like dynamic generation ofatlantis.yamlfiles.https://www.runatlantis.io/docs/pre-workflow-hooks.html
https://www.runatlantis.io/docs/post-workflow-hooks.html
osterman commentedon Feb 1, 2023
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.
[-]implement atmos atlantis generate repo-config --affected-only[/-][+]implement `atmos atlantis generate repo-config --affected-only`[/+]