This program is used to onboard new tenants. It automates the process of creating a new repo, adding webhooks, branch protection, etc. It is invoked by the Fiserv Support workflow
The program provides the following functionality:
- Create a github repo (-r)
- Add the devstudio and tenant github teams to the repo (-t)
- Setup the github webooks (-h)
- Create Ruleset/Branch protection (-b)
- Generate the necessary DB snippets needed (-d)
- Fill out tenant.json and product-layout.yaml file.
- (delete coming later...)
- (integrate with GitLab to commit DB changes coming later)
- Clone/checkout the repo
- From the cloned directory run:
cargo build
It makes use of MongoDB tools. mongodbimport. You'll need to have this installed first. If you're on mac then you can just homebrew install it.
brew tap mongodb/brew
brew install mongodb-database-tools
Create an environment variable called GITHUB_AUTH_TOKEN whose value is a valid GitHub auth-token, for example, a Personal Access Token.
export GITHUB_AUTH_TOKEN="<auth_token>"
Create an environment variable called STAGE_WEBHOOK_KEY
and PROD_WEBHOOK_KEY
whose value would be used to set the tenant Github Webhook secrets for those environments.
export STAGE_WEBHOOK_KEY="stage_secret"
export PROD_WEBHOOK_KEY="prod_secret"
Default mode is a dry run that will print out info about what happened to a log. This way you can confirm you did the right thing before you really create a repo.
To actually execute for REAL, you'll need the extra flag. Example : ./startup.sh -f to -r --execute
From root directory run startup script
Example : ./startup.sh -f '-te'
Tenant-Onboarding-Form.yaml holds information that will be used when creating the repo, when updating tenant.json, and the db scripts.
The tenant.json file, that is updated to include values corresponding to the tenant being onboarded, is in the tenant-onboarding
repo.
The updated tenant.json is pushed to the tenant's repo created by this program. Therefore, the tenant.json in the tenant-onboarding
repo must be kept in sync with the tenant.json (develop
branch) in the sample-tenant-repo
(the template repo for the tenant's repo
created by this program).
Logs will be written out to logs/to-TIMESTAMP.log
DB snippets (scripts) will be stored in the subdirectory: dbscripts
The directory will be created if it doesn't exist
For now it will overwrite contents if you run it more than once.
to -h
to -trdv OR to -a
to -d
Search for information online.
In VSCode set up launch.json in the same directory.
{
"version": "0.2.0",
"configurations": [
{
"name": "(Windows) Launch",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceRoot}/target/debug/tenant-boarding.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"environment": [],
"externalConsole": true
},
{
"name": "(OSX) Launch",
"type": "lldb",
"request": "launch",
"program": "${workspaceRoot}/target/debug/tenant-onboarding",
"args": ["-te"],
"cwd": "${workspaceRoot}",
}
]
}