Merge pull request #746 from shawnzhu/inject-params

parse build file with params injection
This commit is contained in:
Brad Rydzewski 2014-12-07 16:24:39 -08:00
commit 5539f63ba5
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_") envs := getParamMap("DRONE_ENV_")
// parse the Drone yml file // parse the Drone yml file
s, err := script.ParseBuildFile(script.Inject(path, envs)) s, err := script.ParseBuildFile(path, envs)
if err != nil { if err != nil {
log.Err(err.Error()) log.Err(err.Error())
return EXIT_STATUS, err return EXIT_STATUS, err

View file

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