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

[Resolve #1446] Print edges in cyclical dependency #1447

Merged

Conversation

alex-harvey-z3q
Copy link
Contributor

@alex-harvey-z3q alex-harvey-z3q commented Feb 25, 2024

This adds some code to print a clearer error message similar to Terraform's when a cyclical dependency is detected in the graph.

Before this change an error message would look like:

Dependency cycle detected: configmap-lambda eks-securitygroups

After this change it becomes:

Dependency cycle detected: eks-securitygroups -> configmap-lambda, configmap-lambda -> eks-securitygroups

An example of a Terraform error message would be:

Error: Cycle: aws_scheduler_schedule.gh_runners_ubuntu_stop, aws_iam_role.gh_runners_ubuntu_scheduler_role, aws_scheduler_schedule.gh_runners_ubuntu_start

And for comparison see this related section of the source code for Terraform:
https://github.com/hashicorp/terraform/blob/268c8e264d22604f2a4ec516ed4df7a5bdef421f/internal/dag/dag.go#L117-L148

PR Checklist

  • Wrote a good commit message & description [see guide below].
  • Commit message starts with [Resolve #issue-number].
  • Added/Updated unit tests.
  • Added/Updated integration tests (if applicable).
  • All unit tests (poetry run tox) are passing.
  • Used the same coding conventions as the rest of the project.
  • The new code passes pre-commit validations (poetry run pre-commit run --all-files).
  • The PR relates to only one subject with a clear title.
    and description in grammatically correct, complete sentences.

Approver/Reviewer Checklist

  • Before merge squash related commits.

Other Information

Guide to writing a good commit

This adds some code to print a clearer error message similar to
Terraform's when a cyclical dependency is detected in the graph.

Before this change an error message would look like:
```
Dependency cycle detected: configmap-lambda eks-securitygroups
```

After this change it becomes:
```
Dependency cycle detected: eks-securitygroups -> configmap-lambda, configmap-lambda -> eks-securitygroups
```
@zaro0508 zaro0508 merged commit 993ef09 into Sceptre:master Mar 5, 2024
12 checks passed
@alex-harvey-z3q alex-harvey-z3q deleted the ah/1446-cyclical-dependencies branch March 5, 2024 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants