parse build file with params injection

This commit is contained in:
Ke Zhu 2014-12-07 11:26:43 -05:00
parent 8f6a031c6a
commit c6bc20dca7
2 changed files with 3 additions and 3 deletions

View file

@ -115,7 +115,7 @@ func run(path, identity, dockerhost, dockercert, dockerkey string, publish, depl
envs := getParamMap("DRONE_ENV_")
// parse the Drone yml file
s, err := script.ParseBuildFile(script.Inject(path, envs))
s, err := script.ParseBuildFile(path, envs)
if err != nil {
log.Err(err.Error())
return EXIT_STATUS, err

View file

@ -22,13 +22,13 @@ func ParseBuild(data string) (*Build, error) {
return &build, err
}
func ParseBuildFile(filename string) (*Build, error) {
func ParseBuildFile(filename string, params map[string]string) (*Build, error) {
data, err := ioutil.ReadFile(filename)
if err != nil {
return nil, err
}
return ParseBuild(string(data))
return ParseBuild(Inject(string(data), params))
}
// Build stores the configuration details for