-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstep.go
More file actions
768 lines (654 loc) · 19.9 KB
/
step.go
File metadata and controls
768 lines (654 loc) · 19.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
package probe
import (
"context"
"errors"
"fmt"
"regexp"
"strconv"
"strings"
"time"
)
const (
// DefaultStepTimeout is the default timeout for action execution
DefaultStepTimeout = 5 * time.Minute
)
type Step struct {
Name string `yaml:"name"`
ID string `yaml:"id,omitempty"`
Uses string `yaml:"uses" validate:"required"`
With map[string]any `yaml:"with"`
Test string `yaml:"test"`
Echo string `yaml:"echo"`
Vars map[string]any `yaml:"vars"`
Iteration []map[string]any `yaml:"iteration"`
Wait string `yaml:"wait,omitempty"`
SkipIf string `yaml:"skipif,omitempty"`
Outputs map[string]string `yaml:"outputs,omitempty"`
Retry *StepRetry `yaml:"retry,omitempty"`
Timeout Interval `yaml:"timeout,omitempty"`
err error
ctx StepContext
Idx int `yaml:"-"`
Expr *Expr `yaml:"-"`
actionRunner ActionRunner `yaml:"-"`
}
func (st *Step) Do(jCtx *JobContext) {
// 1. Preparation phase: validation, wait, skip check
name, shouldContinue := st.prepare(jCtx)
if !shouldContinue {
return
}
// 2. Action execution phase
actionResult, err := st.executeAction(name, jCtx)
if err != nil {
st.handleActionError(err, name, jCtx)
return
}
// 3. Result processing phase
st.processActionResult(actionResult, jCtx)
// 4. Finalization phase: test, echo, output save, result creation
st.finalize(name, actionResult, jCtx)
}
// prepare handles step preparation: validation, skip check, and wait
// Returns (stepName, shouldContinue)
func (st *Step) prepare(jCtx *JobContext) (string, bool) {
// Set default name if empty
if st.Name == "" {
st.Name = "Unknown Step"
}
// Evaluate step name
name, err := st.Expr.EvalTemplate(st.Name, st.ctx)
if err != nil {
jCtx.Printer.PrintError("step name evaluation error: %v", err)
return "", false
}
jCtx.Printer.AddSpinnerSuffix(name)
// Check if step should be skipped BEFORE waiting
if st.shouldSkip(jCtx) {
st.handleSkip(name, jCtx)
return name, false
}
// Handle wait only if step is not skipped
st.handleWait(jCtx)
return name, true
}
// executeAction executes the step action and returns the result
// If retry is configured, it will retry until status == 0 or max attempts reached
func (st *Step) executeAction(name string, jCtx *JobContext) (map[string]any, error) {
expW := st.Expr.EvalTemplateMap(st.With, st.ctx)
runner := st.actionRunner
if runner == nil {
runner = &PluginActionRunner{} // Default to plugin execution
}
// If no retry configuration, execute once
if st.Retry == nil {
return st.executeSingleAction(runner, expW, jCtx)
}
// Execute with retry logic
return st.executeActionWithRetry(runner, expW, jCtx, name)
}
// executeSingleAction executes action once without retry
func (st *Step) executeSingleAction(runner ActionRunner, expW map[string]any, jCtx *JobContext) (map[string]any, error) {
// Determine timeout duration
timeout := DefaultStepTimeout
if st.Timeout.Duration > 0 {
timeout = st.Timeout.Duration
}
// Create context with timeout
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
// Execute action in goroutine
type result struct {
ret map[string]any
err error
}
resultCh := make(chan result, 1)
go func() {
ret, err := runner.RunActions(st.Uses, []string{}, expW, jCtx.Verbose)
resultCh <- result{ret: ret, err: err}
}()
// Wait for either completion or timeout
select {
case res := <-resultCh:
return res.ret, res.err
case <-ctx.Done():
return nil, errors.New("action execution timed out after " + timeout.String())
}
}
// executeActionWithRetry executes action with retry logic until status == 0
func (st *Step) executeActionWithRetry(runner ActionRunner, expW map[string]any, jCtx *JobContext, name string) (map[string]any, error) {
retry := st.Retry
// Initial delay if specified
if retry.InitialDelay.Duration > 0 {
if jCtx.Verbose {
jCtx.Printer.LogDebug("Initial delay before first attempt: %v", retry.InitialDelay.Duration)
}
time.Sleep(retry.InitialDelay.Duration)
}
var lastResult map[string]any
var lastErr error
// Retry loop
for attempt := 1; attempt <= retry.MaxAttempts; attempt++ {
if jCtx.Verbose {
jCtx.Printer.LogDebug("Executing action with retry: attempt %d/%d", attempt, retry.MaxAttempts)
}
result, err := st.executeSingleAction(runner, expW, jCtx)
lastResult = result
lastErr = err
// Check for success (status == 0)
if err == nil {
if status, ok := result["status"]; ok {
var statusInt int
var isInt bool
switch v := status.(type) {
case int:
statusInt, isInt = v, true
case int64:
statusInt, isInt = int(v), true
}
if isInt && statusInt == int(ExitStatusSuccess) {
if jCtx.Verbose {
jCtx.Printer.LogDebug("Action succeeded on attempt %d", attempt)
}
return result, nil
}
}
}
// If not the last attempt, wait for interval
if attempt < retry.MaxAttempts {
if jCtx.Verbose {
jCtx.Printer.LogDebug("Action failed (attempt %d), retrying after %v", attempt, retry.Interval.Duration)
}
time.Sleep(retry.Interval.Duration)
}
}
// All attempts failed
if jCtx.Verbose {
jCtx.Printer.LogDebug("All retry attempts failed (%d attempts)", retry.MaxAttempts)
}
return lastResult, lastErr
}
// handleActionError handles action execution errors
func (st *Step) handleActionError(err error, name string, jCtx *JobContext) {
actionErr := NewActionError("step_execute", "action execution failed", err).
WithContext("step_name", name).
WithContext("action_type", st.Uses)
st.err = actionErr
jCtx.Printer.PrintError("Action execution failed: %v", actionErr)
jCtx.SetFailed()
// Create and add step result for failed action execution
if jCtx.Verbose {
jCtx.Printer.PrintRequestResponse(st.Idx, name, st.ctx.Req, st.ctx.Res, st.ctx.RT.Duration)
}
// Handle repeat execution
if jCtx.IsRepeating {
st.handleRepeatExecution(jCtx, name, true) // true = hasError
return
}
// Standard execution: create result for failed step
stepResult := st.createFailedStepResult(name, jCtx, nil)
// Add step result to workflow buffer
if jCtx.Result != nil {
jCtx.Result.AddStepResult(jCtx.CurrentJobID, stepResult)
}
if jCtx.Verbose {
jCtx.Printer.PrintSeparator()
}
}
// processActionResult processes the action result and updates context
func (st *Step) processActionResult(actionResult map[string]any, jCtx *JobContext) {
// Parse and process JSON response
req, _ := actionResult["req"].(map[string]any)
res, okres := actionResult["res"].(map[string]any)
rt, _ := actionResult["rt"].(string)
status := parseExitStatus(actionResult["status"])
if okres {
body, okbody := res["body"].(string)
if okbody && isJSON(body) {
res["rawbody"] = body
res["body"] = mustMarshalJSON(body)
}
}
// Update context with status
st.updateCtx(nil, req, res, rt, status)
}
// finalize handles the final phase: test, echo, output save, and result creation
func (st *Step) finalize(name string, actionResult map[string]any, jCtx *JobContext) {
if jCtx.Verbose {
jCtx.Printer.PrintRequestResponse(st.Idx, name, st.ctx.Req, st.ctx.Res, st.ctx.RT.Duration)
}
// Handle repeat execution
if jCtx.IsRepeating {
st.handleRepeatExecution(jCtx, name, false) // false = no error
return
}
// Standard execution: save outputs and create result
st.saveOutputs(jCtx)
stepResult := st.createStepResult(name, jCtx, nil)
// Add step result to workflow buffer
if jCtx.Result != nil {
jCtx.Result.AddStepResult(jCtx.CurrentJobID, stepResult)
}
if jCtx.Verbose {
jCtx.Printer.PrintSeparator()
}
}
// createStepResult creates a StepResult from step execution
func (st *Step) createStepResult(name string, jCtx *JobContext, repeatCounter *StepRepeatCounter) StepResult {
result := StepResult{
Index: st.Idx,
Name: name,
HasTest: st.Test != "",
RT: "",
WaitTime: st.getWaitTimeForDisplay(),
RepeatCounter: repeatCounter,
}
if jCtx.RT && st.ctx.RT.Duration != "" {
result.RT = st.ctx.RT.Duration
result.RTSec = st.ctx.RT.Sec
}
if v, ok := st.ctx.Res["report"]; ok {
if report, sok := v.(string); sok {
result.Report = report
}
}
if st.Test != "" {
testOutput, ok := st.DoTest(jCtx.Printer)
if ok {
result.Status = StatusSuccess
} else {
result.Status = StatusError
result.TestOutput = testOutput
jCtx.SetFailed()
}
} else {
result.Status = StatusWarning
}
if st.Echo != "" {
result.EchoOutput = st.getEchoOutput(jCtx.Printer)
}
return result
}
// getEchoOutput returns the echo output as string
func (st *Step) getEchoOutput(printer *Printer) string {
exprOut, err := st.Expr.EvalTemplate(st.Echo, st.ctx)
return printer.generateEchoOutput(exprOut, err)
}
func (st *Step) handleRepeatExecution(jCtx *JobContext, name string, hasError bool) {
// Execute test first (outside of lock)
hasTest := st.Test != ""
testResult := true
var testOutput string
// If there was an error, always count as failure
if hasError {
testResult = false
} else if hasTest {
testOutput, testResult = st.DoTest(jCtx.Printer)
if !testResult {
jCtx.SetFailed()
}
}
// Update counter atomically with lock held throughout
jCtx.countersMu.Lock()
counter, exists := jCtx.StepCounters[st.Idx]
if !exists {
counter = StepRepeatCounter{
Name: name,
RepeatTotal: jCtx.RepeatTotal,
}
}
// Update counts based on result
if hasError || (hasTest && !testResult) {
counter.FailureCount++
} else {
counter.SuccessCount++
}
counter.LastResult = testResult
// Store updated counter back to map
jCtx.StepCounters[st.Idx] = counter
jCtx.countersMu.Unlock()
// Display on first execution and final execution only
isFinalExecution := jCtx.RepeatCurrent == jCtx.RepeatTotal
if isFinalExecution {
// Create StepResult with repeat counter for final execution
stepResult := st.createStepResult(name, jCtx, &counter)
if hasTest && !testResult {
stepResult.TestOutput = testOutput
}
// Add step result to workflow buffer
if jCtx.Result != nil {
jCtx.Result.AddStepResult(jCtx.CurrentJobID, stepResult)
}
}
// Handle echo output
if st.Echo != "" {
st.DoEcho(jCtx)
}
}
func (st *Step) DoTest(printer *Printer) (string, bool) {
exprOut, err := st.Expr.Eval(st.Test, st.ctx)
if err != nil {
return printer.generateTestError(st.Test, err), false
}
boolOutput, boolOk := exprOut.(bool)
if !boolOk {
return printer.generateTestTypeMismatch(st.Test, exprOut), false
}
if printer.verbose {
printer.PrintTestResult(boolOutput, st.Test, st.ctx)
}
if !boolOutput {
return printer.generateTestFailure(st.Test, exprOut, st.ctx.Req, st.ctx.Res), false
}
return "", true
}
func (st *Step) DoEcho(jCtx *JobContext) {
exprOut, err := st.Expr.EvalTemplate(st.Echo, st.ctx)
if err != nil {
jCtx.Printer.LogError("Echo evaluation failed: %#v (input: %s)", err, st.Echo)
} else {
jCtx.Printer.PrintEchoContent(exprOut)
}
}
func (st *Step) SetCtx(j JobContext, override map[string]any) {
// Use outputs from the unified Outputs structure
var outputs map[string]any
if j.Outputs != nil {
outputs = j.Outputs.GetAll()
}
// Create context for step vars evaluation
evalCtx := StepContext{
Vars: j.Vars,
Outputs: outputs,
RepeatIndex: j.RepeatCurrent,
}
// Evaluate step-level vars with access to outputs
evaluatedStepVars := make(map[string]any)
if len(st.Vars) > 0 {
expr := &Expr{}
for k, v := range st.Vars {
if mapV, ok := v.(map[string]any); ok {
evaluatedStepVars[k] = expr.EvalTemplateMap(mapV, evalCtx)
} else if strV, ok2 := v.(string); ok2 {
output, err := expr.EvalTemplate(strV, evalCtx)
if err != nil {
// If evaluation fails, keep original value
evaluatedStepVars[k] = v
} else {
evaluatedStepVars[k] = output
}
} else {
evaluatedStepVars[k] = v
}
}
}
// Merge workflow vars with evaluated step vars
vers := MergeMaps(j.Vars, evaluatedStepVars)
if override != nil {
vers = MergeMaps(vers, override)
}
st.ctx = StepContext{
Vars: vers,
Outputs: outputs,
RepeatIndex: j.RepeatCurrent,
}
}
// parseExitStatus converts various status representations to int
func parseExitStatus(status any) int {
if status == nil {
return int(ExitStatusFailure) // default to failure if status is nil
}
switch v := status.(type) {
case int:
return v
case int64:
// Handle integers converted from protobuf float64 by convertFloatToInt
return int(v)
case float64:
// Handle JSON numbers which are parsed as float64
return int(v)
case string:
if v == "0" {
return int(ExitStatusSuccess)
} else {
return int(ExitStatusFailure)
}
case ExitStatus:
return int(v)
default:
return int(ExitStatusFailure) // default to failure for unknown types
}
}
func (st *Step) updateCtx(logs []map[string]any, req, res map[string]any, rt string, status int) {
st.ctx.Req = req
st.ctx.Res = res
st.ctx.Status = status
// Parse RT string to populate RT structure
if rt != "" {
if duration, err := time.ParseDuration(rt); err == nil {
st.ctx.RT = ResponseTime{
Duration: rt,
Sec: duration.Seconds(),
}
}
} else {
st.ctx.RT = ResponseTime{}
}
}
// handleWait processes the wait field and sleeps if necessary
func (st *Step) handleWait(jCtx *JobContext) {
if st.Wait == "" {
return
}
// Evaluate wait expression template first
waitExpr, err := st.Expr.EvalTemplate(st.Wait, st.ctx)
if err != nil {
jCtx.Printer.PrintError("wait expression evaluation error: %v", err)
return
}
duration, err := st.parseWaitDuration(waitExpr)
if err != nil {
jCtx.Printer.PrintError("wait duration parsing error: %v", err)
return
}
if duration > 0 {
msg := colorWarning().Sprintf("(%s wait)", st.formatWaitTime(duration))
msg = fmt.Sprintf("%s %s", msg, st.Name)
sleepWithMessage(duration, msg, jCtx.Printer.AddSpinnerSuffix)
}
}
func sleepWithMessage(d time.Duration, m string, fn func(m string)) {
if d < time.Second {
time.Sleep(d)
return
}
ticker := time.NewTicker(1 * time.Second)
defer ticker.Stop()
timer := time.NewTimer(d)
defer timer.Stop()
for {
select {
case <-ticker.C:
fn(m)
case <-timer.C:
return
}
}
}
// parseWaitDuration parses wait string to time.Duration
func (st *Step) parseWaitDuration(wait string) (time.Duration, error) {
// Check if it's a plain number (treat as seconds for backward compatibility)
if matched, _ := regexp.MatchString(`^\d+$`, wait); matched {
if seconds, err := strconv.Atoi(wait); err == nil {
return time.Duration(seconds) * time.Second, nil
}
return 0, fmt.Errorf("invalid wait value: %s", wait)
}
// Parse as duration string (e.g., "1s", "500ms", "2m")
duration, err := time.ParseDuration(wait)
if err != nil {
return 0, fmt.Errorf("invalid wait format: %s", wait)
}
return duration, nil
}
// formatWaitTime formats duration for display
func (st *Step) formatWaitTime(duration time.Duration) string {
if duration < time.Second {
return duration.String()
}
if duration%time.Second == 0 {
return fmt.Sprintf("%ds", int(duration/time.Second))
}
return duration.String()
}
// getWaitTimeForDisplay returns formatted wait time for display
func (st *Step) getWaitTimeForDisplay() string {
if st.Wait == "" {
return ""
}
// Note: st.ctx might not be fully initialized when this is called during result creation
// So we need to handle template evaluation carefully
waitExpr := st.Wait
if st.Expr != nil {
if evaluated, err := st.Expr.EvalTemplate(st.Wait, st.ctx); err == nil {
waitExpr = evaluated
}
}
duration, err := st.parseWaitDuration(waitExpr)
if err != nil {
// If template evaluation failed and we still have template syntax, return empty
// This prevents display errors during result creation
if strings.Contains(waitExpr, "{{") {
return ""
}
return ""
}
return st.formatWaitTime(duration)
}
// shouldSkip evaluates the skipif expression and returns true if step should be skipped
func (st *Step) shouldSkip(jCtx *JobContext) bool {
if st.SkipIf == "" {
return false
}
result, err := st.Expr.Eval(st.SkipIf, st.ctx)
if err != nil {
jCtx.Printer.PrintError("skipif evaluation error: %v", err)
return false // Don't skip on evaluation error
}
boolResult, ok := result.(bool)
if !ok {
jCtx.Printer.PrintError("skipif expression must return boolean, got: %T", result)
return false // Don't skip on type error
}
return boolResult
}
// handleSkip handles the skipped step logic
func (st *Step) handleSkip(name string, jCtx *JobContext) {
if jCtx.Verbose {
jCtx.Printer.LogDebug("%s", colorWarning().Sprintf("--- Step %d: %s (SKIPPED)", st.Idx, name))
jCtx.Printer.LogDebug("Skip condition: %s", st.SkipIf)
jCtx.Printer.PrintSeparator()
return
}
// Handle repeat execution for skipped steps
if jCtx.IsRepeating {
st.handleSkipRepeatExecution(jCtx, name)
return
}
// Create step result for skipped step
stepResult := st.createSkippedStepResult(name, jCtx, nil)
// Add step result to workflow buffer
if jCtx.Result != nil {
jCtx.Result.AddStepResult(jCtx.CurrentJobID, stepResult)
}
}
// handleSkipRepeatExecution handles skipped step in repeat mode
func (st *Step) handleSkipRepeatExecution(jCtx *JobContext, name string) {
// Update counter atomically with lock held throughout
jCtx.countersMu.Lock()
counter, exists := jCtx.StepCounters[st.Idx]
if !exists {
counter = StepRepeatCounter{
Name: name,
RepeatTotal: jCtx.RepeatTotal,
}
}
// Count as successful (skipped is not a failure)
counter.SuccessCount++
counter.LastResult = true
// Store updated counter back to map
jCtx.StepCounters[st.Idx] = counter
jCtx.countersMu.Unlock()
// Display on first execution and final execution only
isFinalExecution := jCtx.RepeatCurrent == jCtx.RepeatTotal
if isFinalExecution {
stepResult := st.createSkippedStepResult(name, jCtx, &counter)
// Add step result to workflow buffer
if jCtx.Result != nil {
jCtx.Result.AddStepResult(jCtx.CurrentJobID, stepResult)
}
}
}
// createSkippedStepResult creates a StepResult for a skipped step
func (st *Step) createSkippedStepResult(name string, jCtx *JobContext, repeatCounter *StepRepeatCounter) StepResult {
return StepResult{
Index: st.Idx,
Name: name + " (SKIPPED)",
Status: StatusSkipped,
RT: "",
WaitTime: st.getWaitTimeForDisplay(),
HasTest: false,
RepeatCounter: repeatCounter,
}
}
// createFailedStepResult creates a StepResult for a failed step
func (st *Step) createFailedStepResult(name string, jCtx *JobContext, repeatCounter *StepRepeatCounter) StepResult {
result := StepResult{
Index: st.Idx,
Name: name,
Status: StatusError,
RT: "",
WaitTime: st.getWaitTimeForDisplay(),
HasTest: st.Test != "",
RepeatCounter: repeatCounter,
}
if jCtx.RT && st.ctx.RT.Duration != "" {
result.RT = st.ctx.RT.Duration
result.RTSec = st.ctx.RT.Sec
}
if v, ok := st.ctx.Res["report"]; ok {
if report, sok := v.(string); sok {
result.Report = report
}
}
// Include error information if available
if st.err != nil {
result.TestOutput = st.err.Error()
}
return result
}
// saveOutputs evaluates and saves step outputs to JobContext
func (st *Step) saveOutputs(jCtx *JobContext) {
if len(st.Outputs) == 0 || st.ID == "" {
return // No outputs to save or no ID (should be caught by validation)
}
// Evaluate each output expression
outputs := make(map[string]any)
for outputName, outputExpr := range st.Outputs {
result, err := st.Expr.Eval(outputExpr, st.ctx)
if err != nil {
jCtx.Printer.PrintError("output '%s' evaluation error: %v", outputName, err)
continue // Skip this output but continue with others
}
outputs[outputName] = result
}
// Save outputs to the unified Outputs structure
if jCtx.Outputs != nil {
if err := jCtx.Outputs.Set(st.ID, outputs); err != nil {
jCtx.Printer.PrintError("Output conflict warning: %v", err)
}
}
if jCtx.Verbose {
jCtx.Printer.LogDebug("Step '%s' outputs saved: %v", st.ID, outputs)
}
}