Skip to content

fix(github): use correct name for failed checkruns on retest#2455

Merged
chmouel merged 1 commit intotektoncd:mainfrom
zakisk:SRVKP-10741-fix-checkrun-deletion-after-retest
Feb 10, 2026
Merged

fix(github): use correct name for failed checkruns on retest#2455
chmouel merged 1 commit intotektoncd:mainfrom
zakisk:SRVKP-10741-fix-checkrun-deletion-after-retest

Conversation

@zakisk
Copy link
Copy Markdown
Member

@zakisk zakisk commented Feb 5, 2026

after /retest or /test command failed check run was being wiped out because we didn't used correct pipelinerun name before when reporting failure in startPR func. now this uses the generateName if name is not available for a pipelinerun.

this also adds an e2e tests to ensure that checkrun for tekton validation failed pipelinerun is not wiped out.

https://issues.redhat.com/browse/SRVKP-10741

📝 Description of the Change

👨🏻‍ Linked Jira

🔗 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 @zakisk, 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 a critical bug that caused GitHub check runs for failed Tekton PipelineRuns to be incorrectly cleared after retest commands. The core problem stemmed from an inability to consistently identify PipelineRuns by their name during status updates. The fix ensures that the system correctly references PipelineRuns by utilizing their generated names when an explicit name is absent. This enhancement significantly improves the reliability of CI/CD status reporting and is validated by a newly introduced end-to-end test, preventing future regressions.

Highlights

  • Bug Fix: Check Run Wiping: Resolved an issue where failed check runs were inadvertently removed after /retest or /test commands. This occurred because the system failed to use the correct PipelineRun name when reporting failures in the startPR function.
  • PipelineRun Name Resolution: Implemented logic to use the generateName of a PipelineRun if its explicit name is not available, ensuring accurate status reporting for all PipelineRuns, especially those with generated names.
  • New End-to-End Test: Added a new end-to-end test to specifically verify that check runs for Tekton validation failed PipelineRuns are correctly preserved and not wiped out after a retest operation.
Changelog
  • pkg/pipelineascode/pipelineascode.go
    • Modified the CreateStatus function to correctly determine the PipelineRunName for status updates.
    • Introduced a conditional check to use match.PipelineRun.GetGenerateName() if match.PipelineRun.GetName() returns an empty string, ensuring a valid PipelineRun identifier is always used.
  • test/github_pullrequest_retest_test.go
    • Removed the //go:build e2e build tag from the file.
    • Added the strings package import.
    • Introduced a new end-to-end test, TestGithubRetestWithMultipleFailedPipelineRuns, to confirm that failed check runs, particularly those resulting from Tekton validation issues, persist after a /retest command.
  • test/testdata/pipelinerun-tekton-validation.yaml
    • Added a new test data YAML file defining a PipelineRun with a deliberately malformed pipelineSpec (using stepsos instead of steps) to simulate a Tekton validation failure for testing purposes.
Activity
  • The pull request was authored by zakisk.
  • The PR is categorized as a bug fix (fix:).
  • It is linked to Jira ticket SRVKP-10741.
  • The changes include a new end-to-end test to validate the fix.
  • The author confirmed that no AI assistance was used in this PR.
  • The submitter checklist indicates that commit messages are clear, the commit message prefix matches the change type, local tests and linting were run, and end-to-end tests were added.
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 Feb 5, 2026

🔍 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:

  • 39a6b5b fix(github): use correct name for failed checkruns on retest

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 addresses an issue where failed check runs were being cleared on /retest commands. The fix in pkg/pipelineascode/pipelineascode.go correctly uses GetGenerateName as a fallback, which is a solid approach for handling pipeline run creation failures. The addition of an end-to-end test is a great way to prevent regressions. I've added a couple of suggestions to improve the new test file.

@@ -1,11 +1,10 @@
//go:build e2e
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The //go:build e2e tag has been removed. This tag is important for separating end-to-end tests from unit tests. Without it, these potentially long-running tests will be executed with the standard test suite, which may be unintended. The new test TestGithubRetestWithMultipleFailedPipelineRuns doesn't have a conditional skip, so it will run every time. If these are e2e tests, please consider restoring the build tag to avoid slowing down the CI process for regular unit tests.

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.

@zakisk did anything changed?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Ask

@zakisk did anything changed?

Answer:

Yes—something did change in this PR: the //go:build e2e build tag at the top of test/github_pullrequest_retest_test.go was removed.

Impact:

  • That file now compiles/runs as part of the default go test ./... suite, instead of only running when built with -tags=e2e.
  • The newly added test TestGithubRetestWithMultipleFailedPipelineRuns will also run unconditionally, which can slow down regular CI/unit test runs and may require e2e infra to be available.

Recommendation:

  • If these are intended to remain e2e-only tests (they look like they are, since they interact with GitHub checks and Tekton PipelineRuns), re-add //go:build e2e (and optionally the legacy // +build e2e) to this file, or move e2e tests into files that retain the tag.
  • If the removal was intentional, it would be good to clarify why and ensure CI is prepared to run these in the default test stage.

Comment on lines +196 to +203
containsFailedPLRName := false
for _, checkRun := range res.CheckRuns {
// check if the check run is for the validation failed pipelinerun
if strings.Contains(checkRun.GetExternalID(), "pipelinerun-tekton-validation") {
containsFailedPLRName = true
}
}
assert.Equal(t, containsFailedPLRName, true)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This loop can be made more efficient by exiting as soon as a match is found. Adding a break statement will improve performance, especially if the list of check runs grows. Additionally, assert.Assert(t, ...) is more idiomatic for boolean checks in gotest.tools/v3/assert and allows for a more descriptive failure message.

        containsFailedPLRName := false
        for _, checkRun := range res.CheckRuns {
                // check if the check run is for the validation failed pipelinerun
                if strings.Contains(checkRun.GetExternalID(), "pipelinerun-tekton-validation") {
                        containsFailedPLRName = true
                        break
                }
        }
        assert.Assert(t, containsFailedPLRName, "expected to find a check run for 'pipelinerun-tekton-validation'")

Copy link
Copy Markdown
Member Author

@zakisk zakisk Feb 9, 2026

Choose a reason for hiding this comment

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

yeah, I removed for ctrl+click to work but forgot to add again, 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.

control+click 🤔

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.

code exploration in code editor

@zakisk zakisk force-pushed the SRVKP-10741-fix-checkrun-deletion-after-retest branch from 218a446 to 3099527 Compare February 6, 2026 07:09
after /retest or /test command failed check run was
being wiped out because we didn't used correct
pipelinerun name before when reporting failure in
startPR func. now this uses the generateName if name
is not available for a pipelinerun.

this also adds an e2e tests to ensure that checkrun
for tekton validation failed pipelinerun is not wiped
out.

https://issues.redhat.com/browse/SRVKP-10741

Signed-off-by: Zaki Shaikh <zashaikh@redhat.com>
@zakisk zakisk force-pushed the SRVKP-10741-fix-checkrun-deletion-after-retest branch from 3099527 to 39a6b5b Compare February 9, 2026 06:17
@chmouel chmouel merged commit 906f1db into tektoncd:main Feb 10, 2026
21 of 23 checks passed
@zakisk zakisk deleted the SRVKP-10741-fix-checkrun-deletion-after-retest branch February 10, 2026 13:09
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.

2 participants