You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is currently a validation step for .lagoon.yml but it doesn't happen before the build tool needs to parse information from the file. In the case where a user has committed a malformed file (like using tabs instead of spaces) the build will fail with a cryptic error message:
++ cat .lagoon.yml
++ shyaml get-value environment_variables.git_sha false
Traceback (most recent call last):
File "/usr/bin/shyaml", line 8, in <module>
sys.exit(entrypoint())
^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/shyaml.py", line 831, in entrypoint
sys.exit(main(sys.argv[1:]))
^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/shyaml.py", line 781, in main
for output in do(stream=sys.stdin, **opts):
File "/usr/lib/python3.11/site-packages/shyaml.py", line 661, in do
for content in yaml.load_all(stream, Loader=loader):
File "/usr/lib/python3.11/site-packages/yaml/__init__.py", line 93, in load_all
yield loader.get_data()
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/yaml/constructor.py", line 45, in get_data
return self.construct_document(self.get_node())
^^^^^^^^^^^^^^^
File "yaml/_yaml.pyx", line 665, in yaml._yaml.CParser.get_node
File "yaml/_yaml.pyx", line 687, in yaml._yaml.CParser._compose_document
File "yaml/_yaml.pyx", line 731, in yaml._yaml.CParser._compose_node
File "yaml/_yaml.pyx", line 845, in yaml._yaml.CParser._compose_mapping_node
File "yaml/_yaml.pyx", line 731, in yaml._yaml.CParser._compose_node
File "yaml/_yaml.pyx", line 845, in yaml._yaml.CParser._compose_mapping_node
File "yaml/_yaml.pyx", line 731, in yaml._yaml.CParser._compose_node
File "yaml/_yaml.pyx", line 847, in yaml._yaml.CParser._compose_mapping_node
File "yaml/_yaml.pyx", line 860, in yaml._yaml.CParser._parse_next_event
yaml.parser.ParserError: while parsing a block mapping
in "<stdin>", line 110, column 5
did not find expected key
in "<stdin>", line 371, column 6
I think we should be able to do the validation step as the very first thing, before there are any calls to parse the file. This would be right after the git checkout and before the first shyaml call
Can our validator give a more useful error message about where in the yaml file the error is? Even if it can't, at least having the error put into the section that says There are issues with your .lagoon.yml file that must be fixed. would be an improvement.
Additionally, we might also move the storing of the .lagoon.ymlpre-deploy configmap before the validaton step? Then lagoon administrators would be able to look at the file in the case of an error.
The text was updated successfully, but these errors were encountered:
PR #289does some work to remove some of the shyaml. That PR still leaves the shyaml check for the git_sha there, but I think it can actually be removed if you read the comment I've left in the file.
There is currently a validation step for
.lagoon.yml
but it doesn't happen before the build tool needs to parse information from the file. In the case where a user has committed a malformed file (like using tabs instead of spaces) the build will fail with a cryptic error message:I think we should be able to do the validation step as the very first thing, before there are any calls to parse the file. This would be right after the git checkout and before the first
shyaml
callbuild-deploy-tool/legacy/build-deploy.sh
Lines 43 to 45 in dbd45d2
Can our validator give a more useful error message about where in the yaml file the error is? Even if it can't, at least having the error put into the section that says
There are issues with your .lagoon.yml file that must be fixed.
would be an improvement.Additionally, we might also move the storing of the
.lagoon.yml
pre-deploy configmap before the validaton step? Then lagoon administrators would be able to look at the file in the case of an error.The text was updated successfully, but these errors were encountered: