Skip to content

Commit

Permalink
fix: avoid updating TestWorkflow CRD status (#5979)
Browse files Browse the repository at this point in the history
  • Loading branch information
rangoo94 authored Oct 28, 2024
1 parent e911735 commit 56794ad
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions pkg/testworkflows/testworkflowexecutor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,8 @@ func (e *executor) Recover(ctx context.Context) {
}
}

func (e *executor) updateStatus(testWorkflow *testworkflowsv1.TestWorkflow, execution *testkube.TestWorkflowExecution,
func (e *executor) updateStatus(execution *testkube.TestWorkflowExecution,
testWorkflowExecution *testworkflowsv1.TestWorkflowExecution) {
if testWorkflow != nil {
// FIXME: is invalid: metadata.resourceVersion: Invalid value: 0x0: must be specified for an update
testWorkflow.Status = testworkflowmappers.MapTestWorkflowExecutionAPIToKubeTestWorkflowStatusSummary(execution)
if err := e.testWorkflowsClient.UpdateStatus(testWorkflow); err != nil {
log.DefaultLogger.Errorw("failed to update test workflow status", "error", err)
}
}

if testWorkflowExecution != nil {
testWorkflowExecution.Status = testworkflowmappers.MapTestWorkflowExecutionStatusAPIToKube(execution, testWorkflowExecution.Generation)
if err := e.testWorkflowExecutionsClient.UpdateStatus(testWorkflowExecution); err != nil {
Expand Down Expand Up @@ -211,7 +203,7 @@ func (e *executor) Control(ctx context.Context, testWorkflow *testworkflowsv1.Te
var wg sync.WaitGroup
wg.Add(2)
go func() {
e.updateStatus(testWorkflow, execution, testWorkflowExecution)
e.updateStatus(execution, testWorkflowExecution)
wg.Done()
}()
go func() {
Expand Down Expand Up @@ -326,7 +318,7 @@ func (e *executor) Control(ctx context.Context, testWorkflow *testworkflowsv1.Te

e.metrics.IncAndObserveExecuteTestWorkflow(*execution, e.dashboardURI)

e.updateStatus(testWorkflow, execution, testWorkflowExecution) // TODO: Consider if it is needed
e.updateStatus(execution, testWorkflowExecution) // TODO: Consider if it is needed
err = e.workerClient.Destroy(ctx, execution.Id, executionworkertypes.DestroyOptions{
Namespace: execution.Namespace,
})
Expand Down

0 comments on commit 56794ad

Please sign in to comment.