Skip to content

Commit 272b0b8

Browse files
committed
Add documentation
1 parent 2a98b5c commit 272b0b8

File tree

3 files changed

+45
-9
lines changed

3 files changed

+45
-9
lines changed

README.md

Lines changed: 45 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This action triggers a pipeline for a specified project and ref at a specified GitLab instance.
44

5-
## Inputs
5+
## Required Secrets
66

77
### `ci-api-v4-url`
88

@@ -24,6 +24,8 @@ Instructions on creating trigger tokens: https://docs.gitlab.com/ee/ci/triggers/
2424

2525
**Required** The ID of the project for which a pipeline shall be started.
2626

27+
## Inputs
28+
2729
### `triggered-ref`
2830

2931
**Required** The ref of the project for which a pipeline shall be started.
@@ -40,16 +42,50 @@ Instructions on creating trigger tokens: https://docs.gitlab.com/ee/ci/triggers/
4042

4143
None.
4244

43-
## Example usage
45+
## Usage
46+
47+
In order to make use of this triggering workflow, there are two steps:
48+
1. Setup deployment environments
49+
2. Call the workflow
50+
51+
### Setting up the deployment environments
52+
In order to correctly use this triggering workflow - one is required to create deployment environments called `External` and `Internal` for their project.
53+
`External` environment corresponds for contributions from 3rd-party companies or developers.
54+
This deployment environment should have protection rules configured to provide a limited list of github users who an approve the workflow run.
55+
56+
`Internal` environment represents contributions from internal members of the organization. Therefore no additional environment protection rules are required.
57+
58+
In order to setup these environments, go to your project `settings`, then `Environments`.
59+
Click on the button called "New environment", and name the first environment `Internal`, later repeat the process, for the environment called `External`.
60+
61+
![Creating Environments](img/creating-environments.png)
62+
63+
64+
Later select the `External` environment, and mark the tick box called `Required reviewers`.
65+
In the list of reviewers - add the usernames of github accounts for who should have workflow approving rights.
66+
It is common to add project-owning team to this list. Then, for good measure, select "prevent self-review".
67+
68+
![Configuring External Environment](img/configuring-external-environment.png)
69+
70+
71+
### Calling the workflow
72+
73+
In order to call this workflow, assuming secrets are stored as github secrets with the capitalized names - specify the following job in your workflow:
4474

4575
```yaml
46-
uses: NordSecurity/trigger-gitlab-pipeline@v2
47-
with:
48-
ci-api-v4-url: 'https://gitlab.com/api/v4/'
49-
access-token: 'glpat-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
50-
trigger-token: 'glptt-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
51-
project-id: '1'
52-
triggered-ref: 'main'
76+
jobs:
77+
trigger-gitlab-pipeline:
78+
uses: NordSecurity/trigger-gitlab-pipeline/.github/workflows/trigger-gitlab-pipeline.yml@<git sha of this repository>
79+
secrets:
80+
ci-api-v4-url: ${{ secrets.CI_API_V4_URL }}
81+
access-token: ${{ secrets.GITLAB_API_TOKEN }}
82+
trigger-token: ${{ secrets.TOKEN }}
83+
project-id: ${{ secrets.PROJECT_ID }}
84+
with:
85+
schedule: ${{ github.event_name == 'schedule' }}
86+
cancel-outdated-pipelines: ${{ github.ref_name != 'main' }}
87+
triggered-ref: <reference in the gitlab project to trigger>
88+
5389
```
5490

5591
# Developement
78.6 KB
Loading

img/creating-environments.png

93.4 KB
Loading

0 commit comments

Comments
 (0)