garden-io / garden

Automation for Kubernetes development and testing. Spin up production-like environments for development, testing, and CI on demand. Use the same configuration and workflows at every step of the process. Speed up your builds and test runs via shared result caching
https://garden.io
Mozilla Public License 2.0
3.32k stars 268 forks source link

ConfigTemplate crash #5830

Open salotz opened 5 months ago

salotz commented 5 months ago

Crash report

Error message

--> garden -l4 --force-refresh deploy kapp-example-deploy
[verbose] garden version: 0.13.27
Deploy 

i garden                    → Initializing...
i garden-dashboard          → [debug] Initializing Garden Cloud API client.
[debug] Checking client auth token with the Garden dashboard: https://app.garden.io/token/verify
[debug] Checked client auth token with the Garden dashboard - valid: true
i garden-dashboard          → [debug] Authorizing...
i garden-dashboard          → [debug] Starting refresh interval.
[debug] Will run refresh function every 4500 ms.
i garden-dashboard          → Connecting project...
i garden-dashboard          → [debug] Fetching or creating project carvel-demo from https://app.garden.io
√ garden-dashboard          → Ready
Garden v0.13 (Bonsai) is a major release with significant changes. Please help us improve it by reporting any issues/bugs here:
https://go.garden.io/report-bonsai
→ Run garden util hide-warning 0.13-bonsai to disable this message.
i garden                    → Running in environment local.cvd-local
i git                       → [debug] Scanning project root at /home/salotz/tree/examol/devel/carvel-demo
  → Includes: (none)
  → Excludes: (none)
i git                       → [debug] Found 2236 files in project root /home/salotz/tree/examol/devel/carvel-demo
[debug] Found 2236 files in path /home/salotz/tree/examol/devel/carvel-demo, filtering by 1 include and 6 exclude globs
[debug] Include globs: **/*garden.y*ml
[debug] Exclude globs: .garden/**/*, .git/**/*, .gitmodules, .garden/**/*, debug-info*/**, **/.garden/**/*
[debug] Found 3 files in path /home/salotz/tree/examol/devel/carvel-demo after glob matching
Encountered an unexpected Garden error. This is likely a bug 🍂

You can help by reporting this on GitHub: https://github.com/garden-io/garden/issues/new?labels=bug,crash&template=CRASH.md&title=Crash%3A%20jsonSchema%20must%20be%20a%20valid%20JSON%20Schema%20with%20type%3Dobject%20or%20reference

Please attach the following information to the bug report after making sure that the error message does not contain sensitive information:

Error: jsonSchema must be a valid JSON Schema with type=object or reference
    at new module.exports (file:///home/salotz/.local/share/garden/1709589995-icELlT9.r/rollup/garden.mjs:122140:20)
    at assert$h (file:///home/salotz/.local/share/garden/1709589995-icELlT9.r/rollup/garden.mjs:122163:11)
    at internals.Base.$_addRule (file:///home/salotz/.local/share/garden/1709589995-icELlT9.r/rollup/garden.mjs:129056:30)
    at internals.Base.method [as jsonSchema] (file:///home/salotz/.local/share/garden/1709589995-icELlT9.r/rollup/garden.mjs:149218:29)
    at resolveConfigTemplate (file:///home/salotz/.local/share/garden/1709589995-icELlT9.r/rollup/garden.mjs:790005:36)
    at async Promise.all (index 0)
    at async file:///home/salotz/.local/share/garden/1709589995-icELlT9.r/rollup/garden.mjs:818731:37

What did you do?

garden -l4 --force-refresh deploy kapp-example-deploy
---
kind: ConfigTemplate
name: kapp
inputsSchemaPath: kapp_schema.json

configs:
  - kind: Deploy
    type: exec
    name: ${parent.name}

    dependencies:
      - build.${inputs.build}

    build: ${inputs.build}

    spec:
      deployCommand:
        - kapp
        - deploy
        - "-y"
        - "-a"
        - ${inputs.name}
        - "-f"
        - ${inputs.file}
      cleanupCommand:
        - kapp
        - delete
        - "-y"
        - "-a"
        - ${inputs.name}
{
    "type" : "object",
    "properties" : {
        "build" : {
            "description" : "The garden build action name that generates manifests to deploy.",
            "type": "string",
            "required" : true
        },
        "name" : {
            "description" : "The kapp app name to deploy as",
            "type": "string",
            "required" : true
        },
        "file" : {
            "description" : "File spec to deploy.",
            "type": "string",
            "required" : true
        }
    }
}
---
kind: Build
name: kapp-example-manifests
type: exec
description: |
  Render the K8s manifests using Tanka.
include:
  - environments/kapp-example
  # everything we need for tk to run
  - chartfile.yaml
  - charts
  - jsonnetfile.json
  - jsonnetfile.lock.json
  - lib
  # we need this but skip the symlinks that tanka maintains
  - vendor/github.com

spec:
  shell: true
  command:
    - |
      # TODO: could also just redirect `tk show` to a file, since Kapp
      # can handle the apply ordering
      tk export ./export/kapp-example ./environments/kapp-example
      # remove this for downstream things that choke on this
      rm ./export/kapp-example/manifest.json

---
kind: RenderTemplate
template: kapp
name: kapp-example-deploy
description: |
  Deploy the kapp application, using the ConfigTemplate

inputs:
  build: kapp-example-manifests
  name: kapp-example
  file: ./export/kapp-example/

Your environment

Frequency

It reproduces in the same environment.

Workaround

I haven't found anything.

Additional context

salotz commented 5 months ago

And just to clarify I get the same thing when running other commands, e.g. garden build kapp-example-manifests

salotz commented 5 months ago

Ahhh the only place this shows up is in the github issue URL haha:

Crash: jsonSchema must be a valid JSON Schema with type=object or reference
salotz commented 5 months ago
{
    "type" : "object",
    "properties" : {
        "build" : {
            "type": "string"
        },
        "name" : {
            "type": "string"
        },
        "file" : {
            "type": "string"
        }
    }
}

Going basic fixes it.