Commit db3c1ea9 authored by Tomasz Maczukin's avatar Tomasz Maczukin

Update common.Build.executeUploadArtifacts()

parent cbb74b17
......@@ -170,26 +170,26 @@ func (b *Build) executeStage(buildStage BuildStage, executor Executor, abort cha
}
func (b *Build) executeUploadArtifacts(state error, executor Executor, abort chan interface{}) (err error) {
if len(b.Artifacts) < 1 {
return state
}
when := b.Artifacts[0].When
if state == nil {
// Previous stages were successful
if when == "" || when == ArtifactWhenOnSuccess || when == ArtifactWhenAlways {
err = b.executeStage(BuildStageUploadArtifacts, executor, abort)
}
} else {
// Previous stage did fail
if when == ArtifactWhenOnFailure || when == ArtifactWhenAlways {
err = b.executeStage(BuildStageUploadArtifacts, executor, abort)
jobState := state
for _, artifacts := range b.Artifacts {
when := artifacts.When
if state == nil {
// Previous stages were successful
if when == "" || when == ArtifactWhenOnSuccess || when == ArtifactWhenAlways {
state = b.executeStage(BuildStageUploadArtifacts, executor, abort)
}
} else {
// Previous stage did fail
if when == ArtifactWhenOnFailure || when == ArtifactWhenAlways {
err = b.executeStage(BuildStageUploadArtifacts, executor, abort)
}
}
}
// Use previous error if set
if state != nil {
err = state
// Use job's error if set
if jobState != nil {
err = jobState
}
return
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment