feat: complete mise env base code

This commit is contained in:
engigu
2026-02-13 17:27:55 +08:00
parent 800ac40200
commit c1c1d69e66
49 changed files with 2724 additions and 470 deletions
+8 -4
View File
@@ -326,6 +326,7 @@ func (es *ExecutorService) ExecuteDispatcher(ctx context.Context, req *executor.
WorkDir: req.WorkDir,
Envs: req.Envs,
Timeout: req.Timeout,
UseMise: false, // 系统任务不使用 mise
}, stdout, stderr)
}
@@ -351,10 +352,13 @@ func (es *ExecutorService) ExecuteDispatcher(ctx context.Context, req *executor.
// 本地任务
hooks := &LocalTaskHooks{es: es, logID: req.LogID}
return executor.ExecuteWithHooks(ctx, executor.Request{
Command: req.Command,
WorkDir: req.WorkDir,
Envs: req.Envs,
Timeout: req.Timeout,
Command: req.Command,
WorkDir: req.WorkDir,
Envs: req.Envs,
Timeout: req.Timeout,
Language: task.Language,
LangVersion: task.LangVersion,
UseMise: true, // 本地业务任务启用 mise
}, stdout, stderr, hooks)
}
+6 -2
View File
@@ -11,7 +11,7 @@ func NewTaskService() *TaskService {
return &TaskService{}
}
func (ts *TaskService) CreateTask(name, command, schedule string, timeout int, workDir, cleanConfig, envs, taskType, config string, agentID *uint) *models.Task {
func (ts *TaskService) CreateTask(name, command, schedule string, timeout int, workDir, cleanConfig, envs, taskType, config string, agentID *uint, language, langVersion string) *models.Task {
if taskType == "" {
taskType = "task"
}
@@ -25,6 +25,8 @@ func (ts *TaskService) CreateTask(name, command, schedule string, timeout int, w
WorkDir: workDir,
CleanConfig: cleanConfig,
Envs: envs,
Language: language,
LangVersion: langVersion,
AgentID: agentID,
Enabled: true,
}
@@ -65,7 +67,7 @@ func (ts *TaskService) GetTaskByID(id int) *models.Task {
return &task
}
func (ts *TaskService) UpdateTask(id int, name, command, schedule string, timeout int, workDir, cleanConfig, envs string, enabled bool, taskType, config string, agentID *uint) *models.Task {
func (ts *TaskService) UpdateTask(id int, name, command, schedule string, timeout int, workDir, cleanConfig, envs string, enabled bool, taskType, config string, agentID *uint, language, langVersion string) *models.Task {
var task models.Task
if err := database.DB.First(&task, id).Error; err != nil {
return nil
@@ -79,6 +81,8 @@ func (ts *TaskService) UpdateTask(id int, name, command, schedule string, timeou
task.Envs = envs
task.Enabled = enabled
task.AgentID = agentID
task.Language = language
task.LangVersion = langVersion
if taskType != "" {
task.Type = taskType
}