Skip to content

Commit

Permalink
fix: assume plugins may produce outputs.result and outputs.exitCode (F…
Browse files Browse the repository at this point in the history
…ixes #9966) (#9967)

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
  • Loading branch information
crenshaw-dev committed Nov 4, 2022
1 parent 6ba1fa5 commit d4e60fa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/apis/workflow/v1alpha1/workflow_types.go
Expand Up @@ -2923,9 +2923,10 @@ func (tmpl *Template) GetVolumeMounts() []apiv1.VolumeMount {
return nil
}

// whether or not the template can and will have outputs (i.e. exit code and result)
// HasOutput returns true if the template can and will have outputs (i.e. exit code and result).
// In the case of a plugin, we assume it will have outputs because we cannot know at runtime.
func (tmpl *Template) HasOutput() bool {
return tmpl.Container != nil || tmpl.ContainerSet.HasContainerNamed("main") || tmpl.Script != nil || tmpl.Data != nil || tmpl.HTTP != nil
return tmpl.Container != nil || tmpl.ContainerSet.HasContainerNamed("main") || tmpl.Script != nil || tmpl.Data != nil || tmpl.HTTP != nil || tmpl.Plugin != nil
}

func (t *Template) IsDaemon() bool {
Expand Down
4 changes: 4 additions & 0 deletions pkg/apis/workflow/v1alpha1/workflow_types_test.go
Expand Up @@ -1309,6 +1309,10 @@ func TestTemplate_HasOutputs(t *testing.T) {
x := &Template{Resource: &ResourceTemplate{}}
assert.False(t, x.HasOutput())
})
t.Run("Plugin", func(t *testing.T) {
x := &Template{Plugin: &Plugin{}}
assert.True(t, x.HasOutput())
})
}

func TestTemplate_SaveLogsAsArtifact(t *testing.T) {
Expand Down

0 comments on commit d4e60fa

Please sign in to comment.