Skip to content

docs: GitLab CI environment scopes - #261

Draft
nimish-ks wants to merge 6 commits into
mainfrom
feat--gitlab-environment-scopes
Draft

nimish-ks wants to merge 6 commits into
mainfrom
feat--gitlab-environment-scopes

Conversation

@nimish-ks

@nimish-ks nimish-ks commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Overview

Documents GitLab CI environment scopes for GitLab syncs, added in phasehq/console#1044 (closes phasehq/console#1043).

Changes

  • Step 2: Configure Sync describes the new GitLab Environment Scope picker, with a screenshot of the dropdown listing the project's GitLab environments. For groups, which have no environments, the dropdown suggests the scopes already used by the group's variables.
  • New Environment scopes section:
    • How GitLab scopes work, and that each sync only manages the variables in its own scope.
    • An example mapping (Development → review/*, Staging → staging, Production → production), and how to combine a * sync with scoped syncs.
    • A .gitlab-ci.yml example using environment: so jobs receive scoped variables.
    • A note on syncs created before environment scopes:
      • They keep syncing to * and updating variables moved to other scopes.
      • They must be recreated with a scope before adding scoped syncs to the same project or group.
      • Variables moved to other scopes by hand then need a sync for their scope, or deleting, since the new sync won't update them.
      • When a secret has variables in several scopes, such a sync may not be able to tell which one to change: it still syncs new and changed secrets, but deletes no variables and fails with an error naming those secrets, until only one variable is left for each or the sync is recreated with a scope.
    • A note on the one-sync-per-scope rule.
    • A warning that scoped group variables need GitLab Premium or Ultimate, and what Phase does otherwise.
  • Screenshots in public/assets/images/platform-integrations/gitlab/:
    • gitlab-setup-sync.webp: recaptured with the scope picker.
    • gitlab-sync-card.webp: recaptured with a scoped sync.
    • gitlab-setup-sync-environment-scope.webp: new, showing the dropdown.
  • public/integrations/platforms/gitlab-ci.md regenerated with scripts/export-mdx-to-md.js.

The screenshots follow the existing Console screenshot conventions:

  • 2800×1800 (1400×900 @2x), dark theme, lossless WebP.
  • The same mock organisation ("phase", Enterprise), user (Alice), app ("backend") and GitLab project (phase/backend).
  • The same pointing-hand cursor on click steps.

They're captured from a local Console running the console PR against a self-hosted GitLab. The behaviour described was checked against that GitLab instance: scope precedence through pipeline runs, and older syncs (created with the code on main) through the variables API, before and after switching to the console PR.

GitLab syncs can now target a GitLab environment scope. Describe the
new GitLab Environment Scope picker in the sync setup steps, and add an
Environment scopes section covering:

- how each sync manages only the variables in its own scope, with an
  example mapping of Phase Environments to GitLab environments
- using scoped secrets in .gitlab-ci.yml jobs with `environment:`
- syncs created before scopes were available
- the one sync per project or group and scope rule
- the GitLab Premium or Ultimate requirement for scoped group variables

Recapture the Configure sync screenshot with the scope picker and add a
screenshot of the scope dropdown, using the standard mock org and
cursor. The Markdown copy in public/ is regenerated from the MDX.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Deploying phase-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2dd3481
Status: ✅  Deploy successful!
Preview URL: https://d5fd12e1.phase-docs.pages.dev
Branch Preview URL: https://feat--gitlab-environment-sco.phase-docs.pages.dev

View logs

Explain where the scope dropdown's suggestions come from for groups, and
that variables moved to other scopes by hand need their own sync (or
deleting) when an older sync is recreated with a scope.
Older syncs can't tell which variable to change when a secret exists in
several environment scopes. Say what they do then and how to fix it.
@nimish-ks nimish-ks self-assigned this Oct 4, 2026
@nimish-ks
nimish-ks marked this pull request as draft October 4, 2026 10:04
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.

Sync to specific GitLab environments

1 participant