Rezent is a Laravel app which takes incoming requests from Azure Pipelines or GitHub Actions and acts as a notification webhook where it processes the build information and outputs the results to Discord and/or Slack.
For Rezent there are 5 main things that it does:
- Recieves the API request in the
DriverController
- Creates a new
ProcessBuildRequest
job - Runs the individual driver's code in
App/Drivers
directory - Checks if it hasn't posted the message once already
- Posts the message to Discord and/or Slack
To install Rezent, your machine must meet the below outlined requirements:
Required:
- PHP 7.2.5+
- Node & NPM
- Composer
- Other Laravel requirements
Highly recommended:
- Any of the Laravel supported Queue drivers to speed up Rezent dramatically.
- Rezent already comes installed with the
predis/predis
Composer package installed.
- Rezent already comes installed with the
Note:
- SMTP server access is optionally required because the
Forgot password?
action needs an e-mail server. If you do not have one, you can disable the action entirely by editing theroutes/web.php
file:
Route::namespace('App\Http\Controllers')->group(function () {
- Auth::routes(['register' => false]);
+ Auth::routes(['register' => false, 'reset' => false]);
});
To set up Rezent for development, you'll need to:
- Fork the repository and clone it to your machine
composer install
npm install
npm run dev
cp .env.example .env
php artisan key:generate
- Configure the
.env
file php artisan migrate
php artisan passport:install
php artisan make:user <name> <email>
Optional:
php artisan ide-helper:generate
php artisan ide-helper:models
php artisan ide-helper:meta
Happy coding!
To set up Rezent for production, you'll need to:
- Fork or clone the
master
branch composer install --optimize-autoloader --no-dev
npm install
npm run prod
cp .env.example .env
- Configure the
.env
file php artisan key:generate
php artisan migrate --force
php artisan config:cache
php artisan route:cache
php artisan make:user <name> <email>
Ready to roll!
To start using Rezent, you'll need to follow these steps:
- Make sure that your
.env
file is configured correctly, so that you have the webhook information there - Create a user if you haven't done so already
- Log in as the created user
- Create a new project
- Note down the access token that Rezent generates
- Configure your CI tool according to the specification below
All the examples below will use Rezent at the following endpoint: https://rezent.test
.
Azure Pipelines is a bit more tricky to set up.
- Navigate to your
Service Hooks
page (e.g.https://dev.azure.com/my-org/my-repo/_settings/serviceHooks
) - Add a new service hook by using the green
+
- Select
Web Hooks
- Select the
Build completed
event - In the URL input, set it to
https://rezent.test/api/driver/pipelines
- In the
HTTP headers
field add this:Authorization: Bearer <the copied token>
- Don't test it because it won't work (it sends a unusable payload), just save it with
Next
GitHub Actions doesn't have a webhook implementation so we'll use cURL
. To use it, you'll need to:
- Set the
REZENT_TOKEN
value in your repository'sSettings/Secrets
GitHub page - Obtain the workflow ID that you will be testing against:
- You'll need to get the workflow ID which isn't available anywhere in the UI side
- Run this command (replace the placeholder data):
curl "https://api.github.com/repos/my-org/my-repo/actions/workflows"
- Look for the workflow that matches the workflow name you want and find the ID of that workflow
- Insert that ID into your the placeholder ID of
123456
Example:
jobs:
notify:
needs: [validate, build]
if: always()
runs-on: ubuntu-latest
steps:
- name: Notify Rezent
env:
REZENT_TOKEN: ${{ secrets.REZENT_TOKEN }}
if: always()
run: |
curl -H "Authorization: Bearer ${REZENT_TOKEN}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-X POST \
-d '{"organisation": "my-org", "repository": "my-repo", "workflow_id": 123456}' \
"https://rezent.test/api/driver/actions"
Run the tests with:
php artisan test
Please see CONTRIBUTING.md for details.
If you discover any security-related issues, please e-mail [email protected] instead of using the issue tracker.
So, funny name for Mechilles, ZEN'ified. More of a joke, but I imagined the fact that it builds each build over and over for each new thing, and also the developer's resentment when the build fails 😄
The name is... ReZENt 😄
— Radium
The MIT License (MIT). Please see the License file for more information.