## CONTENT
- Introduction
- Requirements
- Installation
- Setup
# INTRODUCTION
HackerRank is a project designed with the intention to gamify the development process and create incentives for the developer through achievements and scoring systems.
# REQUIREMENTS
.NET Core 5
.NET Tools
UltraHook
Ruby & RubyGems
# INSTALLATION
Install .NET Core: Download .NET (Linux, macOS, and Windows)
Install .NET Tools: .NET tools - .NET CLI | Microsoft Docs
Install UltraHook: UltraHook - Receive webhooks on localhost
Install Ruby: RubyInstaller for Windows
Install RubyGems:
Download RubyGems
# SETUP
Clone the project
Create migrations for the main database:
VS:
add-migration Init -Context HackerRankContext
VS Code:
dotnet ef migrations add Init --context HackerRankContext
Update both databases:
VS:
update-database -Context HackerRankContext
update-database -Context HangFireContext
VS Code:
dotnet ef database update --context HackerRankContext
dotnet ef database update --context HangFireContext
Create access token from GitLab:
Go to edit profile -> access token
Create a new token with the following scopes: read_user, read_api, read_repository, read_registry
This will generate your AccessToken
Create an application in GitLab:
Go to edit profile -> applications
Create a new application with the following scopes: read_user, email, openid, profile
This will generate your ClientSecret and ClientId
These secret keys will be used in the next step
Add user secrets:
dotnet user-secrets init
Change each value for the corresponding values generated in the previous step
dotnet user-secrets set "Authentication:GitLab:ClientSecret" "ClientSecret"
dotnet user-secrets set "Authentication:GitLab:ClientId" "ClientId"
dotnet user-secrets set "Authentication:GitLab:APIKey" "AccessToken"
For this command, use a password manager to generate a long random string of characters to use as the "SecretToken"
dotnet user-secrets set "Authentication:GitLab:WebHookAuthentication" "SecretToken"
UltraHook:
Run this command after installing ultrahook and following the instructions to get an API key
ultrahook gitlab https://localhost:YOUR_PORT_HERE/api/webhook/receive
If for some reason ultrahook cannot read the API key stored on your device use this command instead
ultrahook gitlab -k API_KEY_HERE https://localhost:YOUR_PORT_HERE/api/webhook/receive
Copy the URL which ultrahook generates (should look something like this: username-gitlab.ultrahook.com)
Go to the project you want to track -> settings -> webhooks
Add the URL you copied in the previous step to the URL field
Add "SecretToken" you generated earlier to the secret token field
Check the following scopes: push events, comments, merge request events, issue events and then click "Add webhook"
That's it!