fix: correctly update pending and running commit status#2341
fix: correctly update pending and running commit status#2341zakisk merged 2 commits intotektoncd:mainfrom
Conversation
Summary of ChangesHello @ab-ghosh, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses two critical issues related to GitLab commit status reporting within the system. The primary goal is to ensure that commit statuses accurately reflect the state of pipelines, preventing confusion for users. It corrects an incorrect mapping of 'pending' states and ensures that the overarching 'Pipelines as Code CI' status is consistently updated from start to finish, providing a more reliable and transparent view of pipeline execution. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
🔍 PR Lint Feedback
|
There was a problem hiding this comment.
Code Review
This pull request correctly fixes two issues with GitLab commit status updates: the mapping of the pending status and the missing updates for the parent commit status. The changes look good and address the described problems. I've added a few suggestions to improve the implementation by reducing code duplication and making the status updates more robust by using the existing retry mechanism consistently.
8f10b7c to
6843d69
Compare
| // updateParentStatus updates the parent status (without pipeline name) to reflect the current state. | ||
| // This ensures the initial "Pipelines as Code CI" status set when waiting for /ok-to-test is updated |
There was a problem hiding this comment.
its application name "Pipelines as Code CI" (in this case) and you can find the application name value in Provider.pacInfo.ApplicationName field. you can check that if its /ok-to-test event it means admin has made ok-to-test comment on the MR and you can update the status with contextkey "Pipelines as Code CI" to succeed
There was a problem hiding this comment.
Addressed. When /ok-to-test is given, the parent status ("Pipelines as Code CI") is now set to success and stays that way. After the parent status is set to success, it won't be overwritten by pipeline running/completion states.
| parentStatus := status | ||
| parentStatus.OriginalPipelineRunName = "" | ||
| if err := p.vcx.CreateStatus(ctx, p.event, parentStatus); err != nil { | ||
| p.logger.Warnf("failed to update parent status: %v", err) | ||
| } |
There was a problem hiding this comment.
Do we want to use the helper function (updateParentStatus) here?
There was a problem hiding this comment.
Thank you for the suggestion. But I've removed the helper function since the parent status is no longer dependent on the PipelineRuns and is now set to a "success" state once CI is triggered.
976e599 to
faccbb1
Compare
faccbb1 to
54c4fcd
Compare
| case "pending": | ||
| statusOpts.Conclusion = "pending" | ||
| } | ||
| // When the pipeline is actually running (in_progress), show it as running | ||
| // not pending. Pending is only for waiting states like /ok-to-test approval. | ||
| if statusOpts.Status == "in_progress" { | ||
| statusOpts.Conclusion = "running" | ||
| } |
There was a problem hiding this comment.
| case "pending": | |
| statusOpts.Conclusion = "pending" | |
| } | |
| // When the pipeline is actually running (in_progress), show it as running | |
| // not pending. Pending is only for waiting states like /ok-to-test approval. | |
| if statusOpts.Status == "in_progress" { | |
| statusOpts.Conclusion = "running" | |
| } | |
| case "pending": | |
| statusOpts.Conclusion = "pending" | |
| // When the pipeline is actually running (in_progress), show it as running | |
| // not pending. Pending is only for waiting states like /ok-to-test approval. | |
| if statusOpts.Status == "in_progress" { | |
| statusOpts.Conclusion = "running" | |
| } | |
| } |
can you please explain what issue it was causing?
There was a problem hiding this comment.
Yes, Previously when a PR was raised and waiting for /ok-to-test approval, the GitLab status was incorrectly showing as "Pipeline running" even though the CI hadn't actually started yet.
With this change, the status now correctly shows as "Pending" when waiting for approval, and only changes to "Running" once the pipeline actually starts executing.
851b1c4 to
3aed5a3
Compare
|
here as well fix go-testing |
3aed5a3 to
fb91622
Compare
7626388 to
de7931c
Compare
|
/lgtm |
There was a problem hiding this comment.
Congrats @ab-ghosh your PR Has been approved 🎉
✅ Pull Request Approved
Approval Status:
- Required Approvals: 1
- Current Approvals: 1
👥 Reviewers Who Approved:
| Reviewer | Permission Level | Approval Status |
|---|---|---|
| @zakisk | admin |
✅ |
📝 Next Steps
- Ensure all required checks pass
- Comply with branch protection rules
- Request a maintainer to merge using the
/mergecommand (or merge it
directly if you have repository permission).
Automated by the PAC Boussole 🧭
Signed-off-by: ab-ghosh <abghosh@redhat.com>
Set parent status to success when /ok-to-test is approved by admin. Signed-off-by: ab-ghosh <abhi.ghosh3108@gmail.com>
de7931c to
65d6c20
Compare

📝 Description of the Change
Fix GitLab commit status handling for two issues:
Incorrect status mapping: When waiting for
/ok-to-testapproval, GitLab was showing "Pipeline running" instead of "Pipeline pending". Thependingconclusion was incorrectly mapped to GitLab'srunningstate.Parent status not updated: The initial "Pipelines as Code CI" status (without pipeline name) created when waiting for
/ok-to-testwas never updated when the actual pipeline started or completed. Only the pipeline-specific status ("Pipelines as Code CI / <name>") was being updated.pkg/provider/gitlab/gitlab.go: Fix status mapping -pending→pending,in_progress→runningpkg/pipelineascode/pipelineascode.go: Update parent status when pipeline startspkg/reconciler/reconciler.go: Update parent status when pipeline transitions to runningpkg/reconciler/status.go: Update parent status when pipeline completes👨🏻 Linked Jira
Jira: https://issues.redhat.com/browse/SRVKP-9459
🔗 Linked GitHub Issue
Fixes #
🚀 Type of Change
fix:)feat:)feat!:,fix!:)docs:)chore:)refactor:)enhance:)deps:)🧪 Testing Strategy
🤖 AI Assistance
If you have used AI assistance, please provide the following details:
Which LLM was used?
Extent of AI Assistance:
Important
If the majority of the code in this PR was generated by an AI, please add a
Co-authored-bytrailer to your commit message.For example:
Co-authored-by: Gemini gemini@google.com
Co-authored-by: ChatGPT noreply@chatgpt.com
Co-authored-by: Claude noreply@anthropic.com
Co-authored-by: Cursor noreply@cursor.com
Co-authored-by: Copilot Copilot@users.noreply.github.com
**💡You can use the script
./hack/add-llm-coauthor.shto automatically addthese co-author trailers to your commits.
✅ Submitter Checklist
fix:,feat:) matches the "Type of Change" I selected above.make testandmake lintlocally to check for and fix anyissues. For an efficient workflow, I have considered installing
pre-commit and running
pre-commit installtoautomate these checks.