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

feat: Improve registry validation, error if unknown variables are used #289

Merged
merged 3 commits into from
Jan 5, 2021

Conversation

cszatmary
Copy link
Contributor

@cszatmary cszatmary commented Dec 19, 2020

When reading a registry, detailed validation errors are recorded and reported. Instead of simply aborting after the first error, validation/parsing of a registry will continue if the error is not critical (ex: failing to read the file is will cause it to abort like before). This allows all the errors in a registry to be reported at once, allowing users to identify and fix all the issues instead of one at a time.

Additionally:

  • tb registry validate has received a complete overhaul. The majority of this was thanks to the changes mentioned above. By using the detailed errors returned, a much better output is generated for the user.
  • tb registry validate has a --strict flag which will error if unknown variables are encountered in a services.yml file. Currently, unknown variables were silently ignored and replaced with "". This was an unintended bug, which caused issues as tb would not report any errors, but then services would not behave as expected. However, changing this now would technically be a breaking change. As a result this solution has been designed in a non-breaking way. Users can opt into detecting unknown variables, but it will not be forced by default. In the future if we do a breaking change we could make this required.

tb registry validate before

image

tb registry validate after

image

@cszatmary cszatmary marked this pull request as ready for review January 5, 2021 17:37
Copy link
Contributor

@ohsabry ohsabry left a comment

Choose a reason for hiding this comment

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

good shit dude

@cszatmary cszatmary merged commit c7de7c8 into master Jan 5, 2021
@cszatmary cszatmary deleted the better-validation branch January 5, 2021 23:19
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