https://github.com/pauldotknopf/bulwark
An implementation of GitHub's CODEOWNERS file, but for GitLab.
https://github.com/pauldotknopf/bulwark
codeowner-managed dotnet gitlab merge-request pull-requests
Last synced: about 1 year ago
JSON representation
An implementation of GitHub's CODEOWNERS file, but for GitLab.
- Host: GitHub
- URL: https://github.com/pauldotknopf/bulwark
- Owner: pauldotknopf
- License: mit
- Created: 2018-05-13T03:07:36.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2025-02-12T03:36:33.000Z (over 1 year ago)
- Last Synced: 2025-03-20T14:48:25.310Z (about 1 year ago)
- Topics: codeowner-managed, dotnet, gitlab, merge-request, pull-requests
- Language: C#
- Homepage:
- Size: 143 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Bulwark
An implementation if GitHub's CODEOWNERS file, but for GitLab.
[](http://www.nuget.org/packages/Bulwark/)
[](https://travis-ci.com/pauldotknopf/bulwark)
## Details
The `CODEOWNERS` file acts exactly as `.gitignore`. Similary, the file can also be nested in child directories to add/remove inherited users.
```config
* pauldotknopf
*.txt someoneelse
# You can also remove users from previously inherited matches.
*.pdf !pauldotknopf
```
## Installation
1. Run the web hook server. Example `docker-compose.yml` file [here](build/docker/example/docker-compose.yml). Configurable options [here](todo).
* At a bare minimum, you should have the following configured for Bulwark to properly communicate with GitLab.
```
{
"GitLab": {
"AuthenticationToken": "your-auth-token"
}
}
```
This configuration should go in a `config.json` file in the working directory of the running Bulwark instance.
2. On GitLab under `Project > Settings > Integrations`, add a web hook that points to `https://your-bulwark-instance.com/gitlab` and tick the following:
* [x] Push events
* [x] Merge request events
3. On GitLab under `Project > Settings > General`, tick following:
* [x] Merge request approvals
* [x] Can override approvers and approvals required per merge request
* [x] Remove all approvals in a merge request when new commits are pushed to its source branch (optional)
That's it. Submit a pull request with a CODEOWNERS file and watch users get automatically assigned as reviewers.
## More options
### Message queue
**Defaults**:
```
{
"MessageQueue": {
"Type": "Sqlite",
"SqlLiteDBLocation": "sqlite.db",
"RabbitMqHost": null,
"RabbitMqUsername": null,
"RabbitMqPassword": null,
"RabbitMqPort": 5672
}
}
```
**Details**:
* `"Type"`:
* `"Sqlite"` - The default method. New messages are stored in the database and a worker thread (or another process) consumes them.
* `"RabbitMq"` - Use an external RabbitMQ server to store the message.
### GitLab
**Defaults**:
```
{
"GitLab": {
"Enabled": true,
"ServerUrl": "https://gitlab.com/",
"AuthenticationToken": null,
"SecretToken": null,
"TargetBranchesFilter": null,
"AutoMergePullRequests": false,
"MergeCommitMessage": null,
"MergeWhenPipelineSuceeds": null,
"ShouldRemoveSourceBranch": null,
"UseHttp": true,
"HttpUsername: null,
"HttpPassword": null
}
}
```
**Details**:
* `"ServerUrl"`: You can point this to ```gitlab.com``` or your own hosted GitLab instance.
* `"AuthenticationToken"`: Generate this from your account settings.
* `"SecretToken"`: The secret token, configured in GitLab, for the web hook. This ensures that only GitLab can post to your hook.
* `"TargetBranchesFilter"`: A regular expression to match against branches you wish to process. You may want to set this to `"master"`.
* `"AutoMergePullRequests"`: If all the required approvers have approved, you can configure Bulwark to auto merge the merge request. You might want to update your `Project > Settings > Repository > Protected Branches` settings to only authorize Bulwark to merge your merge requests to your desired branch.
* `"MergeCommitMessage"`: Self explanatory, empty if you want GitLab to auto-generate a merge commit message. You can alse use tokens `{MergeRequestTitle}` and `{MergeRequestReference}` for a message like `{MergeRequestTitle}\nSee {MergeRequestReference} for more detais.`.
* `"MergeWhenPipelineSuceeds"`: When performing the merge, only do so when pipelines succeed.
* `"ShouldRemoveSourceBranch"`: Self explanatory, empty if you want to let GitLab to use the configured value for the merge request.
* `"UseHttp"`: Use http to clone git repositories. Otherwise, ssh.
* `"HttpUsername"`: The username to use when cloning via http.
* `"HttpPassword"`: The password to use when cloding via http.
### Repository cache
**Defaults**:
```
{
"RepositoryCache": {
"RepositoryCacheLocation": "repository-cache"
}
}
```
**Details**:
* `"RepositoryCacheLocation"`: The directory that repositories will be cloned to do internal diffs between commits.