mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-30 08:06:52 +02:00
Merge pull request #746 from shawnzhu/inject-params
parse build file with params injection
This commit is contained in:
commit
5539f63ba5
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user