chore(swf): fix recurring run + v2 compatible (#6297)

This commit is contained in:
Yuan (Bob) Gong 2021-08-11 18:22:25 +08:00 committed by GitHub
parent 579e46b840
commit a6ab4e4411
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -184,6 +184,8 @@ func (s *ScheduledWorkflow) NewWorkflow(
result.SetCannonicalLabels(s.Name, nextScheduledEpoch, s.nextIndex())
result.SetLabels(commonutil.LabelKeyWorkflowRunId, uuid.String())
// Pod pipeline/runid label is used by v2 compatible mode.
result.SetPodMetadataLabels(commonutil.LabelKeyWorkflowRunId, uuid.String())
// Replace {{workflow.uid}} with runId
err = result.ReplaceUID(uuid.String())
if err != nil {

View File

@ -726,6 +726,9 @@ func TestScheduledWorkflow_NewWorkflow(t *testing.T) {
BlockOwnerDeletion: commonutil.BooleanPointer(true)}},
},
Spec: workflowapi.WorkflowSpec{
PodMetadata: &workflowapi.Metadata{
Labels: map[string]string{"pipeline/runid": "123e4567-e89b-12d3-a456-426655440001"},
},
ServiceAccountName: "SERVICE_ACCOUNT",
Arguments: workflowapi.Arguments{
Parameters: []workflowapi.Parameter{
@ -800,6 +803,9 @@ func TestScheduledWorkflow_NewWorkflow_Parameterized(t *testing.T) {
BlockOwnerDeletion: commonutil.BooleanPointer(true)}},
},
Spec: workflowapi.WorkflowSpec{
PodMetadata: &workflowapi.Metadata{
Labels: map[string]string{"pipeline/runid": "123e4567-e89b-12d3-a456-426655440001"},
},
ServiceAccountName: "SERVICE_ACCOUNT",
Arguments: workflowapi.Arguments{
Parameters: []workflowapi.Parameter{