mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-05-17 18:25:26 +00:00
Add PrintPluginEnv plugin.
This commit is contained in:
13
plugin/someteam.example.com/v1/printpluginenv/PrintPluginEnv
Executable file
13
plugin/someteam.example.com/v1/printpluginenv/PrintPluginEnv
Executable 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
|
||||
"
|
||||
@@ -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")
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
dir=`pwd`
|
||||
|
||||
echo "
|
||||
kind: WorkDir
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: $dir
|
||||
spec:
|
||||
path: ${KUSTOMIZE_PLUGIN_CONFIG_ROOT}
|
||||
"
|
||||
Reference in New Issue
Block a user