Skip to content

docs(tutorials/gitlab_ci): document Project Access Token (HTTPS) workflow#1963

Open
bearomorphism wants to merge 2 commits intocommitizen-tools:masterfrom
bearomorphism:docs/gitlab-ci-access-token
Open

docs(tutorials/gitlab_ci): document Project Access Token (HTTPS) workflow#1963
bearomorphism wants to merge 2 commits intocommitizen-tools:masterfrom
bearomorphism:docs/gitlab-ci-access-token

Conversation

@bearomorphism
Copy link
Copy Markdown
Collaborator

Description

Closes #482.

The current utorials/gitlab_ci/ page only documents how to bump versions
from a GitLab CI pipeline using SSH keys + a deploy key. The issue requested an
alternative path that does not require SSH (no key generation, no deploy
key) and that demonstrates running specific jobs per release vs. per tag.

This PR keeps the existing SSH walkthrough intact and adds a parallel section
for GitLab Project Access Tokens (HTTPS):

  • Adds an Authentication options summary that points at both the SSH and
    Access Token paths.
  • Renames the existing instructions to Option A: SSH key for clarity.
  • Adds Option B: Project Access Token (HTTPS) covering:
    • creating the token (Settings > Access Tokens, write_repository,
      Developer role),
    • exposing it as a masked CI/CD variable (GITLAB_TOKEN),
    • allowing the token's bot user to push to protected branches/tags,
    • a complete .gitlab-ci.yml example that:
      • tests on every branch / MR but skips the bump commit,
      • runs cz bump only on the default branch using oauth2:@… for HTTPS pushes,
      • has a separate release job that only runs on tag pipelines (so packaging / publishing only happens once per tag, as the issue asked).
  • Adds notes about CI_JOB_TOKEN not being usable for repository writes,
    Group / Personal Access Tokens being valid alternatives, bump_message
    loops, and token rotation.

Checklist

  • Updated documentation only — no code changes.
  • uv run mkdocs build --strict passes locally with no warnings.
  • Pre-commit hooks pass (codespell, blacken-docs, trailing whitespace, EOF, commitizen check).
  • No CHANGELOG / version bumps (auto-managed).

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

…flow

Adds an alternative authentication option for the GitLab CI bump pipeline that does not require SSH keys, using a GitLab Project Access Token over HTTPS. Also shows release/tag-only jobs to avoid running packaging steps on every commit.

Closes commitizen-tools#482

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Add note that Project Access Tokens require Premium/Ultimate on GitLab.com

- Clarify that creating the token requires the Maintainer role; the Developer role mentioned is the bot user's role

- Refine the CI_JOB_TOKEN warning (it can clone, just cannot push)

- Note that write_repository implies read_repository

- Inline the authenticated push URL in before_script instead of a top-level variables block to avoid leaking the token via derived strings

- Add workflow:rules to avoid duplicate branch+MR pipelines

- Document log-masking caveat (CI_DEBUG_TRACE / set -x)

- Document non-standard HTTPS port handling (CI_SERVER_FQDN / CI_SERVER_PORT)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extend docs with GitLab using Access Tokens

1 participant