From 04360710c86b7e7b1fcd04cd309244a52a25659c Mon Sep 17 00:00:00 2001 From: Xianghu Zhao Date: Thu, 2 Apr 2020 16:47:13 +0800 Subject: [PATCH] Rename param name for exe_git --- README.md | 13 +++++++------ util/exe_git.go | 10 +++++----- version.go | 2 +- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 5610b0f..18ec334 100644 --- a/README.md +++ b/README.md @@ -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: @@ -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 @@ -696,10 +696,11 @@ 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 @@ -707,7 +708,7 @@ 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: @@ -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 diff --git a/util/exe_git.go b/util/exe_git.go index a5545a0..07ff462 100644 --- a/util/exe_git.go +++ b/util/exe_git.go @@ -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 == "" { diff --git a/version.go b/version.go index 9ed06db..d3599d5 100644 --- a/version.go +++ b/version.go @@ -1,4 +1,4 @@ package main // Version for Herald Daemon -const Version = "1.7.1" +const Version = "1.7.2"