--- a/REFERENCE.md Thu Dec 23 16:11:49 2021 -0600
+++ b/REFERENCE.md Thu Dec 23 17:11:52 2021 -0600
@@ -113,7 +113,7 @@
| Name | Required | Description |
| ----------- | -------- | ----------- |
-| environment | | A list of environment variables to set. They should be specified in a `NAME` or `NAME=VALUE` format. If no value is provided, the value of the variable from the host will be provided if it is available. These environment variables will be applied on top of any that were set at the config-file level. |
+| environment | | A list of environment variables to set. They should be specified in a `NAME` or `NAME=VALUE` format. If no value is provided, the value of the variable from the host will be provided if it is available. These environment variables will be applied on top of any that were set at the config-file level or a meta-plan that contains this plan. | | stages | Yes | A list of `stages` to be run as part of this `plan` in the order that they should be run in. |
@@ -147,12 +147,15 @@
| Name | Required | Description |
| ----------- | -------- | ----------- |
+| environment | | A list of environment variables to set. They should be specified in a `NAME` or `NAME=VALUE` format. If no value is provided, the value of the variable from the host will be provided if it is available. These environment variables will be applied on top of any that were set at the config-file level. | | plans | Yes | A list of `plans` to run in the order they should be run in. |
+ - BUILD_TYPE=production --- a/runtime/metaplans.go Thu Dec 23 16:11:49 2021 -0600
+++ b/runtime/metaplans.go Thu Dec 23 17:11:52 2021 -0600
@@ -19,11 +19,14 @@
+ "keep.imfreedom.org/grim/convey/environment" // MetaPlan is a representation of a meta plan.
- Plans []string `yaml:"plans"`
+ Plans []string `yaml:"plans"` + Environment environment.Environment `yaml:"environment"` // UnmarshalYAML is a custom yaml unmarshaller for MetaPlan's.
@@ -54,7 +57,20 @@
for _, name := range m.Plans {
mp, ok := rt.MetaPlans[name]
- if err := mp.Execute(ctx, rt); err != nil {
+ // Store the old config environment from the runtime, copy it, + // and then merge the metaplan's environment into it. The + // config environment is the toplevel environment in the + // config, and that is the only thing the metaplan should be + oldenv := rt.ConfigEnvironment + rt.ConfigEnvironment = oldenv.Copy().Merge(mp.Environment) + // Run the metaplan with the merged config environment, and + // then reset the runtime's config environment after execution. + err := mp.Execute(ctx, rt) + rt.ConfigEnvironment = oldenv