From 40775d0c7cab11e639f60c7e3efbe305c8035542 Mon Sep 17 00:00:00 2001 From: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Date: Thu, 3 Nov 2022 22:10:04 -0400 Subject: [PATCH 1/2] fix: assume plugins may produce outputs.result and outputs.exitCode Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --- pkg/apis/workflow/v1alpha1/workflow_types.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/apis/workflow/v1alpha1/workflow_types.go b/pkg/apis/workflow/v1alpha1/workflow_types.go index 76340b563e9c..4926052a6b02 100644 --- a/pkg/apis/workflow/v1alpha1/workflow_types.go +++ b/pkg/apis/workflow/v1alpha1/workflow_types.go @@ -2925,7 +2925,7 @@ func (tmpl *Template) GetVolumeMounts() []apiv1.VolumeMount { // whether or not the template can and will have outputs (i.e. exit code and result) 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 { From 7d446f9e8541cb44b381ca6289733e95d1974967 Mon Sep 17 00:00:00 2001 From: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Date: Fri, 4 Nov 2022 08:38:06 -0400 Subject: [PATCH 2/2] chore: comment, test Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --- pkg/apis/workflow/v1alpha1/workflow_types.go | 3 ++- pkg/apis/workflow/v1alpha1/workflow_types_test.go | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/apis/workflow/v1alpha1/workflow_types.go b/pkg/apis/workflow/v1alpha1/workflow_types.go index 4926052a6b02..64c4bf470b02 100644 --- a/pkg/apis/workflow/v1alpha1/workflow_types.go +++ b/pkg/apis/workflow/v1alpha1/workflow_types.go @@ -2923,7 +2923,8 @@ 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 || tmpl.Plugin != nil } diff --git a/pkg/apis/workflow/v1alpha1/workflow_types_test.go b/pkg/apis/workflow/v1alpha1/workflow_types_test.go index d4881edba48c..586f60ed7332 100644 --- a/pkg/apis/workflow/v1alpha1/workflow_types_test.go +++ b/pkg/apis/workflow/v1alpha1/workflow_types_test.go @@ -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) {