Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: avoid updating TestWorkflow CRD status #5979

Merged
merged 1 commit into from
Oct 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading