Created
June 25, 2019 15:39
-
-
Save tychoish/1c1f57be6a560716a482f161c16bb264 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/command/registry.go b/command/registry.go | |
index f3e0011b7..db81cc626 100644 | |
--- a/command/registry.go | |
+++ b/command/registry.go | |
@@ -178,7 +178,12 @@ func (r *commandRegistry) renderCommands(commandInfo model.PluginCommandConf, | |
} | |
cmd := factory() | |
- if err = cmd.ParseParams(c.Params); err != nil { | |
+ params, err := c.Params.Resolve() | |
+ if err != nil { | |
+ errs = append(errs, err) | |
+ } | |
+ | |
+ if err = cmd.ParseParams(params); err != nil { | |
errs = append(errs, errors.Wrapf(err, "problem parsing input of %s (%s)", c.Command, c.DisplayName).Error()) | |
continue | |
} | |
diff --git a/model/project.go b/model/project.go | |
index 6a041567d..9171c4c6f 100644 | |
--- a/model/project.go | |
+++ b/model/project.go | |
@@ -1,6 +1,7 @@ | |
package model | |
import ( | |
+ "encoding/json" | |
"fmt" | |
"reflect" | |
"regexp" | |
@@ -260,7 +261,7 @@ type PluginCommandConf struct { | |
TimeoutSecs int `yaml:"timeout_secs,omitempty" bson:"timeout_secs"` | |
// Params are used to supply configuratiion specific information. | |
- Params map[string]interface{} `yaml:"params,omitempty" bson:"params"` | |
+ Params string `yaml:"params,omitempty" bson:"params"` | |
// Vars defines variables that can be used within commands. | |
Vars map[string]string `yaml:"vars,omitempty" bson:"vars"` | |
@@ -268,6 +269,11 @@ type PluginCommandConf struct { | |
Loggers *LoggerConfig `yaml:"loggers,omitempty" bson:"loggers,omitempty"` | |
} | |
+func (p *PluginCommandConf) Resolve() (map[string]interface{}, error) { | |
+ out := map[string]interface{}{} | |
+ return json.Unmarshal(&out, []byte(p.Params)) | |
+} | |
+ | |
type ArtifactInstructions struct { | |
Include []string `yaml:"include,omitempty" bson:"include"` | |
ExcludeFiles []string `yaml:"excludefiles,omitempty" bson:"exclude_files"` | |
@@ -1241,7 +1247,7 @@ func (p *Project) TasksThatCallCommand(find string) map[string]int { | |
// IsGenerateTask indicates that the task generates other tasks, which the | |
// scheduler will use to prioritize this task. | |
-func (p *Project) IsGenerateTask(taskName string) bool { | |
+func (p *Project) IsGyenerateTask(taskName string) bool { | |
_, ok := p.TasksThatCallCommand(evergreen.GenerateTasksCommandName)[taskName] | |
return ok | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment