Add PrintPluginEnv plugin.

This commit is contained in:
jregan
2019-11-30 09:27:38 -08:00
parent d942e6fa59
commit d98af3f06a
11 changed files with 161 additions and 148 deletions

View File

@@ -0,0 +1,13 @@
#!/bin/bash
set -e
echo "
kind: GeneratedEnv
apiVersion: v1
metadata:
name: hello
env:
pwd: $PWD
kustomize_plugin_home: $KUSTOMIZE_PLUGIN_HOME
kustomize_plugin_config_root: $KUSTOMIZE_PLUGIN_CONFIG_ROOT
"

View File

@@ -16,18 +16,18 @@ func shouldContain(t *testing.T, s []byte, x string) {
}
}
func TestPrintWorkDirPlugin(t *testing.T) {
func TestPrintPluginEnvPlugin(t *testing.T) {
tc := kusttest_test.NewPluginTestEnv(t).Set()
defer tc.Reset()
tc.PrepExecPlugin(
"someteam.example.com", "v1", "PrintWorkDir")
"someteam.example.com", "v1", "PrintPluginEnv")
th := kusttest_test.NewKustTestHarnessAllowPlugins(t, "/theAppRoot")
m := th.LoadAndRunGenerator(`
apiVersion: someteam.example.com/v1
kind: PrintWorkDir
kind: PrintPluginEnv
metadata:
name: whatever
`)
@@ -35,6 +35,6 @@ metadata:
if err != nil {
t.Error(err)
}
shouldContain(t, a, "path: /theAppRoot")
shouldContain(t, a, "plugin/someteam.example.com/v1/printworkdir")
shouldContain(t, a, "kustomize_plugin_config_root: /theAppRoot")
shouldContain(t, a, "plugin/someteam.example.com/v1/printpluginenv")
}

View File

@@ -1,13 +0,0 @@
#!/bin/bash
set -e
dir=`pwd`
echo "
kind: WorkDir
apiVersion: v1
metadata:
name: $dir
spec:
path: ${KUSTOMIZE_PLUGIN_CONFIG_ROOT}
"