From 5b499273cb37a4f578cce1d019bf97098b5c8066 Mon Sep 17 00:00:00 2001 From: jswxstw Date: Mon, 3 Nov 2025 20:59:43 +0800 Subject: [PATCH] fix: add archive location if artifact is needed in data source. Fixes #14990 Signed-off-by: oninowang --- docs/fields.md | 2 -- examples/data-transformations.yaml | 4 ---- workflow/controller/workflowpod.go | 8 +++++++- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/fields.md b/docs/fields.md index 93d819f77b49..548a1ab3426e 100644 --- a/docs/fields.md +++ b/docs/fields.md @@ -2054,8 +2054,6 @@ Outputs hold parameters, artifacts, and results from a step - [`dag-conditional-parameters.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/dag-conditional-parameters.yaml) -- [`data-transformations.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/data-transformations.yaml) - - [`exit-handler-with-artifacts.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/exit-handler-with-artifacts.yaml) - [`exit-handler-with-param.yaml`](https://github.com/argoproj/argo-workflows/blob/main/examples/exit-handler-with-param.yaml) diff --git a/examples/data-transformations.yaml b/examples/data-transformations.yaml index 73e1787029e2..fc70fa96b694 100644 --- a/examples/data-transformations.yaml +++ b/examples/data-transformations.yaml @@ -38,10 +38,6 @@ spec: transformation: - expression: "filter(data, {# endsWith \"main.log\"})" - outputs: - artifacts: - - name: file - path: /file - name: process-logs inputs: diff --git a/workflow/controller/workflowpod.go b/workflow/controller/workflowpod.go index 6382da137a12..986d18d83d0d 100644 --- a/workflow/controller/workflowpod.go +++ b/workflow/controller/workflowpod.go @@ -1205,7 +1205,13 @@ func (woc *wfOperationCtx) addArchiveLocation(ctx context.Context, tmpl *wfv1.Te } archiveLogs := woc.IsArchiveLogs(tmpl) needLocation := archiveLogs - for _, art := range append(tmpl.Inputs.Artifacts, tmpl.Outputs.Artifacts...) { + artifacts := append(tmpl.Inputs.Artifacts, tmpl.Outputs.Artifacts...) + if tmpl.Data != nil { + if art, exist := tmpl.Data.Source.GetArtifactIfNeeded(); exist { + artifacts = append(artifacts, *art) + } + } + for _, art := range artifacts { if !art.HasLocation() { needLocation = true }