Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: assume plugins may produce outputs.result and outputs.exitCode (Fixes #9966) #9967

Merged
merged 2 commits into from Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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