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

PipelineRun's completed status can be overwritten by failed results lookup #3667

Closed
ghost opened this issue Jan 8, 2021 · 1 comment · Fixed by #3684
Closed

PipelineRun's completed status can be overwritten by failed results lookup #3667

ghost opened this issue Jan 8, 2021 · 1 comment · Fixed by #3684
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@ghost
Copy link

ghost commented Jan 8, 2021

Expected Behavior

When a PipelineRun is completed the final status it records should be considered immutable and not change after that point.

Actual Behavior

When a Pipeline includes Pipeline Results there is a slim chance that its PipelineRuns' final status can be overwritten. This is because the PipelineRun reconciler does not process Pipeline Results until after the Run is in a completed state. The code for this is here:

pr.Status.MarkFailed(ReasonCouldntGetPipeline,
"Error retrieving pipeline for pipelinerun %s/%s: %s",
pr.Namespace, pr.Name, err)

That linked function, updatePipelineResults() is called from

c.updatePipelineResults(ctx, pr, getPipelineFunc)
which is inside a block guarded by if pr.IsDone(). Despite this the updatePipelineResults func can change the state of the PipelineRun to indicate a failure. This therefore has the opportunity to modify an existing completed status and overwrite information pertinent to the user.

This issue was created in response to feedback on PR 3472: https://github.com/tektoncd/pipeline/pull/3472/files#r552632569

@ghost ghost added the kind/bug Categorizes issue or PR as related to a bug. label Jan 8, 2021
@ghost ghost self-assigned this Jan 8, 2021
@ghost
Copy link
Author

ghost commented Jan 12, 2021

The code has moved around a bit since #3472 has been merged but the issue still affects the reconciler here:

msg := fmt.Sprintf("Failed to get Pipeline Spec to process Pipeline Results for PipelineRun %s/%s: %v", pr.Namespace, pr.Name, err)
logger.Error(msg)
logger.Warnf("An error processing Pipeline Results overwrites existing Succeeded Condition for PipelineRun %s/%s: %v", pr.Namespace, pr.Name, pr.Status.GetCondition(apis.ConditionSucceeded))
pr.Status.MarkFailed(ReasonCouldntGetPipeline, msg)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

0 participants