feat(cmd/joj3): remove -msg
All checks were successful
build / build (push) Successful in 1m9s
build / trigger-build-image (push) Successful in 8s

This commit is contained in:
张泊明518370910136 2024-10-14 08:06:22 -04:00
parent 5084b659f6
commit 3c284ffea4
GPG Key ID: D47306D7062CDA9D
2 changed files with 6 additions and 10 deletions

View File

@ -74,7 +74,8 @@ These steps are executed in runner-images. We use `sudo -u tt` to elevate the pe
1. Run JOJ3
1. Parse the message.
- If not specified by `-msg`, it will use the git commit message from `HEAD`. The message should meet the [Conventional Commits specification](https://www.conventionalcommits.org/). We use `scope` and `description` here.
- It will use the git commit message from `HEAD`. The message should meet the [Conventional Commits specification](https://www.conventionalcommits.org/). We use `scope` and `description` here.
- If `-tag` is specified, then it should equal to the scope of the message, or JOJ3 will not run.
2. Find the configuration file.
- We have `conf-root` and `conf-name` specified in the CLI argument. Then the full path of configuration file is `<conf-root>/<scope>/<conf-name>`.
3. Generate stages.

View File

@ -14,7 +14,6 @@ import (
var (
confRoot string
confName string
msg string
tag string
showVersion *bool
Version string = "debug"
@ -23,7 +22,6 @@ var (
func init() {
flag.StringVar(&confRoot, "conf-root", ".", "root path for all config files")
flag.StringVar(&confName, "conf-name", "conf.json", "filename for config files")
flag.StringVar(&msg, "msg", "", "message to trigger the running, leave empty to use git commit message on HEAD")
flag.StringVar(&tag, "tag", "", "tag to trigger the running, when non-empty, should equal to the scope in msg")
showVersion = flag.Bool("version", false, "print current version")
}
@ -39,13 +37,10 @@ func mainImpl() error {
return nil
}
slog.Info("start joj3", "version", Version)
if msg == "" {
var err error
msg, err = conf.GetCommitMsg()
if err != nil {
slog.Error("get commit msg", "error", err)
return err
}
msg, err := conf.GetCommitMsg()
if err != nil {
slog.Error("get commit msg", "error", err)
return err
}
confPath, group, err := conf.ParseMsg(confRoot, confName, msg, tag)
if err != nil {