vmware-archive / kubecfg

A tool for managing complex enterprise Kubernetes environments as code.
Apache License 2.0
728 stars 62 forks source link

Import external json file with --tla-code not working #297

Open irizzant opened 3 years ago

irizzant commented 3 years ago

I have the following scenario.

Let's consider the simplest test.jsonnet file containing:

function(env) env

And the following env.json file:

{
  custom: ''
}

If I invoke the following:

jsonnet --tla-code env="(import 'env.json') + {custom: 'value'}" test.jsonnet

I get:

{
   "custom": "value"
}

If I invoke the following:

kubecfg --tla-code env="(import 'env.json') + {custom: 'value'}" show test.jsonnet

I get:

ERROR Error reading test.jsonnet: RUNTIME ERROR: Could not get candidate URLs for when importing env.json (imported from <top-level-arg:env>): Invalid import dir "<top-level-arg:env>": parse "<top-level-arg:env>": first path segment in URL cannot contain colon
        <top-level-arg:env>:1:2-19      $
        file:///tmp/test.jsonnet:1:15-18        function <anonymous>
        Top-level function