Refactor environment variables to configuration and registration #90

Merged
wolfogre merged 17 commits from wolfogre/act_runner:feature/config into main 2023-04-02 14:41:48 +00:00
Owner

Close #21.

Refactor environment variables to configuration file (config.yaml) and registration file (.runner).

The old environment variables are still supported, but warning logs will be printed.

Like:

$ GITEA_DEBUG=true ./act_runner -c config.yaml daemon
INFO[0000] Starting runner daemon
WARN[0000] env GITEA_DEBUG has been ignored because config file is used

$ GITEA_DEBUG=true ./act_runner daemon
INFO[0000] Starting runner daemon
WARN[0000] env GITEA_DEBUG will be deprecated, please use config file instead
Close #21. Refactor environment variables to configuration file (config.yaml) and registration file (.runner). The old environment variables are still supported, but warning logs will be printed. Like: ```text $ GITEA_DEBUG=true ./act_runner -c config.yaml daemon INFO[0000] Starting runner daemon WARN[0000] env GITEA_DEBUG has been ignored because config file is used $ GITEA_DEBUG=true ./act_runner daemon INFO[0000] Starting runner daemon WARN[0000] env GITEA_DEBUG will be deprecated, please use config file instead ```
wolfogre added 4 commits 2023-03-30 09:55:04 +00:00
wolfogre added 1 commit 2023-03-30 09:56:27 +00:00
fix: copyright
Some checks failed
check and test
97cc398e96
wolfogre added 1 commit 2023-03-30 10:34:04 +00:00
chore: remove register
All checks were successful
check and test
a42aac15bc
wolfogre added 4 commits 2023-03-30 11:55:22 +00:00
wolfogre added 1 commit 2023-03-31 06:56:51 +00:00
feat: config
Some checks failed
checks / check and test (pull_request) Failing after 34s
0245055dba
wolfogre added 1 commit 2023-03-31 07:10:22 +00:00
docs: update
Some checks failed
checks / check and test (pull_request) Failing after 35s
090d4593ff
wolfogre changed title from WIP: Refactor environment variables to configuration and registration to Refactor environment variables to configuration and registration 2023-03-31 07:32:28 +00:00
wolfogre added 1 commit 2023-03-31 07:33:18 +00:00
fix: copyright
Some checks failed
checks / check and test (pull_request) Failing after 36s
f40ca30b14
wolfogre added 1 commit 2023-03-31 07:38:36 +00:00
chore: go fmt
All checks were successful
checks / check and test (pull_request) Successful in 39s
0967ae7cc9
wolfogre added 1 commit 2023-03-31 07:51:46 +00:00
fix: .goreleaser.yaml
All checks were successful
checks / check and test (pull_request) Successful in 39s
acb2e89a0c
wxiaoguang reviewed 2023-03-31 08:16:47 +00:00
@ -59,3 +59,3 @@
- -trimpath
ldflags:
- -s -w -X gitea.com/gitea/act_runner/cmd.version={{ .Version }}
- -s -w -X gitea.com/gitea/act_runner/cmd.version={{ .Summary }}
Member

.Summary means cmd.version?

`.Summary` means `cmd.version`?
@ -0,0 +31,4 @@
cfg.Log.Level = "debug"
}
}
if v, ok := handleEnv("GITEA_TRACE"); ok {
Member

GITEA_RUNNER_LOGLEVEL ?

And it seems that other env vars all have GITEA_RUNNER_ prefix.

`GITEA_RUNNER_LOGLEVEL` ? And it seems that other env vars all have `GITEA_RUNNER_` prefix.
wolfogre added 1 commit 2023-03-31 08:30:44 +00:00
fix: typo
All checks were successful
checks / check and test (pull_request) Successful in 43s
5360870f51
wolfogre reviewed 2023-03-31 08:37:32 +00:00
@ -59,3 +59,3 @@
- -trimpath
ldflags:
- -s -w -X gitea.com/gitea/act_runner/cmd.version={{ .Version }}
- -s -w -X gitea.com/gitea/act_runner/cmd.version={{ .Summary }}
Author
Owner

@wxiaoguang

.Summary the git summary, e.g. v1.0.0-10-g34f56g35

See https://goreleaser.com/customization/templates/

@wxiaoguang `.Summary the git summary, e.g. v1.0.0-10-g34f56g35` See https://goreleaser.com/customization/templates/
@ -0,0 +31,4 @@
cfg.Log.Level = "debug"
}
}
if v, ok := handleEnv("GITEA_TRACE"); ok {
Author
Owner

@wxiaoguang

Never mind, it's a legacy. I want to drop all those envs, so I don't care if it need a better name.

Debug bool `envconfig:"GITEA_DEBUG"`

@wxiaoguang Never mind, it's a legacy. I want to drop all those envs, so I don't care if it need a better name. https://gitea.com/gitea/act_runner/src/commit/8eea12dd7867383d24babc24899d1a8101fbfee2/config/config.go#L22
wolfogre added 1 commit 2023-03-31 08:40:35 +00:00
fix: generate-config
All checks were successful
checks / check and test (pull_request) Successful in 37s
97869927da
wolfogre requested review from lunny 2023-03-31 08:40:49 +00:00
lunny reviewed 2023-03-31 08:48:28 +00:00
@ -59,3 +59,3 @@
- -trimpath
ldflags:
- -s -w -X gitea.com/gitea/act_runner/cmd.version={{ .Version }}
- -s -w -X gitea.com/gitea/act_runner/cmd.version={{ .Summary }}
Owner

test

test
lunny approved these changes 2023-04-02 10:01:27 +00:00
wolfogre merged commit 7e7096e60b into main 2023-04-02 14:41:48 +00:00
Sign in to join this conversation.
No description provided.