<GitLabAuth>
The <GitLabAuth> block authenticates to GitLab.
It automatically detects whether the user is already authenticated by checking the GITLAB_TOKEN environment variable or the GitLab CLI (glab auth token, falling back to glab’s config.yml when glab auth token returns nothing — for example when the glab binary is not on PATH). Users can also authenticate manually with a Personal Access Token. Once authenticated, the GITLAB_TOKEN/GITLAB_USER credentials are available to subsequent Command, Check, and GitClone blocks.
GitLab has no OAuth device flow here (there is no registered Gruntwork GitLab app), so authentication is via PAT, the glab CLI, or the GITLAB_TOKEN environment variable.
Basic Usage
Section titled “Basic Usage”<GitLabAuth id="git-auth" title="Authenticate to GitLab" description="Sign in to access private repositories"/>
<Command id="clone-repo" gitAuthId="git-auth" title="Clone Repository" command="git clone https://gitlab.com/gruntwork-io/runbooks.git"/>By default, Runbooks automatically detects and uses credentials from, in order:
- The
GITLAB_TOKENenvironment variable - The GitLab CLI (
glab auth token).glab auth logindoes not export an environment variable — it writes the token to glab’sconfig.yml, which Runbooks also reads directly whenglab auth tokenreturns nothing (for example when theglabbinary is not onPATH).
If no credentials are detected, the user authenticates manually with a Personal Access Token.
<GitLabAuth> accepts the same props as <GitAuth> except provider and hideProviderSelect (which are fixed to gitlab and true). The most common are id (required), title, description, detectCredentials, and inputsId.
Downstream references
Section titled “Downstream references”Reference the block from other blocks with gitAuthId (provider-agnostic). The githubAuthId prop is GitHub-only and cannot reference a GitLab block. See <GitAuth> → Explicit block references.
For full details on detection, scopes, and security, see the <GitAuth> documentation.