Skip to content

Commit faee514

Browse files
committed
docs(README): add detailed configuration file
1 parent 438fae9 commit faee514

File tree

2 files changed

+127
-81
lines changed

2 files changed

+127
-81
lines changed

README.md

Lines changed: 81 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ Any new Gitlab repository you create will be offered a Sentry project if you acc
88

99
## Two-Steps process
1010

11-
1. After creating your new project on Gitlab, ```gitlab2sentry``` will create a first Merge Request asking if you want it to create an associated Sentry project for it. This Merge Request will contain the creation of a ```.sentryclirc``` file which, if you merge it, will be contributed back the newly created Sentry project ```DSN``` for this project.
11+
1. After creating your new project on Gitlab, `gitlab2sentry` will create a first Merge Request asking if you want it to create an associated Sentry project for it. This Merge Request will contain the creation of a `.sentryclirc` file which, if you merge it, will be contributed back the newly created Sentry project `DSN` for this project.
1212

13-
2. If you merged the first Merge Request, ```gitlab2sentry``` will create a second one to update the newly created ```.sentryclirc``` file with the ```DSN``` of the sentry project. Moreover, after the merge of the first Merge Request ```gitlabsentry``` will create a new ```sentry project```, update its rate limit and save the ```DSN``` inside ```.sentryclirc```. Once you have merged this second Merge Request everything will be set up!
14-
15-
**NOTE**: ```Gitlab2Sentry``` looks only for group projects and searches for MRs having specific keyword inside (check "Configuration" section)
13+
2. If you merged the first Merge Request, `gitlab2sentry` will create a second one to update the newly created `.sentryclirc` file with the `DSN` of the sentry project. Moreover, after the merge of the first Merge Request `gitlabsentry` will create a new `sentry project`, update its rate limit and save the `DSN` inside `.sentryclirc`. Once you have merged this second Merge Request everything will be set up!
1614

15+
**NOTE**: `Gitlab2Sentry` looks only for group projects and searches for MRs having specific keyword inside (check "Configuration" section)
1716

1817
## Run locally
1918

