Skip to content

Conversation

zakisk
Copy link
Contributor

@zakisk zakisk commented Sep 2, 2025

disabled PipelineRun status comment in GitLab when commit status API call succeed. it is last resort to let know users about PipelineRun status when commit status API fails. Deleted the E2E tests which was required PipelineRun status comment existence.

📝 Description of the Change

🔗 Linked GitHub Issue

Fixes #

👨🏻‍ Linked Jira

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

🚀 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

✅ 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

Copy link

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

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 enhances the GitLab integration by making PipelineRun status comments conditional. Previously, these comments might have been redundant if the commit status API already provided the necessary feedback. The change ensures that comments are only posted as a last resort, improving the signal-to-noise ratio in GitLab merge requests and providing a cleaner user experience.

Highlights

  • GitLab Integration Improvement: PipelineRun status comments in GitLab are now suppressed when the commit status API successfully updates. This makes the comments a fallback mechanism, only appearing if the commit status API fails.
  • Documentation Update: The documentation for repositorycrd.md has been updated to clarify the behavior of comment_strategy for GitLab, explaining that comments are only added if the commit status API fails.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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.

Copy link

@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 enhances the GitLab provider to avoid posting a PipelineRun status comment when the commit status can be updated successfully via the API. This reduces unnecessary notifications on merge requests. The code change in pkg/provider/gitlab/gitlab.go is straightforward and correct. I've suggested a minor clarification in the documentation to make the new behavior easier to understand.

@zakisk zakisk added gitlab enhancement New feature or request labels Sep 3, 2025
@zakisk zakisk force-pushed the SRVKP-8553-disable-gitlab-comment-for-success-status-api-call branch from 5b4f21d to 3554932 Compare September 3, 2025 10:40
@pipelines-as-code pipelines-as-code bot added documentation Improvements or additions to documentation providers labels Sep 3, 2025
@zakisk
Copy link
Contributor Author

zakisk commented Sep 3, 2025

/retest linters

@zakisk zakisk force-pushed the SRVKP-8553-disable-gitlab-comment-for-success-status-api-call branch from 3554932 to 1071af8 Compare September 3, 2025 13:14
@zakisk
Copy link
Contributor Author

zakisk commented Sep 3, 2025

/retest linters

@zakisk zakisk force-pushed the SRVKP-8553-disable-gitlab-comment-for-success-status-api-call branch from 1071af8 to 88d4f5d Compare September 4, 2025 07:53
@zakisk
Copy link
Contributor Author

zakisk commented Sep 4, 2025

/retest linters

@@ -500,122 +482,6 @@ func TestGitlabIssueGitopsComment(t *testing.T) {
twait.Succeeded(ctx, t, runcnx, opts, sopt)
}

func TestGitlabDisableCommentsOnMR(t *testing.T) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test was added to test disable_all comment setting for GitLab but as we're disabling comments for GitLab after commit status API success this test would never pass and at the moment we don't have way to explicitly fail the commits status API from this E2E to test the setting behavior therefore it is been removed here.

@zakisk zakisk changed the title enhanc: Disable PipelineRun status comment in GitLab fix!: Disable PipelineRun status comment in GitLab Sep 4, 2025
@chmouel chmouel self-requested a review September 8, 2025 16:20
@zakisk zakisk force-pushed the SRVKP-8553-disable-gitlab-comment-for-success-status-api-call branch from 88d4f5d to 041b934 Compare September 9, 2025 11:07
@pipelines-as-code pipelines-as-code bot added the e2e label Sep 9, 2025
@zakisk zakisk force-pushed the SRVKP-8553-disable-gitlab-comment-for-success-status-api-call branch from 041b934 to 0171764 Compare September 11, 2025 11:06
@zakisk
Copy link
Contributor Author

zakisk commented Sep 15, 2025

@chmouel can you please take a look?

disabled PipelineRun status comment in GitLab when commit
status API call succeed. it is last resort to let know
users about PipelineRun status when commit status API
fails.

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

Signed-off-by: Zaki Shaikh <zashaikh@redhat.com>
@zakisk zakisk force-pushed the SRVKP-8553-disable-gitlab-comment-for-success-status-api-call branch from 0171764 to 51523cb Compare September 15, 2025 11:03
@pipelines-as-code pipelines-as-code bot added the go Pull requests that update Go code label Sep 15, 2025
@zakisk
Copy link
Contributor Author

zakisk commented Sep 15, 2025

/test linters

@chmouel
Copy link
Member

chmouel commented Sep 15, 2025

Yes I started this morning to test this, since we don't have a e2e for that

@chmouel
Copy link
Member

chmouel commented Sep 16, 2025

This works as intended, but why don't you have a e2e that checks that no comment has been created?

I am worried as well that you break exiting behavior even if it make sense we may break user who relies on that comment or got used to it ? this was supposed to be an option in setting as what @PuneetPunamiya was implementing in 608c97b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation e2e enhancement New feature or request gitlab go Pull requests that update Go code providers
Development

Successfully merging this pull request may close these issues.

2 participants