feat(cmd/joj3): remove -msg
	
		
			
	
		
	
	
				
					
				
			This commit is contained in:
		
							parent
							
								
									5084b659f6
								
							
						
					
					
						commit
						3c284ffea4
					
				|  | @ -74,7 +74,8 @@ These steps are executed in runner-images. We use `sudo -u tt` to elevate the pe | ||||||
| 
 | 
 | ||||||
| 1. Run JOJ3 | 1. Run JOJ3 | ||||||
|    1. Parse the message. |    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. |    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>`. |        - 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. |    3. Generate stages. | ||||||
|  |  | ||||||
|  | @ -14,7 +14,6 @@ import ( | ||||||
| var ( | var ( | ||||||
| 	confRoot    string | 	confRoot    string | ||||||
| 	confName    string | 	confName    string | ||||||
| 	msg         string |  | ||||||
| 	tag         string | 	tag         string | ||||||
| 	showVersion *bool | 	showVersion *bool | ||||||
| 	Version     string = "debug" | 	Version     string = "debug" | ||||||
|  | @ -23,7 +22,6 @@ var ( | ||||||
| func init() { | func init() { | ||||||
| 	flag.StringVar(&confRoot, "conf-root", ".", "root path for all config files") | 	flag.StringVar(&confRoot, "conf-root", ".", "root path for all config files") | ||||||
| 	flag.StringVar(&confName, "conf-name", "conf.json", "filename for 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") | 	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") | 	showVersion = flag.Bool("version", false, "print current version") | ||||||
| } | } | ||||||
|  | @ -39,13 +37,10 @@ func mainImpl() error { | ||||||
| 		return nil | 		return nil | ||||||
| 	} | 	} | ||||||
| 	slog.Info("start joj3", "version", Version) | 	slog.Info("start joj3", "version", Version) | ||||||
| 	if msg == "" { | 	msg, err := conf.GetCommitMsg() | ||||||
| 		var err error | 	if err != nil { | ||||||
| 		msg, err = conf.GetCommitMsg() | 		slog.Error("get commit msg", "error", err) | ||||||
| 		if err != nil { | 		return err | ||||||
| 			slog.Error("get commit msg", "error", err) |  | ||||||
| 			return err |  | ||||||
| 		} |  | ||||||
| 	} | 	} | ||||||
| 	confPath, group, err := conf.ParseMsg(confRoot, confName, msg, tag) | 	confPath, group, err := conf.ParseMsg(confRoot, confName, msg, tag) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user