diff --git a/doc/provisioning.md b/doc/provisioning.md index 0760d24..7ce9e34 100644 --- a/doc/provisioning.md +++ b/doc/provisioning.md @@ -84,6 +84,8 @@ $ virter vm exec my-vm -p examples/hello-world/hello-world.toml --set values.Ima ## Example ``` +version = 1 + [values] Image = "virter-hello-text" diff --git a/examples/hello-world-docker/hello-world-docker.toml b/examples/hello-world-docker/hello-world-docker.toml index 5648f04..0c75fde 100644 --- a/examples/hello-world-docker/hello-world-docker.toml +++ b/examples/hello-world-docker/hello-world-docker.toml @@ -1,3 +1,5 @@ +version = 1 + [values] Image = "virter-hello-world" diff --git a/examples/hello-world/hello-world.toml b/examples/hello-world/hello-world.toml index bd3d80a..1a2361f 100644 --- a/examples/hello-world/hello-world.toml +++ b/examples/hello-world/hello-world.toml @@ -1,3 +1,5 @@ +version = 1 + [[steps]] [steps.shell] script = ''' diff --git a/internal/virter/provision_test.go b/internal/virter/provision_test.go index 4260c5d..874ebd6 100644 --- a/internal/virter/provision_test.go +++ b/internal/virter/provision_test.go @@ -12,6 +12,8 @@ import ( func TestNewProvisionConfig(t *testing.T) { validGlobalOnly := ` +version = 1 + [env] foo="bar" bar="baz" @@ -22,6 +24,8 @@ script = "echo rck" ` validLocalOnly := ` +version = 1 + [[steps]] [steps.shell] script = "echo rck" @@ -31,6 +35,8 @@ bar="baz=lala" ` bothDistinct := ` +version = 1 + [env] foo="bar" bar="baz" @@ -44,6 +50,8 @@ here="" ` bothOverride := ` +version = 1 + [env] foo="bar" bar="baz" @@ -56,7 +64,7 @@ rck="was" foo="rck" ` - // IMPORTANT: this asumes 1 shell step! + // IMPORTANT: this assumes 1 shell step! tests := []struct { input string valid bool @@ -67,10 +75,10 @@ foo="rck" {validLocalOnly, true, ProvisionOption{Overrides: []string{}}, []string{"foo=bar", "bar=baz=lala"}}, {bothDistinct, true, ProvisionOption{Overrides: []string{}}, []string{"foo=bar", "bar=baz", "rck=was", "here="}}, {bothOverride, true, ProvisionOption{Overrides: []string{}}, []string{"foo=rck", "bar=baz", "rck=was"}}, - {"", true, ProvisionOption{ + {"version = 1", true, ProvisionOption{ Overrides: []string{"steps[0].shell.script=env", "steps[0].shell.env.foo=bar"}, }, []string{"foo=bar"}}, - {"", true, ProvisionOption{ + {"version = 1", true, ProvisionOption{ Overrides: []string{"steps[0].shell.script=env", "env.foo=bar", "steps[0].shell.env.foo=rck"}, }, []string{"foo=rck"}}, {bothOverride, true, ProvisionOption{ @@ -121,6 +129,8 @@ func envEqual(env, expected []string) bool { func TestNewProvisionConfigTemplate(t *testing.T) { noTemplate := ` +version = 1 + [[steps]] [steps.container] image = "some-image" @@ -141,6 +151,8 @@ dest = "some-dest" ` allTemplate := ` +version = 1 + [values] ShellEnv = "default-value" @@ -165,6 +177,8 @@ dest = "some-dest" ` globalEnvTemplate := ` +version = 1 + [env] foo = "{{.Env}}" blah = "{{.MoreEnv}}" @@ -177,6 +191,8 @@ foo = "bar" ` brokenTemplate := ` +version = 1 + [[steps]] [steps.shell] script = "echo jrc" diff --git a/tests/provision.toml b/tests/provision.toml index d3f68be..8c64a94 100644 --- a/tests/provision.toml +++ b/tests/provision.toml @@ -1,3 +1,5 @@ +version = 1 + [[steps]] [steps.shell] script = """ diff --git a/tests/test-run.toml b/tests/test-run.toml index 39535c1..150674c 100644 --- a/tests/test-run.toml +++ b/tests/test-run.toml @@ -1,3 +1,5 @@ +version = 1 + [values] ContainerImage = "ssh"