Compare commits

..

No commits in common. "eb77dc6fc421e01671d3591649a8c0c09acf7664" and "50b45df50bbd333984afd78809c76c20d69293bd" have entirely different histories.

2 changed files with 12 additions and 15 deletions

View File

@ -20,8 +20,6 @@ type Conf struct {
OutputPath string `default:"joj3_result.json"` OutputPath string `default:"joj3_result.json"`
GradingRepoName string `default:""` GradingRepoName string `default:""`
SkipTeapot bool `default:"true"` SkipTeapot bool `default:"true"`
ScoreboardPath string `default:"scoreboard.csv"`
FailedTablePath string `default:"failed-table.md"`
Stages []struct { Stages []struct {
Name string Name string
Group string Group string

View File

@ -5,7 +5,6 @@ import (
"log/slog" "log/slog"
"os" "os"
"os/exec" "os/exec"
"regexp"
"strings" "strings"
"github.com/joint-online-judge/JOJ3/cmd/joj3/conf" "github.com/joint-online-judge/JOJ3/cmd/joj3/conf"
@ -15,6 +14,10 @@ func Run(conf conf.Conf) error {
if conf.SkipTeapot { if conf.SkipTeapot {
return nil return nil
} }
for _, env := range os.Environ() {
pair := strings.SplitN(env, "=", 2)
slog.Info("env", "key", pair[0], "value", pair[1])
}
os.Setenv("LOG_FILE_PATH", "/home/tt/.cache/joint-teapot-debug.log") os.Setenv("LOG_FILE_PATH", "/home/tt/.cache/joint-teapot-debug.log")
os.Setenv("_TYPER_STANDARD_TRACEBACK", "1") os.Setenv("_TYPER_STANDARD_TRACEBACK", "1")
envFilePath := "/home/tt/.config/teapot/teapot.env" envFilePath := "/home/tt/.config/teapot/teapot.env"
@ -28,32 +31,28 @@ func Run(conf conf.Conf) error {
} }
repoParts := strings.Split(repository, "/") repoParts := strings.Split(repository, "/")
repoName := repoParts[1] repoName := repoParts[1]
re := regexp.MustCompile(`\x1b\[[0-9;]*[a-zA-Z]`)
cmd := exec.Command("joint-teapot", "joj3-scoreboard", cmd := exec.Command("joint-teapot", "joj3-scoreboard",
envFilePath, conf.OutputPath, actor, conf.GradingRepoName, repoName, envFilePath, conf.OutputPath, actor, conf.GradingRepoName, repoName,
runNumber, conf.ScoreboardPath) // #nosec G204 runNumber) // #nosec G204
outputBytes, err := cmd.CombinedOutput() output, err := cmd.CombinedOutput()
output := re.ReplaceAllString(string(outputBytes), "") slog.Info("joint-teapot joj3-scoreboard", "output", string(output))
slog.Info("joint-teapot joj3-scoreboard", "output", output)
if err != nil { if err != nil {
slog.Error("joint-teapot joj3-scoreboard", "err", err) slog.Error("joint-teapot joj3-scoreboard", "err", err)
return err return err
} }
cmd = exec.Command("joint-teapot", "joj3-failed-table", cmd = exec.Command("joint-teapot", "joj3-failed-table",
envFilePath, conf.OutputPath, actor, conf.GradingRepoName, repoName, envFilePath, conf.OutputPath, actor, conf.GradingRepoName, repoName,
runNumber, conf.FailedTablePath) // #nosec G204 runNumber) // #nosec G204
outputBytes, err = cmd.CombinedOutput() output, err = cmd.CombinedOutput()
output = re.ReplaceAllString(string(outputBytes), "") slog.Info("joint-teapot joj3-failed-table", "output", string(output))
slog.Info("joint-teapot joj3-failed-table", "output", output)
if err != nil { if err != nil {
slog.Error("joint-teapot joj3-failed-table", "err", err) slog.Error("joint-teapot joj3-failed-table", "err", err)
return err return err
} }
cmd = exec.Command("joint-teapot", "joj3-create-result-issue", cmd = exec.Command("joint-teapot", "joj3-create-result-issue",
envFilePath, conf.OutputPath, repoName, runNumber) // #nosec G204 envFilePath, conf.OutputPath, repoName, runNumber) // #nosec G204
outputBytes, err = cmd.CombinedOutput() output, err = cmd.CombinedOutput()
output = re.ReplaceAllString(string(outputBytes), "") slog.Info("joint-teapot joj3-create-result-issue", "output", string(output))
slog.Info("joint-teapot joj3-create-result-issue", "output", output)
if err != nil { if err != nil {
slog.Error("joint-teapot joj3-create-result-issue", "err", err) slog.Error("joint-teapot joj3-create-result-issue", "err", err)
return err return err