uselagoon / lagoon

Lagoon, the developer-focused application delivery platform
https://docs.lagoon.sh/
Apache License 2.0
565 stars 148 forks source link

deploy process should validate yaml before starting #257

Closed rtprio closed 1 year ago

dasrecht commented 6 years ago

I had the issue with the tls-acme and insecure for the routes. somehow my yaml linter is happy both ways. lagoon on the other hand is not.

Subject: [PATCH] do you even yml?

---
 .lagoon.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.lagoon.yml b/.lagoon.yml
index c5664d8..de8602b 100644
--- a/.lagoon.yml
+++ b/.lagoon.yml
@@ -21,5 +21,5 @@ environments:
     routes:
       - nginx:
         - "staging.freshjobs.ch":
-          tls-acme: 'true'
-          insecure: Redirect
\ No newline at end of file
+            tls-acme: 'true'
+            insecure: Redirect
\ No newline at end of file
erikrs commented 6 years ago

suggestion: validate and correct line endings. (CRLF to LF)

based on following experience: Yesterday had some long troubleshooting session regarding .lagoon.env.$branch environment variables. Long story short: it seemed that my .lagoon.env.dev file (local env. is on Windows) had CRLF line endings.

Bottom line: suggestion for change request: is there a way to protect developers (in mixed environments) from making this mistake. Eg. pro actively do a CRLF to LF conversion of .lagoon.env... files ?

rtprio commented 6 years ago

Adding it here, so I remember: either truncate generated project at 63 characters or reject the build when it becomes that long.

rtprio commented 6 years ago

this is an old library, but should partly assist.; http://rx.codesimply.com/index.html

seanhamlin commented 4 years ago

Another reason why this would be useful

+++ cat .lagoon.yml
+++ shyaml get-value environments.production.cronjobs.2.service
Error: invalid path 'environments.production.cronjobs.2.service', missing key 'service' in struct.

The build managed to progress 58 seconds, and 1500 lines behind it was struck down with this. It would be great to do this up front.

twardnw commented 3 years ago

Since we already have python in the build images, https://github.com/23andMe/Yamale looks like it would be a good solution

smlx commented 3 years ago

yup for the record yamale is also the tool used by helm for yaml linting/validation

tobybellwood commented 1 year ago

The lagoon linter and build deploy tools now require YAML to be valid (and slightly correct) before deployment. It doesn't do a full schema check, but that's a separate issue.