Skip to content

GitLab integration: post comments on linked issues and MRs #7162

@emyller

Description

@emyller

Context: #7000

When a feature flag is linked to a GitLab issue or MR (#7160), Flagsmith should post a comment showing the flag's current state across all environments. When the flag state changes or the flag is deleted, a new comment should be posted automatically.

Scope

Note

PR #7122 contains an async task (post_gitlab_comment) and dispatch function (dispatch_gitlab_comment) that can be used as a starting point. A few things to consider:

  • The PR extracts GitHub's generate_body_comment into a shared integrations/vcs/comments.py module. This refactors integrations/github/github.py. generate_body_comment currently has no tests — they need to be added.
  • Incomplete per author: the hooks that auto-trigger comments are not done. The GitHub integration calls call_github_task from six places across features/models.py, features/serializers.py, features/versioning/serializers.py, and features/feature_external_resources/models.py. The GitLab equivalent of these hooks is new work.

Acceptance criteria

  • Comment posted to GitLab when a flag is linked to an issue or MR
  • Comment posted when the linked flag's state changes in any environment
  • Comment posted when the linked flag is deleted
  • Comment generation logic is tested
  • Emit structlog events for product telemetry (Epic: Open structured event pipeline for the backend #7012)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions