feat: Improve registry validation, error if unknown variables are used #289
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 aservices.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
beforetb registry validate
after