2 Commits

Author SHA1 Message Date
zero@thinky 26fc6362a3 fix(backend): interpreters repo not configured
ci-agent / build (push) Has been cancelled
2026-04-05 05:26:51 +03:00
zero@thinky 5ccb752836 refactor!(backend): remove check_cmd nonsense 2026-04-05 05:09:14 +03:00
2 changed files with 1 additions and 41 deletions
+1 -4
View File
@@ -103,9 +103,7 @@ func main() {
jobRepo, jobRepo,
) )
// Initialize script management service and handlers scriptManageHandlers := handlers.NewScriptHandlersGroup(scriptSvc, cmdr,
scriptManageSvc := service.NewScriptService(h.Repo)
scriptManageHandlers := handlers.NewScriptHandlersGroup(scriptManageSvc, cmdr,
os.Getenv("WHEREAMI")) os.Getenv("WHEREAMI"))
agents := handlers.NewAgentsGroup(h, coll) agents := handlers.NewAgentsGroup(h, coll)
@@ -211,7 +209,6 @@ func main() {
jobsGroup.POST("", jobsHandlers.AddJob) jobsGroup.POST("", jobsHandlers.AddJob)
jobsGroup.POST("/:id/wait", jobsHandlers.WaitJob) jobsGroup.POST("/:id/wait", jobsHandlers.WaitJob)
jobsGroup.GET("/metrics", jobsHandlers.GetJobMetrics) jobsGroup.GET("/metrics", jobsHandlers.GetJobMetrics)
jobsGroup.POST("/check_cmd", jobsHandlers.CheckCmd)
} }
// Agent registration // Agent registration
-37
View File
@@ -4,7 +4,6 @@ import (
"errors" "errors"
"fmt" "fmt"
"net/http" "net/http"
"os/exec"
"strconv" "strconv"
"time" "time"
@@ -192,42 +191,6 @@ func resolveCommand(c *gin.Context, svc *service.ScriptService, interpID int64,
return command, nil return command, nil
} }
// @Summary Check command path
// @Description Validates that a command binary exists on the system
// @Tags jobs
// @Accept json
// @Param body body CheckCmdIn true "Command to check"
// @Success 200 {object} CheckCmdOut
// @Failure 404 {object} map[string]string
// @Router /jobs/check_cmd [post]
func (h *JobsHandlers) CheckCmd(c *gin.Context) {
var in struct {
Command string `json:"command" binding:"required"`
}
if err := c.Bind(&in); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": "invalid request"})
return
}
if _, err := exec.LookPath(in.Command); err != nil {
if errors.Is(err, exec.ErrNotFound) {
c.JSON(http.StatusNotFound, gin.H{"error": "command not found"})
return
}
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
}
c.JSON(http.StatusOK, CheckCmdOut{Exists: true})
}
type CheckCmdIn struct {
Command string `json:"command" binding:"required" example:"bash"`
}
type CheckCmdOut struct {
Exists bool `json:"exists"`
}
// JobMetricsOut is the response body for the job metrics endpoint. // JobMetricsOut is the response body for the job metrics endpoint.
type JobMetricsOut struct { type JobMetricsOut struct {
Total int `json:"total"` Total int `json:"total"`