remove break after input in pipeline

This commit is contained in:
Donny Xia
2020-08-20 11:54:56 -07:00
parent 037ac3b134
commit 501684a9c6
3 changed files with 48 additions and 13 deletions

View File

@@ -75,11 +75,6 @@ type Pipeline struct {
// Outputs are where the transformed Resource Configuration is written.
Outputs []Writer `yaml:"outputs,omitempty"`
// ContinueIfInputEmpty indicates should pipeline continue when the
// the input result is empty. This is useful when we want to run outputs
// even the input is empty.
ContinueIfInputEmpty bool
}
// Execute executes each step in the sequence, returning immediately after encountering
@@ -104,10 +99,6 @@ func (p Pipeline) ExecuteWithCallback(callback PipelineExecuteCallbackFunc) erro
}
result = append(result, nodes...)
}
if len(result) == 0 && !p.ContinueIfInputEmpty {
// no inputs to operate on
return nil
}
// apply operations
var err error
@@ -117,6 +108,9 @@ func (p Pipeline) ExecuteWithCallback(callback PipelineExecuteCallbackFunc) erro
callback(op)
}
result, err = op.Filter(result)
// TODO: This len(result) == 0 should be removed and empty result list should be
// handled by outputs. However currently the some writer like LocalPackageReadWriter
// will clear the output directory and which will cause unpredictable results
if len(result) == 0 || err != nil {
return errors.Wrap(err)
}