feat(1259): sort projects based on dependencies
This implements: https://github.com/runatlantis/atlantis/issues/1259
feat(1259): atlantis destroy order
While creating the directed acyclic graph, it checks if the
terragrunt.hcl file of the stacks contains our destroy flag:
# ATLANTIS_PLEASE_DESTROY_STACK
If this flag is found, the corresponding edge will be reverted, i.e. instead of u -> v, we will get v -> u.
feat(1259): topological sort: fix and debugging
- this will output the dependency graph in *.dot format
- it will make the plan fail if the TopSort() fails for whatever reason
- sorting is not necessary when there is just one project
- dynamic folder/file generation
- remove some unnecessary else branches
- add a test for FindProjectNo()
- and most important: fix FindProjectNo() so that the sorting is correct
@juliusdanielherreraglomm if you can fix the conflicts and add an example of the problem is trying to solve that will be very helpful, thanks.
@jamengual Sure thing, conflict is fixed.
Example
If you have an atlantis.yaml like this:
version: 3
projects:
- autoplan:
enabled: true
when_modified:
- '*.hcl'
- '*.tf*'
- ../4/terragrunt.hcl
dir: dependency-test/1
- autoplan:
enabled: true
when_modified:
- '*.hcl'
- '*.tf*'
- ../3/terragrunt.hcl
dir: dependency-test/2
- autoplan:
enabled: true
when_modified:
- '*.hcl'
- '*.tf*'
- ../1/terragrunt.hcl
dir: dependency-test/3
- autoplan:
enabled: true
when_modified:
- '*.hcl'
- '*.tf*'
dir: dependency-test/4
this patch will plan/apply the changes in this order:
- dependency-test/4
- dependency-test/1
- dependency-test/3
- dependency-test/2
(Copied from test)
this is somewhat related https://github.com/runatlantis/atlantis/pull/2055 maybe you guys need to talk
Any word on this? It would solve a lot of problems for my team's use of this awesome tool.
Thanks for all the work on it!
@juliusdanielherreraglomm we will like to merge this soon and create a prerelease do you think you can address the comments and add a doc with an example of how to use it?
Thanks.
Test is failing
server/events/project_finder_test.go:599:31: not enough arguments in call to r.ParseRepoCfg
This issue is stale because it has been open for 1 month with no activity. Remove stale label or comment or this will be closed in 1 month.