Skip to content

Add GitLab config, trigger type variants, and module scaffolding #1180

@geoffjay

Description

@geoffjay

Summary

Create the GitLab module scaffolding in the orchestrator scheduler: configuration/auth resolution (following the LinearConfig pattern), the GitlabIssues and GitlabMergeRequests variants in TriggerConfig and SourceTemplate, factory wiring in create_source(), and template variable registration. This is the foundation for the GitLab trigger implementation.

Context

The orchestrator scheduler has a clean plugin architecture: TriggerConfig enum (serde-tagged) selects the variant, create_source() factory instantiates the TaskSource, and PollingStrategy drives the poll loop. Adding GitLab requires touching each layer to register the new types, but the actual API calls come in follow-up issues.

The Linear integration (linear.rs) is the closest pattern to follow: direct HTTP API with env var + config file auth resolution.

Acceptance Criteria

  • New file crates/orchestrator/src/scheduler/gitlab.rs with:
    • GitlabConfig struct with resolve() and is_configured() methods
    • Auth resolution: AGENTD_GITLAB_TOKEN env var, then [gitlab] token in config file
    • Base URL: AGENTD_GITLAB_URL env var (default https://gitlab.com)
    • Debug impl that redacts the token (like LinearConfig)
    • Stub GitlabIssueSource and GitlabMergeRequestSource structs (impl TaskSource with placeholder fetch_tasks)
  • Register pub mod gitlab; in crates/orchestrator/src/scheduler/mod.rs
  • Add to TriggerConfig enum in crates/orchestrator/src/scheduler/types.rs:
    GitlabIssues {
        owner: String,
        repo: String,
        #[serde(default)]
        labels: Vec<String>,
        #[serde(default = "default_gitlab_issue_state")]
        state: String,
        #[serde(default)]
        assignee: Option<String>,
    },
    GitlabMergeRequests {
        owner: String,
        repo: String,
        #[serde(default)]
        labels: Vec<String>,
        #[serde(default = "default_gitlab_mr_state")]
        state: String,
        #[serde(default)]
        assignees: Option<Vec<String>>,
    },
  • Add trigger_type() cases returning "gitlab_issues" and "gitlab_merge_requests"
  • Add is_implemented() cases returning true
  • Add GitlabIssues and GitlabMergeRequests cases to create_source() in crates/orchestrator/src/scheduler/runner.rs
  • Add GitlabIssues and GitlabMergeRequests variants to SourceTemplate in crates/cli/src/commands/apply.rs with conversion to TriggerConfig
  • Add GitLab-specific template variables to KNOWN_VARIABLES in crates/orchestrator/src/scheduler/template.rs:
    • gitlab_project_id, gitlab_iid (internal issue/MR number), source_branch, target_branch, merge_status

Configuration Design

# ~/.config/agentd/config.toml
[gitlab]
token = "glpat-xxxxxxxxxxxxxxxxxxxx"
url = "https://gitlab.example.com"  # optional, defaults to https://gitlab.com

Environment variables:

  • AGENTD_GITLAB_TOKEN - GitLab personal access token or project token
  • AGENTD_GITLAB_URL - Base URL for self-hosted instances

Key Files

  • crates/orchestrator/src/scheduler/gitlab.rs (NEW)
  • crates/orchestrator/src/scheduler/mod.rs
  • crates/orchestrator/src/scheduler/types.rs
  • crates/orchestrator/src/scheduler/runner.rs
  • crates/orchestrator/src/scheduler/template.rs
  • crates/cli/src/commands/apply.rs

Stack Base

Stack on: feature/autonomous-pipeline
Parallel: no ordering constraint (foundation issue)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions