Skip to content

feat: Add optional group-level GitLab issue sync#2801

Merged
steveyegge merged 2 commits intosteveyegge:mainfrom
ktoulgaridis:feat/gitlab-group-sync
Mar 27, 2026
Merged

feat: Add optional group-level GitLab issue sync#2801
steveyegge merged 2 commits intosteveyegge:mainfrom
ktoulgaridis:feat/gitlab-group-sync

Conversation

@ktoulgaridis
Copy link
Copy Markdown
Contributor

@ktoulgaridis ktoulgaridis commented Mar 24, 2026

Summary

Adds optional group-level issue sync and filtering for bd gitlab sync.

Group-level sync

When gitlab.group_id is configured, issues are fetched from all projects in the group instead of a single project.

  • New config keys: gitlab.group_id, gitlab.default_project_id
  • group_id takes precedence over project_id for fetching
  • New issues created in default_project_id (or falls back to project_id)
  • Backward compatible — existing project-level sync unchanged

Filtering

All filters work on both pull and push, are optional and composable.

  • --label <name> / gitlab.filter_labels — filter by labels (AND logic)
  • --project <name> / gitlab.filter_project — filter to specific project within group
  • --milestone <name> / gitlab.filter_milestone — filter by milestone
  • --assignee <username> / gitlab.filter_assignee — filter by assignee
  • Config-based defaults apply automatically, CLI flags override

Use case

Organizations using GitLab groups with multiple repos need to sync only issues relevant to a specific repo or team. For example, syncing only issues labeled "backend" or belonging to a specific project within the group.

Files changed

  • internal/gitlab/client.go — FetchIssues/FetchIssuesSince support group endpoint + filter params
  • internal/gitlab/tracker.go — config loading for group and filter keys
  • internal/gitlab/types.go — GroupID field, filter types
  • cmd/bd/gitlab.go — status shows group config, sync accepts filter flags
  • Full test coverage for all new functionality

Test plan

  • bd gitlab sync with only project_id set (existing behavior unchanged)
  • bd gitlab sync with group_id set (group-level fetch)
  • bd gitlab sync with both set (group_id takes precedence)
  • bd gitlab sync --label backend (label filtering)
  • bd gitlab sync --project myproject (project filtering within group)
  • bd gitlab sync --milestone "Sprint 1" (milestone filtering)
  • bd gitlab sync --assignee username (assignee filtering)
  • Combined filters: --label backend --milestone "Sprint 1"
  • bd gitlab status shows group and filter config when set

When gitlab.group_id is configured, FetchIssues and FetchIssuesSince
use the /groups/:id/issues API endpoint to aggregate issues across all
projects in the group. Issue creation still uses the project endpoint
(via gitlab.project_id or gitlab.default_project_id).

New config keys:
- gitlab.group_id / GITLAB_GROUP_ID
- gitlab.default_project_id / GITLAB_DEFAULT_PROJECT_ID

Backward compatible: existing project-level sync is unchanged when
group_id is not set.
Add optional filters for labels, project, milestone, and assignee to
the GitLab issue sync. Filters work on both project and group endpoints.

Filters can be set via config (gitlab.filter_labels, etc.), environment
variables (GITLAB_FILTER_LABELS, etc.), or CLI flags (--label, --project,
--milestone, --assignee). CLI flags override config defaults.

Labels, milestone, and assignee are passed as GitLab API query params.
Project filtering within a group is done client-side since the GitLab
group issues API doesn't support it natively.
@ktoulgaridis
Copy link
Copy Markdown
Contributor Author

@steveyegge this one unblocks full gitlab projects support

@steveyegge steveyegge merged commit 9dc3264 into steveyegge:main Mar 27, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants