feat: Removed comments
Server Deploy / deploy (push) Failing after 1m13s

This commit is contained in:
2026-07-24 09:56:54 +01:00
parent 1a6cf03c03
commit e798365be2
27 changed files with 1557 additions and 1714 deletions
+1 -1
View File
@@ -17,7 +17,7 @@ import (
var ErrLastOwner = errors.New("this is the organization's last owner promote another member to owner first")
var ErrLastOwner = errors.New("this is the organization's last owner promote another member to owner first")
+15 -50
View File
@@ -17,8 +17,6 @@ import (
const stepDispatchGrace = 15 * time.Second
func TriggerWorkflow(orgID, workflowID, actor string) (string, error) {
wf, err := GetWorkflow(orgID, workflowID)
if err != nil {
@@ -30,13 +28,11 @@ func TriggerWorkflow(orgID, workflowID, actor string) (string, error) {
if len(wf.Steps) == 0 {
return "", fmt.Errorf("workflow has no steps")
}
if err := validateTargetServers(orgID, wf.TargetServerIDs); err != nil {
return "", err
}
ctx, cancel := wfCtx()
running := db.Col("workflow_runs").FindOne(ctx, bson.M{"org_id": orgID, "workflow_id": workflowID, "status": "running"})
cancel()
@@ -82,8 +78,6 @@ func TriggerWorkflow(orgID, workflowID, actor string) (string, error) {
return run.RunID, nil
}
func resolveSteps(orgID string, wf *models.Workflow) ([]models.ResolvedStep, error) {
ctx, cancel := wfCtx()
defer cancel()
@@ -133,7 +127,6 @@ func resolveSteps(orgID string, wf *models.Workflow) ([]models.ResolvedStep, err
return out, nil
}
func resolveInlineStep(ref models.WorkflowStepRef) models.ResolvedStep {
in := ref.Inline
inputs := map[string]string{}
@@ -162,7 +155,6 @@ func resolveInlineStep(ref models.WorkflowStepRef) models.ResolvedStep {
}
}
func executeRun(runID string) {
run, err := getRunByID(runID)
if err != nil {
@@ -179,7 +171,6 @@ func executeRun(runID string) {
<-done
}
final, _ := getRunByID(runID)
status := "success"
for _, sr := range final.ServerRuns {
@@ -194,20 +185,18 @@ func executeRun(runID string) {
bson.M{"$set": bson.M{"status": status, "finished_at": now}})
}
func runServer(orgID, runID string, srvIdx int, steps []models.ResolvedStep, serverID string) {
now := time.Now()
setServerRun(runID, srvIdx, bson.M{"server_runs.$.status": "running", "server_runs.$.started_at": now})
if !Dispatcher.IsConnected(serverID) {
fin := time.Now()
_, _ = AppendMarker(runID, serverID, "agent not connected server skipped")
_, _ = AppendMarker(runID, serverID, "agent not connected server skipped")
setServerRun(runID, srvIdx, bson.M{"server_runs.$.status": "skipped", "server_runs.$.finished_at": fin})
return
}
_, _ = AppendMarker(runID, serverID, fmt.Sprintf("run started on %s %d step(s), workspace vantage-run-%s", serverID, len(steps), runID))
_, _ = AppendMarker(runID, serverID, fmt.Sprintf("run started on %s %d step(s), workspace vantage-run-%s", serverID, len(steps), runID))
runEnv := map[string]string{}
allSecrets := map[string]string{}
@@ -223,14 +212,11 @@ func runServer(orgID, runID string, srvIdx int, steps []models.ResolvedStep, ser
maxAttempts = step.MaxRetries + 1
}
secretVals := resolveSecrets(orgID, step.SecretRefs)
for k, v := range secretVals {
allSecrets[k] = v
}
subst := map[string]string{}
for k, v := range runEnv {
subst[k] = v
@@ -249,8 +235,6 @@ func runServer(orgID, runID string, srvIdx int, steps []models.ResolvedStep, ser
cmdEnv[k] = v
}
marker := fmt.Sprintf("===== step %d/%d: %s (%s) =====", step.Order+1, len(steps), step.Name, step.Interpreter)
offset, _ := AppendMarker(runID, serverID, marker)
logPath := ServerRunLogPath(runID, serverID)
@@ -262,8 +246,7 @@ func runServer(orgID, runID string, srvIdx int, steps []models.ResolvedStep, ser
if attempts > 1 {
_, _ = AppendMarker(runID, serverID, fmt.Sprintf("retry %d/%d after failure", attempts-1, maxAttempts-1))
}
_ = StepLogs.Open(commandID, logPath, secretsSlice)
res = dispatchAndWait(serverID, commandID, &pb.RunStepCmd{
Interpreter: step.Interpreter,
@@ -272,18 +255,18 @@ func runServer(orgID, runID string, srvIdx int, steps []models.ResolvedStep, ser
TimeoutSeconds: 0,
WorkspaceId: runID,
})
StepLogs.Close(commandID)
StepLogs.Close(commandID)
if res != nil && res.ExitCode == 0 {
break
}
}
exit := 1
outEnv := map[string]string{}
outEnv := map[string]string{}
if res != nil {
exit = res.ExitCode
for k, v := range res.OutputEnv {
runEnv[k] = v
runEnv[k] = v
outEnv[k] = maskSecrets(v, allSecrets)
}
} else {
@@ -297,26 +280,24 @@ func runServer(orgID, runID string, srvIdx int, steps []models.ResolvedStep, ser
finishStep(runID, serverID, i, status, attempts, exit, offset, outEnv)
dur := time.Since(stepStart).Round(time.Millisecond)
_, _ = AppendMarker(runID, serverID, fmt.Sprintf("step %d/%d %s exit %d, %d attempt(s), %s",
_, _ = AppendMarker(runID, serverID, fmt.Sprintf("step %d/%d %s exit %d, %d attempt(s), %s",
step.Order+1, len(steps), status, exit, attempts, dur))
if exit != 0 {
switch step.OnFailure {
case "continue":
_, _ = AppendMarker(runID, serverID, "on_failure=continue proceeding to next step")
default:
_, _ = AppendMarker(runID, serverID, "on_failure=continue proceeding to next step")
default:
serverFailed = true
}
if serverFailed {
_, _ = AppendMarker(runID, serverID, "stopping run remaining steps skipped")
_, _ = AppendMarker(runID, serverID, "stopping run remaining steps skipped")
markRemainingSkipped(runID, serverID, i+1)
break
}
}
}
DispatchCleanupWorkspace(serverID, runID)
fin := time.Now()
@@ -324,10 +305,9 @@ func runServer(orgID, runID string, srvIdx int, steps []models.ResolvedStep, ser
if serverFailed {
status = "failed"
}
_, _ = AppendMarker(runID, serverID, fmt.Sprintf("run %s in %s workspace removed",
_, _ = AppendMarker(runID, serverID, fmt.Sprintf("run %s in %s workspace removed",
status, fin.Sub(now).Round(time.Millisecond)))
maskedRunEnv := make(map[string]string, len(runEnv))
for k, v := range runEnv {
maskedRunEnv[k] = maskSecrets(v, allSecrets)
@@ -339,8 +319,6 @@ func runServer(orgID, runID string, srvIdx int, steps []models.ResolvedStep, ser
})
}
func dispatchAndWait(serverID, commandID string, cmd *pb.RunStepCmd) *pb.StepResult {
ch := StepResults.Await(commandID)
if err := DispatchRunStep(serverID, commandID, cmd); err != nil {
@@ -360,9 +338,6 @@ func dispatchAndWait(serverID, commandID string, cmd *pb.RunStepCmd) *pb.StepRes
}
}
func expandVars(v string, lookup map[string]string) string {
return os.Expand(v, func(name string) string {
if name == "$" {
@@ -375,7 +350,7 @@ func expandVars(v string, lookup map[string]string) string {
func resolveSecrets(orgID string, refs []string) map[string]string {
out := map[string]string{}
for _, ref := range refs {
parts := strings.SplitN(ref, "/", 2)
if len(parts) != 2 {
continue
@@ -397,8 +372,6 @@ func maskSecrets(s string, secrets map[string]string) string {
return s
}
func setServerRun(runID string, srvIdx int, set bson.M) {
ctx, cancel := wfCtx()
defer cancel()
@@ -407,7 +380,6 @@ func setServerRun(runID string, srvIdx int, set bson.M) {
bson.M{"$set": set})
}
func serverIDAt(runID string, srvIdx int) string {
r, err := getRunByID(runID)
if err != nil || srvIdx >= len(r.ServerRuns) {
@@ -436,7 +408,6 @@ func finishStep(runID, serverID string, order int, status string, attempts, exit
})
}
func secretValues(m map[string]string) []string {
out := make([]string, 0, len(m))
for _, v := range m {
@@ -471,11 +442,6 @@ func updateStep(runID, serverID string, order int, set bson.M) {
)
}
func getRunByID(runID string) (*models.WorkflowRun, error) {
ctx, cancel := wfCtx()
defer cancel()
@@ -487,7 +453,6 @@ func getRunByID(runID string) (*models.WorkflowRun, error) {
return &r, err
}
func GetRun(orgID, runID string) (*models.WorkflowRun, error) {
ctx, cancel := wfCtx()
defer cancel()