Skip to content

Commit

Permalink
Rename param name for exe_git
Browse files Browse the repository at this point in the history
  • Loading branch information
xianghuzhao committed Apr 2, 2020
1 parent bffd1c8 commit 0436071
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ executor:
preset:
common_script_repo:
script_repo: https://github.com/heraldgo/herald-script
repo: https://github.com/heraldgo/herald-script
router:
print_param_every2s:
Expand Down Expand Up @@ -670,7 +670,7 @@ router:
task:
run_git: local_command
job_param:
script_repo: https://github.com/heraldgo/herald-script.git
repo: https://github.com/heraldgo/herald-script.git
cmd: run/doit.sh
check_env:
trigger: ttt
Expand All @@ -696,18 +696,19 @@ router:

The execution param is set in the environment variable for the command.
The default variable name is `HERALD_EXECUTE_PARAM`,
which could be configured by job param `param_env`.
which could be configured by job param `param_env_name`.

If `script_repo` is set, `local` executor will try to load it as
If `repo` is set, `local` executor will try to load it as
a git repo and then run the `cmd` from it.
`branch` option could also be specified.

Arguments specified in `arg` will be passed to the command.
The `arg` could be a list of strings. It could be also a single
string for only one argument.

Extra environment variables could be set with `env` as a map.

Only use `script_repo` which you can trust.
Only use `repo` which you can trust.

The result of the `local` executor is like:

Expand Down Expand Up @@ -764,7 +765,7 @@ router:
task:
run_git: remote_command
job_param:
script_repo: https://github.com/heraldgo/herald-script.git
repo: https://github.com/heraldgo/herald-script.git
cmd: run/doit.sh
print_result:
trigger: exe_done
Expand Down
10 changes: 5 additions & 5 deletions util/exe_git.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,20 @@ func (exe *ExeGit) Execute(param map[string]interface{}) map[string]interface{}

jobParam, _ := GetMapParam(param, "job_param")

scriptRepo, _ := GetStringParam(jobParam, "script_repo")
scriptBranch, _ := GetStringParam(jobParam, "script_branch")
repo, _ := GetStringParam(jobParam, "repo")
branch, _ := GetStringParam(jobParam, "branch")
cmd, _ := GetStringParam(jobParam, "cmd")
arg, _ := GetStringSliceParam(jobParam, "arg")
env, _ := GetMapParam(jobParam, "env")
paramEnvName, _ := GetStringParam(jobParam, "param_env")
paramEnvName, _ := GetStringParam(jobParam, "param_env_name")
background, _ := GetBoolParam(jobParam, "background")
ignoreParamEnv, _ := GetBoolParam(jobParam, "ignore_param_env")

var finalCommand string
if scriptRepo == "" {
if repo == "" {
finalCommand = cmd
} else {
finalCommand = exe.repoCommandPath(scriptRepo, scriptBranch, cmd)
finalCommand = exe.repoCommandPath(repo, branch, cmd)
}

if finalCommand == "" {
Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package main

// Version for Herald Daemon
const Version = "1.7.1"
const Version = "1.7.2"

0 comments on commit 0436071

Please sign in to comment.