Skip to content

feat(health): GitLab CI + Bitbucket Pipelines sensors (even out git-host support) - #34

Merged
sandstream merged 1 commit into
mainfrom
feat/health-gitlab-bitbucket-sensors
Jun 22, 2026
Merged

sandstream merged 1 commit into
mainfrom
feat/health-gitlab-bitbucket-sensors

Conversation

@sandstream

Copy link
Copy Markdown
Owner

Makes kit health cover all three git hosts. GitHub Actions already had a sensor; this adds GitLab CI + Bitbucket Pipelines, plus the HTTP-probe path the sentinel design said the first HTTP sensor would introduce.

Framework

  • HealthDeps.httpGet(url, headers) + defaultHealthDeps.httpGet (fetch, 15s timeout, network error → not-ok/status-0 → sensor maps to unknown).
  • HealthCtx.gitlabCi / .bitbucketPipelines selection signals; cmdHealth computes them from .gitlab-ci.yml / bitbucket-pipelines.yml presence.

Sensors (REST API, not CLI — stable documented schemas)

  • gitlab-ci — GET /api/v4/projects/:path/pipelines with GITLAB_TOKEN; red when the most recent terminal pipeline failed.
  • bitbucket-pipelines — GET /2.0/repositories/:ws/:repo/pipelines/ with BITBUCKET_TOKEN (or BITBUCKET_USERNAME + BITBUCKET_APP_PASSWORD); red when the latest COMPLETED pipeline result is FAILED/ERROR (STOPPED/cancelled is not red).
  • Both: record the host/path they checked, and report unknown (never a false green) on missing token, non-OK response, or no git remote. Shared parseGitRemote handles SSH + HTTPS (incl. GitLab subgroups).

Also (the level-1 consistency gap)

analyze's CI-file detection now recognizes bitbucket-pipelines.yml (it knew .github/workflows + .gitlab-ci.yml but missed Bitbucket).

Verify

npm run build && npm test → build clean, 1333 tests, 0 fail (~24 new: remote-parse, both sensors' parse/auth/probe, selection).

Honest caveat: the parsers, auth, and remote-parsing are fixture-tested against the documented GitLab/Bitbucket API schemas; the live API wiring isn't smoke-tested here (no real GitLab/Bitbucket project + tokens in this env), unlike the GitHub sensor which was smoke-run against the real repo. First live run on a real project is the remaining check.

🤖 Generated with Claude Code

Adds the httpGet path to HealthDeps (REST-API probes) + two sensors so
kit health covers all three git hosts:
- gitlab-ci: GitLab /pipelines API (GITLAB_TOKEN); red on latest failed
  terminal pipeline.
- bitbucket-pipelines: Bitbucket /pipelines API (BITBUCKET_TOKEN or
  username+app-password); red on latest COMPLETED FAILED/ERROR.
Both record the host/path checked and report unknown (never false green)
on missing token / non-OK response / no remote. Selected by CI-file
presence (.gitlab-ci.yml / bitbucket-pipelines.yml). Shared parseGitRemote
handles SSH+HTTPS. Also: analyze CI-file detection now sees
bitbucket-pipelines.yml (was github + gitlab only). Parsers/auth/remote
fixture-tested vs documented schemas; live API smoke pending a real
GitLab/Bitbucket project.
@github-actions

Copy link
Copy Markdown

✅ Docker image built successfully

  • CLI image: docker.io/sandstream/kit:test

@sandstream
sandstream merged commit af2bcac into main Jun 22, 2026
15 checks passed
@sandstream
sandstream deleted the feat/health-gitlab-bitbucket-sensors branch June 22, 2026 08:39
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.

1 participant