Skip to content

Commit 1097d45

Browse files
ChenRussellchenrui7
andauthored
fix: add creator label when submit workflow by the resubmit button in argo UI (#14349)
Signed-off-by: chenrui7 <[email protected]> Co-authored-by: chenrui7 <[email protected]>
1 parent 6c4c492 commit 1097d45

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

server/workflow/workflow_server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,7 @@ func (s *workflowServer) ResubmitWorkflow(ctx context.Context, req *workflowpkg.
510510
if err != nil {
511511
return nil, sutils.ToStatusError(err, codes.Internal)
512512
}
513+
creator.LabelCreator(ctx, newWF)
513514

514515
created, err := util.SubmitWorkflow(ctx, wfClient.ArgoprojV1alpha1().Workflows(req.Namespace), wfClient, req.Namespace, newWF, s.wfDefaults, &wfv1.SubmitOpts{})
515516
if err != nil {

server/workflow/workflow_server_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,8 @@ func TestResubmitWorkflow(t *testing.T) {
892892
wf, err := server.ResubmitWorkflow(ctx, &workflowpkg.WorkflowResubmitRequest{Name: "hello-world-9tql2", Namespace: "workflows"})
893893
require.NoError(t, err)
894894
assert.NotNil(t, wf)
895+
assert.Contains(t, wf.Labels, common.LabelKeyCreator)
896+
assert.Equal(t, userEmailLabel, wf.Labels[common.LabelKeyCreatorEmail])
895897
})
896898
t.Run("Unlabelled", func(t *testing.T) {
897899
_, err := server.ResubmitWorkflow(ctx, &workflowpkg.WorkflowResubmitRequest{Name: "unlabelled", Namespace: "workflows"})

server/workflowarchive/archived_workflow_server.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"github.com/argoproj/argo-workflows/v3/pkg/apis/workflow"
2121
wfv1 "github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1"
2222
"github.com/argoproj/argo-workflows/v3/server/auth"
23+
"github.com/argoproj/argo-workflows/v3/workflow/creator"
2324
"github.com/argoproj/argo-workflows/v3/workflow/hydrator"
2425
"github.com/argoproj/argo-workflows/v3/workflow/util"
2526

@@ -205,6 +206,7 @@ func (w *archivedWorkflowServer) ResubmitArchivedWorkflow(ctx context.Context, r
205206
if err != nil {
206207
return nil, sutils.ToStatusError(err, codes.Internal)
207208
}
209+
creator.LabelCreator(ctx, newWF)
208210

209211
created, err := util.SubmitWorkflow(ctx, wfClient.ArgoprojV1alpha1().Workflows(req.Namespace), wfClient, req.Namespace, newWF, w.wfDefaults, &wfv1.SubmitOpts{})
210212
if err != nil {

0 commit comments

Comments
 (0)