feat(cmd/joj3): make it backward compatible
This commit is contained in:
parent
214f5e76e8
commit
adba2e4a1d
|
@ -13,14 +13,7 @@ import (
|
||||||
"github.com/koding/multiconfig"
|
"github.com/koding/multiconfig"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Conf struct {
|
type ConfStage struct {
|
||||||
Name string `default:"unknown"`
|
|
||||||
LogPath string `default:""`
|
|
||||||
Stage struct {
|
|
||||||
SandboxExecServer string `default:"localhost:5051"`
|
|
||||||
SandboxToken string `default:""`
|
|
||||||
OutputPath string `default:"stages_result.json"`
|
|
||||||
Stages []struct {
|
|
||||||
Name string
|
Name string
|
||||||
Group string
|
Group string
|
||||||
Executor struct {
|
Executor struct {
|
||||||
|
@ -34,7 +27,16 @@ type Conf struct {
|
||||||
Name string
|
Name string
|
||||||
With interface{}
|
With interface{}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Conf struct {
|
||||||
|
Name string `default:"unknown"`
|
||||||
|
LogPath string `default:""`
|
||||||
|
Stage struct {
|
||||||
|
SandboxExecServer string `default:"localhost:5051"`
|
||||||
|
SandboxToken string `default:""`
|
||||||
|
OutputPath string `default:"joj3_result.json"`
|
||||||
|
Stages []ConfStage
|
||||||
}
|
}
|
||||||
Teapot struct {
|
Teapot struct {
|
||||||
LogPath string `default:"/home/tt/.cache/joint-teapot-debug.log"`
|
LogPath string `default:"/home/tt/.cache/joint-teapot-debug.log"`
|
||||||
|
@ -45,6 +47,29 @@ type Conf struct {
|
||||||
SkipScoreboard bool `default:"false"`
|
SkipScoreboard bool `default:"false"`
|
||||||
SkipFailedTable bool `default:"false"`
|
SkipFailedTable bool `default:"false"`
|
||||||
}
|
}
|
||||||
|
// TODO: remove the following backward compatibility fields
|
||||||
|
SandboxExecServer string `default:"localhost:5051"`
|
||||||
|
SandboxToken string `default:""`
|
||||||
|
OutputPath string `default:"joj3_result.json"`
|
||||||
|
GradingRepoName string `default:""`
|
||||||
|
SkipTeapot bool `default:"true"`
|
||||||
|
ScoreboardPath string `default:"scoreboard.csv"`
|
||||||
|
FailedTablePath string `default:"failed-table.md"`
|
||||||
|
Stages []struct {
|
||||||
|
Name string
|
||||||
|
Group string
|
||||||
|
Executor struct {
|
||||||
|
Name string
|
||||||
|
With struct {
|
||||||
|
Default stage.Cmd
|
||||||
|
Cases []OptionalCmd
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Parser struct {
|
||||||
|
Name string
|
||||||
|
With interface{}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type OptionalCmd struct {
|
type OptionalCmd struct {
|
||||||
|
@ -134,6 +159,25 @@ func parseConfFile(path string) (conf Conf, err error) {
|
||||||
slog.Error("validate stages conf", "error", err)
|
slog.Error("validate stages conf", "error", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// TODO: remove the following backward compatibility codes
|
||||||
|
conf.Stage.SandboxExecServer = conf.SandboxExecServer
|
||||||
|
conf.Stage.SandboxToken = conf.SandboxToken
|
||||||
|
conf.Stage.OutputPath = conf.OutputPath
|
||||||
|
conf.Stage.Stages = make([]ConfStage, len(conf.Stages))
|
||||||
|
for i, stage := range conf.Stages {
|
||||||
|
conf.Stage.Stages[i].Name = stage.Name
|
||||||
|
conf.Stage.Stages[i].Group = stage.Group
|
||||||
|
conf.Stage.Stages[i].Executor = stage.Executor
|
||||||
|
conf.Stage.Stages[i].Parsers = []struct {
|
||||||
|
Name string
|
||||||
|
With interface{}
|
||||||
|
}{
|
||||||
|
{
|
||||||
|
Name: stage.Parser.Name,
|
||||||
|
With: stage.Parser.With,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user