Skip to content

Disable GitLab comments for pipeline start/end events to reduce MR noise #2066

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

PuneetPunamiya
Copy link
Contributor

@PuneetPunamiya PuneetPunamiya commented Apr 24, 2025

  • The GitLab integration was previously generating a comment on every pipeline start and end filling merge requests with redundant updates

  • Hence this patch introduces a new setting to completely disable comment creation

  • By using comment_strategy: disable_all, no comments will be added for either pipeline start or completion

  • Also includes e2e tests to validate the new behavior

Changes

Submitter Checklist

  • 📝 Ensure your commit message is clear and informative. Refer to the How to write a git commit message guide. Include the commit message in the PR body rather than linking to an external site (e.g., Jira ticket).

  • ♽ Run make test lint before submitting a PR to avoid unnecessary CI processing. Consider installing pre-commit and running pre-commit install in the repository root for an efficient workflow.

  • ✨ We use linters to maintain clean and consistent code. Run make lint before submitting a PR. Some linters offer a --fix mode, executable with make fix-linters (ensure markdownlint and golangci-lint are installed).

  • 📖 Document any user-facing features or changes in behavior.

  • 🧪 While 100% coverage isn't required, we encourage unit tests for code changes where possible.

  • 🎁 If feasible, add an end-to-end test. See README for details.

  • If adding a provider feature, fill in the following details:

    • GitHub App
    • GitHub Webhook
    • Gitea/Forgejo
    • GitLab
    • Bitbucket Cloud
    • Bitbucket Data Center

    (update the provider documentation accordingly)

Comment on lines 124 to 132
## Disabling all comments for Pipelinruns on Gitlab MR
`comment_strategy` allows you to disable the comments on Gitlab MR for a Repository

```yaml
spec:
gitlab:
comment_strategy: "disable_all"
```
Copy link
Contributor

Choose a reason for hiding this comment

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

@PuneetPunamiya can you please add details about other options? e.g. on_failure and update_existing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I was thinking to add those options, but didn't add because the support for that as of now was not added
wdyt ?

Copy link
Contributor

Choose a reason for hiding this comment

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

@PuneetPunamiya are you planning to do that in separate PRs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I thought of like when we implement the other strategies we can add accordingly

@PuneetPunamiya PuneetPunamiya force-pushed the fix-too-many-comments-grom-gitlab-integration branch from 8bf3ea5 to ef26110 Compare April 25, 2025 06:19
@osp-pac osp-pac added the e2e label Apr 25, 2025
@PuneetPunamiya PuneetPunamiya force-pushed the fix-too-many-comments-grom-gitlab-integration branch 5 times, most recently from 6c419c2 to f2a7167 Compare April 29, 2025 12:44
@chmouel chmouel requested a review from Copilot April 29, 2025 16:54
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR disables GitLab comments for pipeline start/end events by introducing a new setting (comment_strategy: disable_all) and updating tests and provider logic accordingly. Key changes include:

  • Adding a settings parameter to CRD creation functions and updating relevant tests.
  • Updating the GitLab provider and webhook validation logic to support the new comment strategy.
  • Documenting the new behavior in the repository guide and configuration files.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/pkg/wait/wait.go Added a new UpdateRepo function to reset repository settings.
test/pkg/gitlab/crd.go Updated CreateCRD signature to accept new settings.
test/gitlab_push_gitops_command_test.go Updated CreateCRD calls with an extra settings parameter.
test/gitlab_merge_request_test.go Added tests for disabling MR comments and updated CRD calls.
test/gitlab_incoming_webhook_test.go Updated CRD call with settings parameter.
test/gitlab_delete_tag_event_test.go Updated CRD call with settings parameter.
pkg/webhook/validation.go Added validation logic for allowed GitLab comment strategies.
pkg/reconciler/status_test.go Minor adjustment (blank line) in status test file.
pkg/provider/gitlab/gitlab.go Modified CreateStatus to handle the disable_all comment strategy.
pkg/apis/pipelinesascode/v1alpha1/types.go Introduced GitlabSettings in repository spec.
docs/content/docs/guide/repositorycrd.md Updated documentation on disabling GitLab MR comments.
config/300-repositories.yaml Added GitLab settings schema in repository configuration.

@PuneetPunamiya PuneetPunamiya force-pushed the fix-too-many-comments-grom-gitlab-integration branch from f2a7167 to 3eb58e9 Compare April 30, 2025 06:10
@zakisk
Copy link
Contributor

zakisk commented May 2, 2025

/test linters

@zakisk
Copy link
Contributor

zakisk commented May 2, 2025

/test doc-generation

The GitLab integration was previously generating a comment on every
pipeline start and end filling merge requests with redundant updates

Hence this patch introduces a new setting to completely disable
comment creation

By using `comment_strategy: disable_all`, no comments will be added
for either pipeline start or completion

Also includes e2e tests to validate the new behavior

Signed-off-by: PuneetPunamiya <[email protected]>
@PuneetPunamiya PuneetPunamiya force-pushed the fix-too-many-comments-grom-gitlab-integration branch from edbd538 to bff67b8 Compare May 2, 2025 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

4 participants