@@ -116,29 +116,22 @@ func (c *client) ExecStage(ctx context.Context, s *pipeline.Stage, m *sync.Map)
116116
117117 logger .Debug ("starting execution of stage" )
118118
119- // stop value determines when a stage's step series should stop executing
120- stop := false
119+ stageStatus := constants .StatusRunning
121120
122121 // execute the steps for the stage
123122 for _ , _step := range s .Steps {
124- // first check to see if we need to stop the stage before it even starts.
125- // this happens when using 'needs' block
126- if ! s .Independent && c .build .GetStatus () == constants .StatusFailure {
127- stop = true
128- }
123+ var useStatus string
129124
130- // set parallel rule that determines whether the step should adhere to entire build
131- // status check, which is determined by independent rule and stop value.
132- if ! stop && s .Independent {
133- _step .Ruleset .If .Parallel = true
125+ if s .Independent {
126+ useStatus = stageStatus
134127 } else {
135- _step . Ruleset . If . Parallel = false
128+ useStatus = c . build . GetStatus ()
136129 }
137130
138131 // check if the step should be skipped
139132 //
140133 // https://pkg.go.dev/github.com/go-vela/worker/internal/step#Skip
141- skip , err := step .Skip (_step , c .build )
134+ skip , err := step .Skip (_step , c .build , useStatus )
142135 if err != nil {
143136 return fmt .Errorf ("unable to plan step: %w" , c .err )
144137 }
@@ -213,7 +206,7 @@ func (c *client) ExecStage(ctx context.Context, s *pipeline.Stage, m *sync.Map)
213206 // failed steps within the stage should set the stop value to true unless
214207 // the continue rule is set to true.
215208 if _step .ExitCode != 0 && ! _step .Ruleset .Continue {
216- stop = true
209+ stageStatus = constants . StatusFailure
217210 }
218211 }
219212
0 commit comments