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

Incorrectly defined, but valid "lagoon" yaml fails to lint #8

Open
shreddedbacon opened this issue Nov 1, 2021 · 1 comment · May be fixed by #9
Open

Incorrectly defined, but valid "lagoon" yaml fails to lint #8

shreddedbacon opened this issue Nov 1, 2021 · 1 comment · May be fixed by #9

Comments

@shreddedbacon
Copy link
Member

shreddedbacon commented Nov 1, 2021

Because Lagoons .lagoon.yml is pretty terrible. There are some cases where the defined yaml passes the Lagoon build phase, but the linter can't decode properly.

For example, the following will deploy a lagoon environment correctly, even though cronjobs: are defined as an environment.
The linter fails to unmarshal this and errors preventing a build

environments:
  cronjobs:
    - name: a cronjob defined as environment
      schedule: "* * * * *"
      command: echo "broken definition"
      service: cli
  main:
    routes:
    - nginx:
      - example.com
      - "www.example.com":
          tls-acme: 'true'
          insecure: Redirect
          hsts: max-age=31536000

Ideally, we could just print a warning message that a section is incorrectly defined.

@smlx
Copy link
Member

smlx commented May 11, 2022

We have had the hard build failure for this kind of error for a while now and haven't seen further problems with it. The error message for this example .lagoon.yml is currently:

    lint_test.go:84: couldn't unmarshal YAML: error unmarshaling JSON: while decoding JSON: json: cannot unmarshal array into Go struct field Lagoon.environments of type required.Environment

While this is a bit abstruse, it does indicate "go look at your environment definitions".

Do you still think that we should be more forgiving of this kind of mistake and continue the build anyway by ignoring the misplaced cronjob?

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 a pull request may close this issue.

2 participants