Skip to content
Docs

Token and permissions

launchset needs a token that can write to your project. You create it once per project (or per group), in the browser. An agent can’t do this for you: it needs a Maintainer or Owner.

On GitLab the CI job token (CI_JOB_TOKEN) is not enough. Two things in launchset break because of it:

  • Pushes made with CI_JOB_TOKEN never start pipelines. The release branch is pushed by launchset. If it used the job token, the release MR would get no pipeline, and a required pipeline would block the merge forever. The same holds for tags.
  • CI_JOB_TOKEN can mostly read. It can read merge requests and notes and use the Releases API. It can’t post notes, create or update MRs, or list pipeline jobs. (Since GitLab 18.4 a project may let it push, when “Allow Git push requests to the repository” is on, but those pushes still start no pipelines.)

A project or group access token has no such limit. launchset reads it from the CI/CD variable LAUNCHSET_TOKEN. When that variable is missing, launchset falls back to CI_JOB_TOKEN for reads only, and writes fail with an error that names the variable. It also accepts GITLAB_TOKEN.

  1. Go to the project’s Settings → Access tokens and click Add new token. For several projects, use the group’s Settings → Access tokens instead.
  2. Token name: launchset.
  3. Expiration: pick one. Tokens expire (GitLab requires a date), so note when to rotate.
  4. Role: Maintainer. See below.
  5. Scopes: tick exactly these two.
Scope Why launchset needs it
api Open, update and close the release MR; post the sticky check and preview notes; create and update releases; read merge requests, commits and pipeline jobs; start MR pipelines (the optional preview sweep).
write_repository Push the release branch, marker, release, partial and prerelease tags with git.
  1. Click Create project access token and copy the value. GitLab shows it once.

The token creates a bot user (project_<id>_bot_…) that appears as a project member with the role you chose. Everything launchset does is done as that user: the release MR, the sticky notes and the release commit author.

In Settings → CI/CD → Variables, add a variable:

Setting Value
Key LAUNCHSET_TOKEN
Value the token
Visibility Masked
Flags: Protect variable off

A fork MR’s pipeline runs in the fork, without your project’s variables, so launchset-check couldn’t post its note there. It therefore skips those pipelines. To check a fork MR, run its pipeline in your project (Run pipeline on the MR’s Pipelines tab), which has your variables. Forks get no previews.

Developer is enough for the API, including starting MR pipelines for the optional preview sweep (the api scope covers it). The reason for Maintainer is git: by default, only Maintainers may push to protected branches and create protected tags, and launchset pushes the base branch’s release branch, marker tags, release tags, partial tags and prerelease tags. See Protected branches and tags.

Every launchset job installs the CLI with npm: npm install --global "$LAUNCHSET_CLI", where LAUNCHSET_CLI is launchset@<version>, the version that wrote the files. The package is public on npm, so no token is needed. The install is skipped when the runner already has that exact version (or, when LAUNCHSET_CLI names no exact version such as launchset@latest, any launchset on the PATH), so a runner that keeps npm’s global folder between jobs still gets the version you pinned. If the install fails but the runner has another version of launchset (npm’s global folder belongs to an admin, for example), the job prints a warning and uses that version. To use a build from another source (a tarball, a Git URL, a registry mirror), set the CI/CD variable LAUNCHSET_CLI to that spec.

Files written before 1.2 install @demonsters/launchset, the package’s old name, and log in with an NPM_TOKEN variable first. They keep working. To move to launchset, change LAUNCHSET_CLI in the .launchset-cli job of .gitlab/launchset.yml to launchset@<version>; NPM_TOKEN is then no longer needed.

GitLab protects the default branch by default, and you may protect tags like v*. launchset pushes:

  • launchset/release/<branch>: the release branch, force-pushed on every run.
  • marker tags (launchset/<target>@<version>), partial tags (launchset/partial/<version>), the release tag (v1.4.1) and prerelease tags.

Check these:

  • Protected branches (Settings → Repository): the base branch and maintenance branches (release/*) are normally push-protected. launchset doesn’t push to them: it pushes launchset/release/* and opens an MR. Don’t protect launchset/release/* against force pushes. If you protect launchset/* branches, add the token’s bot (or Maintainers) to Allowed to push and merge and Allowed to force push.
  • Protected tags: if v*, launchset/* or prerelease tags are protected, add the token’s bot (or the Maintainers role) to Allowed to create. With GitLab’s default (Maintainers can create), the Maintainer role is enough.
  • Push rules (Premium): launchset commits as the token’s user. If your push rules restrict author email or commit message, allow that user.

A rejected push prints which of these applies. See Troubleshooting.

Shipping a manual target, building a preview of any branch and retrying a release with options use pipeline variables (Build → Pipelines → Run pipeline). GitLab may block these. In Settings → CI/CD → Variables, Minimum role to use pipeline variables decides who can set them. The default is Maintainer on self-managed. New projects on GitLab.com default to no_one_allowed, which blocks those runs until you change it. A plain Run pipeline without variables works regardless: it retries an unfinished release.

launchset commits (the release commit on the release branch) as the token’s own user, looked up with GET /user. The name is the bot’s name and the email is the user’s email when GitLab shows one, else <username>@noreply.<your host>. If the lookup fails it uses launchset <launchset@noreply.<your host>>. This is on purpose: push rules that check the author accept the token’s user. Don’t hand-edit the release MR.

Create a new token, update the LAUNCHSET_TOKEN variable, then revoke the old one (Settings → Access tokens). Group access tokens work the same way and can serve several projects: the bot must then be a member of each project with Maintainer.

When you run GitLab-facing commands locally (launchset mark, launchset hotfix), pass the token with --token, or set LAUNCHSET_TOKEN or GITLAB_TOKEN. Pass --repo group/project or let launchset read the origin remote. A personal access token with the api and write_repository scopes works too.

If you’re logged in with glab, its token works as well, also when it is an OAuth token from glab’s web login, so you don’t need a token of your own:

Terminal window
LAUNCHSET_TOKEN=$(glab config get token --host gitlab.com) npx launchset mark --target ios --version 1.4.0 --build-number 217175105
  • --host is needed: glab keeps its token per host, and glab config get token without it prints nothing. Use your server’s host name on a self-managed GitLab.
  • Set LAUNCHSET_TOKEN for the command, as above, not GITLAB_TOKEN: an exported LAUNCHSET_TOKEN (an expired one, say) wins over GITLAB_TOKEN.

Use glab’s token for commands you run by hand, not as LAUNCHSET_TOKEN in CI. launchset sends every token except CI_JOB_TOKEN as Authorization: Bearer, which GitLab accepts for OAuth tokens and access tokens alike. launchset 1.4.0 and older sent them as PRIVATE-TOKEN, which GitLab rejects for OAuth tokens with a 401.

mark --version reads the release before it pushes the marker, so a missing or rejected token stops it before anything changes. A token that may read the release but not change it gets past that check: the marker is pushed, and then the update fails with an error that says so. Run the same mark command again with a working token: it finds the marker and only updates the release.