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

Unable to set default values #1192

Open
laciferin2024 opened this issue Jan 4, 2025 · 0 comments
Open

Unable to set default values #1192

laciferin2024 opened this issue Jan 4, 2025 · 0 comments

Comments

@laciferin2024
Copy link

local getExt(varName, default) = 
  if std.extVar(varName) != null then std.extVar(varName) else default;

{
  machine: {
    gpu: 0,
    cpu: 100,
    ram: 100,
  },
  job: {
    APIVersion: "V1beta1",
    Spec: {
      Deal: {
        Concurrency: 1,
      },
      Docker: {
        Entrypoint: [
          "/usr/games/cowsay",
          getExt("Message", "Pass me an input called Message, like darts run cowsay:v1.0.0 -i Message=moo")
        ],
        Image: "ghcr.io/darts2024/cowsay:v1.0.0",
      },
      Engine: "Docker",
      Network: {
        Type: "None",
      },
      PublisherSpec: {
        Type: "local",
      },
      Resources: {
        GPU: "",
      },
      Timeout: 500,
      Verifier: "Noop",
    },
  },
}

###Error

jsonnet default.dart 
RUNTIME ERROR: Undefined external variable: Message
        default.dart:2:6-25     function <getExt>
        default.dart:19:11-108  thunk from <object <anonymous>>
        Array element 1
        Field "Entrypoint"
        Field "Docker"
        Field "Spec"
        Field "job"
        During manifestation

Version:

Jsonnet commandline interpreter (Go implementation) v0.20.0
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

No branches or pull requests

1 participant