-
Notifications
You must be signed in to change notification settings - Fork 605
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(pipeline-stop): Fetch latest resource version to avoid 409 conflict #3463
fix(pipeline-stop): Fetch latest resource version to avoid 409 conflict #3463
Conversation
// Fetching the latest resourceVersion for the Pipelinerun to avoid 409 conflict | ||
k8sGet(PipelineRunModel, pipelineRun.metadata.name, pipelineRun.metadata.namespace) | ||
.then((latestPLR) => | ||
k8sUpdate(PipelineRunModel, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this not using patch
?
We don't want to get into a pattern of fetching resources before updating. It doesn't actually solve any problem. Only further mitigates an already low percent chance of error. Actually we already do this when firehose is being used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@christianvogt Updated to use patch. Works well after removing the resourceVersion from the equation.
b9014c2
to
3544c5d
Compare
{ | ||
op: 'replace', | ||
path: `/spec`, | ||
value: { ...pipelineRun.spec, status: 'PipelineRunCancelled' }, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A patch request should be as small as possible only patching the parts of the resource you are changing.
{
op: 'replace',
path: `/spec/status`,
value: 'PipelineRunCancelled',
},
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated, the only problem that could occur though is, If someone starts a PipelineRun and stops it immediately, before the status field is generated, the patch might not work, but it is a very edge case.
3544c5d
to
fd24c14
Compare
/lgtm |
/test e2e-gcp-console |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: abhinandan13jan, christianvogt The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest Please review the full test history for this PR and help us cut down flakes. |
10 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
Addresses https://jira.coreos.com/browse/ODC-1898