Skip to content

Commit b3943e3

Browse files
authored
Merge pull request #159 from walter-cd/fix-parallel-skip
Fix bug not to skip in parallel stages
2 parents 13f73a8 + 3fd4fea commit b3943e3

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

engine/engine.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ func (e *Engine) ExecuteStage(stage stages.Stage) {
9393
log.Debugf("Execute as parent name %+v", stage.GetStageName())
9494

9595
mediator := stages.Mediator{States: make(map[string]string)}
96-
mediator.States[stage.GetStageName()] = e.executeStage(stage, mediatorsReceived)
97-
e.executeChildStages(&stage, &mediator)
96+
mediator.States[stage.GetStageName()] = e.executeStage(stage, mediatorsReceived, mediator)
9897

9998
log.Debugf("Sending output of stage: %+v %v", stage.GetStageName(), mediator)
10099
*stage.GetOutputCh() <- mediator
@@ -112,16 +111,22 @@ func (e *Engine) executeChildStages(stage *stages.Stage, mediator *stages.Mediat
112111
}
113112
}
114113

115-
func (e *Engine) executeStage(stage stages.Stage, received []stages.Mediator) string {
114+
func (e *Engine) executeStage(stage stages.Stage, received []stages.Mediator, mediator stages.Mediator) string {
116115
var result string
117116
if !e.isUpstreamAnyFailure(received) || e.Opts.StopOnAnyFailure {
118117
result = strconv.FormatBool(stage.(stages.Runner).Run())
119118
e.EnvVariables.ExportSpecialVariable("__OUT[\""+stage.GetStageName()+"\"]", stage.GetOutResult())
120119
e.EnvVariables.ExportSpecialVariable("__ERR[\""+stage.GetStageName()+"\"]", stage.GetErrResult())
121120
e.EnvVariables.ExportSpecialVariable("__COMBINED[\""+stage.GetStageName()+"\"]", stage.GetCombinedResult())
122121
e.EnvVariables.ExportSpecialVariable("__RESULT[\""+stage.GetStageName()+"\"]", result)
122+
e.executeChildStages(&stage, &mediator)
123123
} else {
124124
log.Warnf("Execution is skipped: %v", stage.GetStageName())
125+
if childStages := stage.GetChildStages(); childStages.Len() > 0 {
126+
for childStage := childStages.Front(); childStage != nil; childStage = childStage.Next() {
127+
log.Warnf("Execution of child stage is skipped: %v", childStage.Value.(stages.Stage).GetStageName())
128+
}
129+
}
125130
result = "skipped"
126131
}
127132
if !stage.GetSuppressAll() {

0 commit comments

Comments
 (0)