Inject version when building and report version to Gitea via log and header (#43)
close #42 1. Inject runner version when `make build` After building, executing command line: `./act_runner -v` or `./act_runner --version`, the version of runner is printed.  2. In `Actions` UI:  3. Set request header in http client interceptor. Co-authored-by: sillyguodong <gedong_1994@163.com> Reviewed-on: https://gitea.com/gitea/act_runner/pulls/43 Reviewed-by: delvh <dev.lh@web.de> Reviewed-by: Jason Song <i@wolfogre.com> Co-authored-by: sillyguodong <sillyguodong@noreply.gitea.io> Co-committed-by: sillyguodong <sillyguodong@noreply.gitea.io>
This commit is contained in:
parent
b202c62bf7
commit
0445675a10
8 changed files with 22 additions and 11 deletions
|
@ -7,7 +7,8 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
const version = "0.1.5"
|
||||
// the version of act_runner
|
||||
var version = "develop"
|
||||
|
||||
type globalArgs struct {
|
||||
EnvFile string
|
||||
|
@ -20,7 +21,7 @@ func Execute(ctx context.Context) {
|
|||
|
||||
// ./act_runner
|
||||
rootCmd := &cobra.Command{
|
||||
Use: "act [event name to run]\nIf no event name passed, will default to \"on: push\"",
|
||||
Use: "act_runner [event name to run]\nIf no event name passed, will default to \"on: push\"",
|
||||
Short: "Run GitHub actions locally by specifying the event name (e.g. `push`) or an action name directly.",
|
||||
Args: cobra.MaximumNArgs(1),
|
||||
Version: version,
|
||||
|
|
|
@ -63,6 +63,7 @@ func runDaemon(ctx context.Context, envFile string) func(cmd *cobra.Command, arg
|
|||
cfg.Client.Insecure,
|
||||
cfg.Runner.UUID,
|
||||
cfg.Runner.Token,
|
||||
version,
|
||||
)
|
||||
|
||||
runner := &runtime.Runner{
|
||||
|
@ -71,6 +72,7 @@ func runDaemon(ctx context.Context, envFile string) func(cmd *cobra.Command, arg
|
|||
ForgeInstance: cfg.Client.Address,
|
||||
Environ: cfg.Runner.Environ,
|
||||
Labels: cfg.Runner.Labels,
|
||||
Version: version,
|
||||
CacheHandler: handler,
|
||||
}
|
||||
|
||||
|
|
|
@ -271,7 +271,9 @@ func doRegister(cfg *config.Config, inputs *registerInputs) error {
|
|||
cli := client.New(
|
||||
inputs.InstanceAddr,
|
||||
inputs.Insecure,
|
||||
"", "",
|
||||
"",
|
||||
"",
|
||||
version,
|
||||
)
|
||||
|
||||
for {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue