Skip to content

fix: correctly update pending and running commit status#2341

Merged
zakisk merged 2 commits intotektoncd:mainfrom
ab-ghosh:fix-gitlab-pending-status-mapping
Jan 20, 2026
Merged

fix: correctly update pending and running commit status#2341
zakisk merged 2 commits intotektoncd:mainfrom
ab-ghosh:fix-gitlab-pending-status-mapping

Conversation

@ab-ghosh
Copy link
Copy Markdown
Member

📝 Description of the Change

Fix GitLab commit status handling for two issues:

  1. Incorrect status mapping: When waiting for /ok-to-test approval, GitLab was showing "Pipeline running" instead of "Pipeline pending". The pending conclusion was incorrectly mapped to GitLab's running state.

  2. Parent status not updated: The initial "Pipelines as Code CI" status (without pipeline name) created when waiting for /ok-to-test was 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 - pendingpending, in_progressrunning
  • pkg/pipelineascode/pipelineascode.go: Update parent status when pipeline starts
  • pkg/reconciler/reconciler.go: Update parent status when pipeline transitions to running
  • pkg/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

  • 🐛 Bug fix (fix:)
  • ✨ New feature (feat:)
  • 💥 Breaking change (feat!:, fix!:)
  • 📚 Documentation update (docs:)
  • ⚙️ Chore (chore:)
  • 💅 Refactor (refactor:)
  • 🔧 Enhancement (enhance:)
  • 📦 Dependency update (deps:)

🧪 Testing Strategy

  • Unit tests
  • Integration tests
  • End-to-end tests
  • Manual testing
  • Not Applicable

🤖 AI Assistance

  • I have not used any AI assistance for this PR.
  • I have used AI assistance for this PR.

If you have used AI assistance, please provide the following details:

Which LLM was used?

  • GitHub Copilot
  • ChatGPT (OpenAI)
  • Claude (Anthropic)
  • Cursor
  • Gemini (Google)
  • Other: ____________

Extent of AI Assistance:

  • Documentation and research only
  • Unit tests or E2E tests only
  • Code generation (parts of the code)
  • Full code generation (most of the PR)
  • PR description and comments
  • Commit message(s)

Important

If the majority of the code in this PR was generated by an AI, please add a Co-authored-by trailer 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.sh to automatically add
these co-author trailers to your commits.

✅ Submitter Checklist

  • 📝 My commit messages are clear, informative, and follow the project's How to write a git commit message guide. The Gitlint linter ensures in CI it's properly validated
  • ✨ I have ensured my commit message prefix (e.g., fix:, feat:) matches the "Type of Change" I selected above.
  • ♽ I have run make test and make lint locally to check for and fix any
    issues. For an efficient workflow, I have considered installing
    pre-commit and running pre-commit install to
    automate these checks.
  • 📖 I have added or updated documentation for any user-facing changes.
  • 🧪 I have added sufficient unit tests for my code changes.
  • 🎁 I have added end-to-end tests where feasible. See README for more details.
  • 🔎 I have addressed any CI test flakiness or provided a clear reason to bypass it.
  • If adding a provider feature, I have filled in the following and updated the provider documentation:
    • GitHub App
    • GitHub Webhook
    • Gitea/Forgejo
    • GitLab
    • Bitbucket Cloud
    • Bitbucket Data Center

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @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

  • GitLab Status Mapping Correction: The mapping for GitLab commit statuses has been corrected. Previously, a 'pending' conclusion was incorrectly displayed as 'Pipeline running'. Now, 'pending' states (like waiting for /ok-to-test) will correctly show as 'pending', and 'in_progress' states will show as 'running'.
  • Parent Status Updates: The initial 'Pipelines as Code CI' status, which is set without a specific pipeline name when waiting for /ok-to-test approval, will now be correctly updated throughout the pipeline's lifecycle. This includes updates when the pipeline starts, transitions to an in-progress state, and when it finally completes, ensuring a consistent and accurate overall status.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@pipelines-as-code
Copy link
Copy Markdown

pipelines-as-code bot commented Nov 28, 2025

🔍 PR Lint Feedback

Note: This automated check helps ensure your PR follows our contribution guidelines.

⚠️ Items that need attention:

🤖 AI attribution

The following commits lack an explicit AI attribution footer:

  • f6e996b fix: correctly update pending and running commit status
  • 65d6c20 fix(gitlab): set parent status to success when CI is triggered

If no AI assistance was used for a commit, you can ignore this warning.
Otherwise add an Assisted-by: or Co-authored-by: footer referencing the AI used.


ℹ️ Next Steps

  • Review and address the items above
  • Push new commits to update this PR
  • This comment will be automatically updated when issues are resolved
🔧 Admin Tools (click to expand)

Automated Issue/Ticket Creation:

  • /issue-create - Generate a GitHub issue from this PR content using AI
  • /jira-create - Create a SRVKP Jira ticket from this PR content using AI

⚠️ Important: Always review and edit generated content before finalizing tickets/issues.
The AI-generated content should be used as a starting point and may need adjustments.

These commands are available to maintainers and will post the generated content as PR comments for review.

🤖 This feedback was generated automatically by the PR CI system

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread pkg/pipelineascode/pipelineascode.go Outdated
Comment thread pkg/reconciler/reconciler.go Outdated
Comment thread pkg/reconciler/status.go Outdated
@ab-ghosh ab-ghosh force-pushed the fix-gitlab-pending-status-mapping branch from 8f10b7c to 6843d69 Compare November 28, 2025 20:13
Comment thread pkg/reconciler/status.go Outdated
Comment on lines +182 to +183
// 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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ab-ghosh what do you mean by parent status?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was referring to the “Pipelines as Code CI” commit status that appears without the specific PipelineRun name.

image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread pkg/pipelineascode/pipelineascode.go Outdated
Comment on lines +306 to +310
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)
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to use the helper function (updateParentStatus) here?

Copy link
Copy Markdown
Member Author

@ab-ghosh ab-ghosh Jan 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@ab-ghosh ab-ghosh force-pushed the fix-gitlab-pending-status-mapping branch 2 times, most recently from 976e599 to faccbb1 Compare January 12, 2026 17:53
@zakisk zakisk force-pushed the fix-gitlab-pending-status-mapping branch from faccbb1 to 54c4fcd Compare January 13, 2026 05:53
Comment on lines 302 to 309
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"
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@zakisk zakisk force-pushed the fix-gitlab-pending-status-mapping branch 3 times, most recently from 851b1c4 to 3aed5a3 Compare January 16, 2026 05:48
@zakisk
Copy link
Copy Markdown
Member

zakisk commented Jan 16, 2026

here as well fix go-testing

@ab-ghosh ab-ghosh force-pushed the fix-gitlab-pending-status-mapping branch from 3aed5a3 to fb91622 Compare January 16, 2026 06:54
@zakisk zakisk force-pushed the fix-gitlab-pending-status-mapping branch 2 times, most recently from 7626388 to de7931c Compare January 19, 2026 10:59
@zakisk
Copy link
Copy Markdown
Member

zakisk commented Jan 20, 2026

/lgtm

Copy link
Copy Markdown

@pipelines-as-code pipelines-as-code bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 /merge command (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>
@zakisk zakisk force-pushed the fix-gitlab-pending-status-mapping branch from de7931c to 65d6c20 Compare January 20, 2026 06:36
@zakisk zakisk merged commit 7ca0bd9 into tektoncd:main Jan 20, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants