Skip to content

Detect GitLab CI and GitLab repository paths - #85

Merged
benjaminwood merged 2 commits into
mainfrom
feat/gitlab-ci
Nov 19, 2026
Merged

benjaminwood merged 2 commits into
mainfrom
feat/gitlab-ci

Conversation

@benjaminwood

@benjaminwood benjaminwood commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Companion to selectiveci/selective#464, which adds GitLab as a code host. The runner needs to tell the server which GitLab project a run belongs to.

Changes

  • GitLab CI (GITLAB_CI): sends platform=gitlab_ci and git_provider=gitlab, plus:
    • git_repo_full_name from CI_PROJECT_PATH, including nested groups
    • branch and target branch
    • base_sha: CI_MERGE_REQUEST_DIFF_BASE_SHA on merge request pipelines, CI_COMMIT_BEFORE_SHA on branch pipelines; an all-zero sha counts as no base
    • commit title, plus author name and email parsed from CI_COMMIT_AUTHOR
    • pipeline id as run_id, CI_NODE_INDEX as runner_id
    • head_sha from CI_MERGE_REQUEST_SOURCE_BRANCH_SHA on merged results pipelines, where CI_COMMIT_SHA is GitLab's merge commit (the same fix main made for GitHub pull requests)
  • gitlab.com remotes on other CI platforms (RWX/Mint, Buildkite, CircleCI, Semaphore, local origin) now produce the GitLab path instead of an empty slug. Bitbucket and other unsupported hosts still get no slug.
  • Self-managed GitLab can't be recognized from a URL. GitLab CI identifies itself, so this only matters on other CI platforms, where SELECTIVE_GIT_PROVIDER and SELECTIVE_GIT_REPO still override.

Known limit

GitLab has no run-attempt counter, so run_attempt is 1. Retrying a single failed job reuses its pipeline's run; re-running the pipeline starts a new one.

Release

Merge after selectiveci/selective#464 (merged) is deployed, then release with the gem-release flow.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NF6U1zN1NHcXS5REazSa7N

benjaminwood and others added 2 commits November 13, 2026 07:02
GitLab CI jobs now report git_provider=gitlab, the project's full path
(nested groups included), the merge request's diff base or the push's
previous commit as base_sha, and the commit author. gitlab.com remotes
on RWX, Buildkite, CircleCI and a local origin yield the path too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NF6U1zN1NHcXS5REazSa7N
GitLab reports CI_MERGE_REQUEST_SOURCE_BRANCH_SHA as head_sha, so a
merged results pipeline names the branch's commit rather than its merge
commit, as main now does for GitHub pull requests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LGDurUszQi6JSNKWbT81U1
@benjaminwood
benjaminwood marked this pull request as ready for review November 19, 2026 22:49
@benjaminwood
benjaminwood merged commit 07cbb85 into main Nov 19, 2026
20 checks passed
@benjaminwood
benjaminwood deleted the feat/gitlab-ci branch November 19, 2026 22:49
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