Skip to content

Commit 5318726

Browse files
authored
Update pipelines authentication docs for gitlab (#2462)
1 parent 7a81e6b commit 5318726

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

Diff for: .mise.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[tools]
22
yarn = "1.22.19"
3-
3+
node = "18.17.1"

Diff for: docs/2.0/docs/pipelines/installation/viamachineusers.md

+18-14
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ Invite `ci-user-read-only` to your `infrastructure-live-root` repository with re
254254
Generate the following token for the `ci-read-only-user`:
255255

256256
**Checklist:**
257-
<PersistentCheckbox id="via-machine-users-4" label="PIPELINES_READ_TOKEN created under ci-read-only-user" />
257+
<PersistentCheckbox id="via-machine-users-5" label="PIPELINES_READ_TOKEN created under ci-read-only-user" />
258258

259259

260260

@@ -271,7 +271,7 @@ This token must have `repo` scopes. Gruntwork recommends setting expiration to 9
271271
Make sure both machine users are added to your team in Gruntwork’s GitHub Organization. Refer to the [instructions for inviting a user to your team](https://docs.gruntwork.io/developer-portal/invite-team#inviting-team-members) and [linking the user’s GitHub ID to Gruntwork](https://docs.gruntwork.io/developer-portal/link-github-id) for guidance.
272272

273273
**Checklist:**
274-
<PersistentCheckbox id="via-machine-users-4" label="Machine users invited to Gruntwork organization" />
274+
<PersistentCheckbox id="via-machine-users-6" label="Machine users invited to Gruntwork organization" />
275275

276276
## Configure secrets for GitHub Actions
277277

@@ -388,7 +388,7 @@ For more information on creating and using GitHub Actions Repository secrets, re
388388
<TabItem value="gitlab" label="GitLab">
389389

390390

391-
For GitLab, Pipelines requires a single machine user with `api` access. This user will be used to authenticate API calls and access repositories within your GitLab group.
391+
For GitLab, Pipelines requires a single machine user with `api` and `read_repository` access. This user will be used to authenticate API calls and access repositories within your GitLab group.
392392

393393
### Creating the CI User
394394

@@ -402,34 +402,38 @@ For GitLab, Pipelines requires a single machine user with `api` access. This use
402402

403403
### Creating the Access Token
404404

405-
Generate a Personal Access Token for the CI user with the following scopes:
406-
- `api` - For making API calls to e.g. create comments on merge requests
405+
Gruntwork recommends [creating](https://docs.gitlab.com/user/profile/personal_access_tokens/#create-a-personal-access-token) two Personal Access Tokens for the CI user as best practice:
406+
- **PIPELINES_GITLAB_TOKEN** token with `api` scope for making API calls to e.g. create comments on merge requests
407+
- **PIPELINES_GITLAB_READ_TOKEN** token with `read_repository` scope for accessing GitLab repositories e.g your catalog or infrastructure modules
407408

408-
This token will be stored as the `PIPELINES_GITLAB_TOKEN` in your CI/CD variables.
409+
You may however generate a single token with both `api` and `read_repository` scopes if you prefer and use it for both purposes.
410+
411+
These tokens will be stored in your CI/CD variables.
409412

410413
:::tip
411414
Set an expiration date according to your organization's security policies. We recommend 90 days as a balance between security and maintenance.
412415
:::
413416

414417
**Checklist:**
415418
<PersistentCheckbox id="via-machine-users-gitlab-3" label="PIPELINES_GITLAB_TOKEN created" />
419+
<PersistentCheckbox id="via-machine-users-gitlab-4" label="PIPELINES_GITLAB_READ_TOKEN created" />
416420

417421
### Configure CI/CD Variables
418422

419-
Add the `PIPELINES_GITLAB_TOKEN` as a CI/CD variable at the group level:
423+
Add the `PIPELINES_GITLAB_TOKEN` and `PIPELINES_GITLAB_READ_TOKEN` as CI/CD variables at the group or project level:
420424

421-
1. Navigate to your GitLab group's **Settings > CI/CD**
422-
2. Expand the **Variables** section
425+
1. Navigate to your GitLab group or project's **Settings > CI/CD**
426+
2. Expand the **Variables** section
423427
3. Click **Add variable**
424-
4. Mark the variable as **Masked**
428+
4. Mark the variables as **Masked**
425429
5. Leave both the "Protect variable" and "Expand variable reference" options unchecked
426430
6. Select the environments where this variable should be available
427-
7. Set the key as `PIPELINES_GITLAB_TOKEN`
431+
7. Set the key to the name of the token e.g. `PIPELINES_GITLAB_TOKEN` or `PIPELINES_GITLAB_READ_TOKEN`
428432
8. Set the value as the Personal Access Token generated in the [Creating the Access Token](#creating-the-access-token) section
429433

430434
**Checklist:**
431-
<PersistentCheckbox id="via-machine-users-gitlab-4" label="PIPELINES_GITLAB_TOKEN added to CI/CD variables" />
432-
435+
<PersistentCheckbox id="via-machine-users-gitlab-5" label="PIPELINES_GITLAB_TOKEN added to CI/CD variables" />
436+
<PersistentCheckbox id="via-machine-users-gitlab-6" label="PIPELINES_GITLAB_READ_TOKEN added to CI/CD variables" />
433437
:::caution
434438
Remember to update this token before it expires to prevent pipeline disruptions.
435439
:::
@@ -443,4 +447,4 @@ In order to use the Gruntwork Pipelines backend, you need to authorize your grou
443447
- The name of your organization
444448

445449
</TabItem>
446-
</Tabs>
450+
</Tabs>

0 commit comments

Comments
 (0)