Skip to content

batches: earlier template variable feedback

Administrator requested to merge aakr/template-var-feedback into main

Created by: adeola-ak

Cloese #36183

Added a function to our templating file that makes use of the existing templating library, text/template, by creating a function that searches a batch spec for known templating variables and returns whether or not the batch spec is valid or returns an error if the spec is found to be invalid due to an unrecognized template variable

The use of the template library is a little different from prior use due to not needing to actually replace the template variable, but to just check it, match it, and return an error if we cant

Kelli and I then decided to add this validation to the ReplaceBatchSpecInput service where other validation like checking the spec is valid and making sure the user has access occurs after a user previews their workspaces. Open to feedback if this was good placement

If an unknown template variable is detected, the UI will display the following error after a user attempts to preview workspaces

Screen Shot 2022-08-25 at 3 25 34 AM

Test plan

checked changes with a failing template variable and confirmed the correct error was surfaced in the UI

Merge request reports

Loading