Skip to content

Commit

Permalink
Fix global artifact overwriting in nested workflow (argoproj#1086)
Browse files Browse the repository at this point in the history
  • Loading branch information
WeiTang114 authored and jackywu committed Jan 15, 2019
1 parent 8915842 commit acfb957
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions workflow/controller/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,7 @@ func (woc *wfOperationCtx) addOutputsToScope(prefix string, outputs *wfv1.Output
if scope != nil {
scope.addArtifactToScope(key, art)
}
woc.addArtifactToGlobalScope(art)
woc.addArtifactToGlobalScope(art, scope)
}
}

Expand Down Expand Up @@ -1388,7 +1388,7 @@ func (woc *wfOperationCtx) addParamToGlobalScope(param wfv1.Parameter) {

// addArtifactToGlobalScope exports any desired node outputs to the global scope
// Optionally adds to a local scope if supplied
func (woc *wfOperationCtx) addArtifactToGlobalScope(art wfv1.Artifact) {
func (woc *wfOperationCtx) addArtifactToGlobalScope(art wfv1.Artifact, scope *wfScope) {
if art.GlobalName == "" {
return
}
Expand All @@ -1402,6 +1402,9 @@ func (woc *wfOperationCtx) addArtifactToGlobalScope(art wfv1.Artifact) {
art.Path = ""
if !reflect.DeepEqual(woc.wf.Status.Outputs.Artifacts[i], art) {
woc.wf.Status.Outputs.Artifacts[i] = art
if scope != nil {
scope.addArtifactToScope(globalArtName, art)
}
woc.log.Infof("overwriting %s: %v", globalArtName, art)
woc.updated = true
}
Expand All @@ -1417,6 +1420,9 @@ func (woc *wfOperationCtx) addArtifactToGlobalScope(art wfv1.Artifact) {
art.Path = ""
woc.log.Infof("setting %s: %v", globalArtName, art)
woc.wf.Status.Outputs.Artifacts = append(woc.wf.Status.Outputs.Artifacts, art)
if scope != nil {
scope.addArtifactToScope(globalArtName, art)
}
woc.updated = true
}

Expand Down

0 comments on commit acfb957

Please sign in to comment.