@@ -38,7 +37,7 @@ python3 run.py
3837
3938
## Deployment
4039
41-
We prefer to deploy and manage ```gitlab2sentry``` with ```helm```. Inside ```helm/``` folder you can find an example deployment.
40+
We prefer to deploy and manage `gitlab2sentry` with `helm`. Inside `helm/` folder you can find an example deployment.
4241
4342
You can upgrade your deployment with:
4443
@@ -48,92 +47,94 @@ make upgrade
4847
4948
## Configuration
5049
51-
```Gitlab2Sentry``` requires some configuration in 3 specific files.
50+
`Gitlab2Sentry` requires some configuration in 3 specific files.
51+
52+
**[All configuration variables here](./docs/configuration.md)**
5253
53-
1. First of all you have to configure the ```helm/values-production.yaml``` file where everything is configured for the ```gitlab2sentry``` service. Here you can find a description for every field:
54+
1. First of all you have to configure the `helm/values-production.yaml` file where everything is configured for the `gitlab2sentry` service. Here you can find a description for every field:
5455
5556
```yaml
56-
# Sentry values
57-
- name: SENTRY_TOKEN
58-
valueFrom:
59-
secretKeyRef:
60-
key: SENTRY_TOKEN
61-
name: gitlab2sentry-production
62-
- name: SENTRY_DSN
63-
value: your-sentry-dsn
64-
- name: SENTRY_URL
65-
value: your-sentry-url
66-
- name: SENTRY_ORG_SLUG
67-
value: your-sentry-organization-slug
68-
# Gitlab values
69-
- name: GITLAB_TOKEN
70-
valueFrom:
71-
secretKeyRef:
72-
key: GITLAB_TOKEN
73-
name: your-secret
74-
- name: GITLAB_URL
75-
value: your-gitlab-url
76-
# DSN MR (1) values
77-
- name: GITLAB_DSN_MR_CONTENT
78-
value: the content of your dsn mr
79-
- name: GITLAB_DSN_MR_DESCRIPTION
80-
value: the description of your dsn mr
81-
- name: GITLAB_DSN_MR_BRANCH_NAME
82-
value: your-branch-name
83-
- name: GITLAB_DSN_MR_TITLE
84-
value: "your-dsn-mr-title"
85-
# Sentryclirc MR (2) values
86-
- name: GITLAB_SENTRYCLIRC_MR_CONTENT
87-
value: your-sentryclirc-mr-content
88-
- name: GITLAB_SENTRYCLIRC_MR_DESCRIPTION
89-
value: your-sentryclirc-mr-description
90-
- name: GITLAB_SENTRYCLIRC_MR_BRANCH_NAME
91-
value: your-sentryclirc-mr-branch-name
92-
- name: GITLAB_SENTRYCLIRC_MR_FILEPATH
93-
value: .sentryclirc
94-
- name: GITLAB_SENTRYCLIRC_MR_COMMIT_MSG
95-
value: your-commit-msg
96-
- name: GITLAB_SENTRYCLIRC_MR_TITLE
97-
value: "your sentryclirc mr title"
98-
# Gitlab configuration values
99-
- name: GITLAB_AUTHOR_NAME
100-
value: author-name
101-
- name: GITLAB_AUTHOR_EMAIL
102-
value: your-author-email
103-
- name: GITLAB_GRAPHQL_SUFFIX
104-
value: api/graphql
105-
# - name: GITLAB_MENTIONS
106-
# value:
107-
# - "@all"
108-
- name: GITLAB_MENTIONS_ACCESS_LEVEL
109-
value: 40 # maintainer
110-
- name: GITLAB_CREATION_DAYS_LIMIT
111-
value: 60 # Max days old per project
112-
- name: GITLAB_MR_KEYWORD
113-
value: sentry # key word for searching mrs
114-
- name: GITLAB_REMOVE_SOURCE
115-
value: true # If the mr will remove the source branch
116-
- name: GITLAB_GROUP_IDENTIFIER
117-
value: your-group-identifier # will look only for group projects having this identifier
118-
- name: GITLAB_AIOHTTP_TIMEOUT
119-
value: 60
120-
- name: GITLAB_GRAPHQL_PAGE_LENGTH
121-
value: 100
122-
- name: GITLAB_MR_LABEL_LIST
123-
value: "sentry,your-label" # comma separated list of labels for the mr
57+
# Sentry values
58+
- name: SENTRY_TOKEN
59+
valueFrom:
60+
secretKeyRef:
61+
key: SENTRY_TOKEN
62+
name: gitlab2sentry-production
63+
- name: SENTRY_DSN
64+
value: your-sentry-dsn
65+
- name: SENTRY_URL
66+
value: your-sentry-url
67+
- name: SENTRY_ORG_SLUG
68+
value: your-sentry-organization-slug
69+
# Gitlab values
70+
- name: GITLAB_TOKEN
71+
valueFrom:
72+
secretKeyRef:
73+
key: GITLAB_TOKEN
74+
name: your-secret
75+
- name: GITLAB_URL
76+
value: your-gitlab-url
77+
# DSN MR (1) values
78+
- name: GITLAB_DSN_MR_CONTENT
79+
value: the content of your dsn mr
80+
- name: GITLAB_DSN_MR_DESCRIPTION
81+
value: the description of your dsn mr
82+
- name: GITLAB_DSN_MR_BRANCH_NAME
83+
value: your-branch-name
84+
- name: GITLAB_DSN_MR_TITLE
85+
value: "your-dsn-mr-title"
86+
# Sentryclirc MR (2) values
87+
- name: GITLAB_SENTRYCLIRC_MR_CONTENT
88+
value: your-sentryclirc-mr-content
89+
- name: GITLAB_SENTRYCLIRC_MR_DESCRIPTION
90+
value: your-sentryclirc-mr-description
91+
- name: GITLAB_SENTRYCLIRC_MR_BRANCH_NAME
92+
value: your-sentryclirc-mr-branch-name
93+
- name: GITLAB_SENTRYCLIRC_MR_FILEPATH
94+
value: .sentryclirc
95+
- name: GITLAB_SENTRYCLIRC_MR_COMMIT_MSG
96+
value: your-commit-msg
97+
- name: GITLAB_SENTRYCLIRC_MR_TITLE
98+
value: "your sentryclirc mr title"
99+
# Gitlab configuration values
100+
- name: GITLAB_AUTHOR_NAME
101+
value: author-name
102+
- name: GITLAB_AUTHOR_EMAIL
103+
value: your-author-email
104+
- name: GITLAB_GRAPHQL_SUFFIX
105+
value: api/graphql
106+
# - name: GITLAB_MENTIONS
107+
# value:
108+
# - "@all"
109+
- name: GITLAB_MENTIONS_ACCESS_LEVEL
110+
value: 40 # maintainer
111+
- name: GITLAB_CREATION_DAYS_LIMIT
112+
value: 60 # Max days old per project
113+
- name: GITLAB_MR_KEYWORD
114+
value: sentry # key word for searching mrs
115+
- name: GITLAB_REMOVE_SOURCE
116+
value: true # If the mr will remove the source branch
117+
- name: GITLAB_GROUP_IDENTIFIER
118+
value: your-group-identifier # will look only for group projects having this identifier
119+
- name: GITLAB_AIOHTTP_TIMEOUT
120+
value: 60
121+
- name: GITLAB_GRAPHQL_PAGE_LENGTH
122+
value: 100
123+
- name: GITLAB_MR_LABEL_LIST
124+
value: "sentry,your-label" # comma separated list of labels for the mr
124125
```
125126
126-
2. If you want to follow the ```helm``` deployment process you will have to fill your details into the ```helm/values-production.yaml``` and ```helm/Chart.yaml```.
127+
2. If you want to follow the `helm` deployment process you will have to fill your details into the `helm/values-production.yaml` and `helm/Chart.yaml`.
127128
128-
3. You can update ```REG ?= your-registry``` and ```NS ?= your-namespace``` values inside ```Makefile```.
129+
3. You can update `REG ?= your-registry` and `NS ?= your-namespace` values inside `Makefile`.
129130
130131
## Manual run
131132
132-
If you want to update a specific project (for example if the project has a very big name or is older than the ```GITLAB_CREATION_DAYS_LIMIT``` value), you can run the ```gitlab2sentry``` manually.
133+
If you want to update a specific project (for example if the project has a very big name or is older than the `GITLAB_CREATION_DAYS_LIMIT` value), you can run the `gitlab2sentry` manually.
133134
134-
* First, you have to ```export``` all env variables which are listed above in the ```helm/values-production.yaml``` file.
135+
- First, you have to `export` all env variables which are listed above in the `helm/values-production.yaml` file.
135136
136-
* Next you can run the following commands:
137+
- Next you can run the following commands:
137138
138139
```python
139140
>>> from gitlab2sentry import Gitlab2Sentry
@@ -146,4 +147,3 @@ If you want to update a specific project (for example if the project has a very
146147
Numberly decided to Open Source this project because it saves a lot of time internally to all our developers and helped foster the mass adoption of Sentry in all our Tech teams. We hope this project can benefit someone else.
147148
148149
Feel free to ask questions, suggest improvements and of course contribute features or fixes you might need!
149-

docs/configuration.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Configuration Guide
2+
3+
This application uses `pydantic`'s `BaseSettings` for configuration, which allows you to set and override parameters using environment variables. Below, you'll find a list of all the configuration options and the expected environment variables. Each configuration setting has a default value, but you can easily override them to suit your deployment needs.
4+
5+
To configure the application, set the following environment variables:
6+
7+
| Environment Variable | Description | Default Value |
8+
| ------------------------------- | -------------------------------------------------- | ----------------------------- |
9+
| `ENV` | The environment the application is running in | `production` |
10+
| `SENTRY_DSN` | Sentry DSN for monitoring | `http://default.sentry.com` |
11+
| `SENTRY_ENV` | Sentry environment name | `production` |
12+
| `SENTRY_ORG_SLUG` | Organization slug for Sentry | `default_org` |
13+
| `SENTRY_TOKEN` | Authentication token for Sentry | `default-token` |
14+
| `SENTRY_URL` | Base URL for Sentry service | `http://default-sentry-url` |
15+
| `DSN_MR_CONTENT` | Merge request content for DSN | Custom template (see code) |
16+
| `DSN_BRANCH_NAME` | Branch name for DSN changes | `auto_add_sentry_dsn` |
17+
| `DSN_MR_TITLE` | Title for DSN-related merge request | `[gitlab2sentry] Merge me...` |
18+
| `DSN_MR_DESCRIPTION` | Description for DSN-related merge request | Custom template (see code) |
19+
| `SENTRYCLIRC_MR_CONTENT` | Merge request content for Sentry CLI configuration | Custom template (see code) |
20+
| `SENTRYCLIRC_BRANCH_NAME` | Branch name for Sentry CLI configuration changes | `auto_add_sentry` |
21+
| `SENTRYCLIRC_MR_TITLE` | Title for Sentry CLI configuration MR | `[gitlab2sentry] Merge me...` |
22+
| `SENTRYCLIRC_FILEPATH` | Filepath for `.sentryclirc` configuration | `.sentryclirc` |
23+
| `SENTRYCLIRC_COM_MSG` | Commit message for `.sentryclirc` update | `Update .sentryclirc` |
24+
| `SENTRYCLIRC_MR_DESCRIPTION` | Description for Sentry CLI configuration MR | Custom template (see code) |
25+
| `GITLAB_AUTHOR_EMAIL` | GitLab author email for merge requests | `[email protected]` |
26+
| `GITLAB_AUTHOR_NAME` | GitLab author name for merge requests | `Default Author` |
27+
| `GITLAB_GRAPHQL_PAGE_LENGTH` | Page length for GitLab GraphQL queries | `0` |
28+
| `GITLAB_GRAPHQL_SUFFIX` | Suffix for GitLab GraphQL queries | `default-content` |
29+
| `GITLAB_GRAPHQL_TIMEOUT` | Timeout for GitLab GraphQL queries (in seconds) | `10` |
30+
| `GITLAB_GROUP_IDENTIFIER` | Group identifier for GitLab projects | Empty string |
31+
| `GITLAB_MENTIONS_ACCESS_LEVEL` | Access level to mention users in GitLab MRs | `40` |
32+
| `GITLAB_MENTIONS` | GitLab usernames to mention | Empty string |
33+
| `GITLAB_MR_KEYWORD` | Keyword to include in GitLab merge requests | `sentry` |
34+
| `GITLAB_MR_LABEL_LIST` | Labels to assign to GitLab merge requests | `['sentry']` |
35+
| `GITLAB_PROJECT_CREATION_LIMIT` | Limit for creating GitLab projects | `30` |
36+
| `GITLAB_RMV_SRC_BRANCH` | Remove source branch after merge request | `True` |
37+
| `GITLAB_TOKEN` | GitLab access token | `default-token` |
38+
| `GITLAB_URL` | Base URL for GitLab service | `http://default-gitlab-url` |
39+
| `GITLAB_SIGNED_COMMIT` | Whether to use signed commits in GitLab | `False` |
40+
41+
To override any configuration, simply set the respective environment variable before running the application. For instance:
42+
43+
```sh
44+
export SENTRY_DSN="http://your.custom.sentry.dsn"
45+
export GITLAB_URL="http://your.gitlab.url"
46+
```

0 commit comments

Comments
 (0)