Unverified Commit bcf0de28 authored by bryanl's avatar bryanl
Browse files

Update jsonnet vm paths



Fixes #420
Signed-off-by: default avatarbryanl <bryanliles@gmail.com>
parent 7b103293
......@@ -152,9 +152,28 @@ func (j *Jsonnet) Objects(paramsStr, envName string) ([]*unstructured.Unstructur
vm.UseMemoryImporter = true
}
vm.JPaths = []string{libPath}
vm.JPaths = []string{
libPath,
filepath.Join(j.app.Root(), "vendor"),
}
vm.ExtCode("__ksonnet/params", paramsStr)
envDetails, err := j.app.Environment(envName)
if err != nil {
return nil, err
}
dest := map[string]string{
"server": envDetails.Destination.Server,
"namespace": envDetails.Destination.Namespace,
}
marshalledDestination, err := json.Marshal(&dest)
if err != nil {
return nil, err
}
vm.ExtCode("__ksonnet/environments", string(marshalledDestination))
snippet, err := afero.ReadFile(j.app.Fs(), j.source)
if err != nil {
return nil, err
......@@ -326,7 +345,10 @@ func (j *Jsonnet) readParams(envName string) (string, error) {
}
vm := jsonnet.NewVM()
vm.JPaths = []string{env.MakePath(j.app.Root())}
vm.JPaths = []string{
env.MakePath(j.app.Root()),
filepath.Join(j.app.Root(), "vendor"),
}
vm.ExtCode("__ksonnet/params", paramsStr)
return vm.EvaluateSnippet("snippet", string(envParams))
}
......
......@@ -24,7 +24,7 @@ const (
// DefaultOverrideData generates the contents for an environment's `main.jsonnet`.
var DefaultOverrideData = []byte(`local base = import "base.libsonnet";
local k = import "k.libsonnet"
local k = import "k.libsonnet";
base + {
// Insert user-specified overrides here. For example if a component is named \"nginx-deployment\", you might have something like:\n")
......
......@@ -18,6 +18,7 @@ package pipeline
import (
"bytes"
"io"
"path/filepath"
"regexp"
"strings"
......@@ -92,7 +93,9 @@ func (p *Pipeline) EnvParameters(module string) (string, error) {
}
vm := jsonnet.NewVM()
vm.JPaths = []string{env.MakePath(p.app.Root())}
vm.JPaths = []string{
env.MakePath(p.app.Root()),
filepath.Join(p.app.Root(), "vendor")}
vm.ExtCode("__ksonnet/params", paramsStr)
return vm.EvaluateSnippet("snippet", string(envParams))
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment