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

refactor(pipeline): refactor the condition evaluation #952

Merged
merged 2 commits into from
Jan 14, 2025

Conversation

donch1989
Copy link
Member

@donch1989 donch1989 commented Jan 14, 2025

Because

  • The original implementation for pipeline condition evaluation is not robust. It converts the condition string into Go code and evaluates it using the AST. However, in our syntax, we typically use dot notation in recipes, while Go maps require bracket notation, especially when component or variable names are not valid Go identifiers.

This commit

  • Refactors the condition evaluation.

@donch1989 donch1989 requested a review from jvallesm as a code owner January 14, 2025 09:25
Copy link

linear bot commented Jan 14, 2025

pkg/recipe/eval.go Fixed Show fixed Hide fixed
jvallesm
jvallesm previously approved these changes Jan 14, 2025
Copy link
Collaborator

@jvallesm jvallesm left a comment

Choose a reason for hiding this comment

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

⚡ ⚡ I couldn't have fixed this so quickly, I was still diving through the condition evaluation logic 😅

@donch1989
Copy link
Member Author

⚡ ⚡ I couldn't have fixed this so quickly, I was still diving through the condition evaluation logic 😅

The primary process involves converting our recipe syntax into Go code and utilizing the Go AST to evaluate the values. It may be somewhat complex to write initially, but I believe it won’t require much maintenance once it is stabilized.

@donch1989 donch1989 merged commit 4d932da into main Jan 14, 2025
12 checks passed
@donch1989 donch1989 deleted the huitang/ins-7229 branch January 14, 2025 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: No status
Development

Successfully merging this pull request may close these issues.

3 participants