Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Terraform & associated resources / script, and update documentation accordingly #165

Merged
merged 6 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 1 addition & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,36 +50,14 @@ This diagram shows the design of the Four Keys system:
* Contains a Python script for generating mock GitHub or Gitlab data.
* `event-handler/`
* Contains the code for the `event-handler`, which is the public service that accepts incoming webhooks.
* `queries/`
* Contains the SQL queries for creating the derived tables.
* `setup/`
* Contains the code for setting up and tearing down the Four Keys pipeline. Also contains a script for extending the data sources.
* `shared/`
* Contains a shared module for inserting data into BigQuery, which is used by the `bq-workers`
* `terraform/`
* Contains Terraform modules and submodules, and examples for deploying Four Keys using Terraform.

# How to use

## Out of the box

_The project uses Python 3 and supports data extraction for Cloud Build and GitHub events._

1. Fork this project.
1. Run the automation scripts, which does the following (See the [setup README](setup/README.md) for more details):
1. Create and deploy the Cloud Run webhook target and ETL workers.
1. Create the Pub/Sub topics and subscriptions.
1. Enable the Google Secret Manager and create a secret for your GitHub repo.
1. Create a BigQuery dataset, tables and views.
1. Output a URL for the newly generated Grafana dashboard.
1. Set up your development environment to send events to the webhook created in the second step.
1. Add the secret to your GitHub webhook.

_NOTE: Make sure you don't use "Squash Merging" in Git when merging back into trunk. This breaks the link between the commit into trunk and the commits from the branch you developed on and as thus it is not possible to measure "Time to Change" on these commits. It is possible to disable this feature in the settings of your repo_
## Generating mock data

The setup script includes an option to generate mock data. Generate mock data to play with and test the Four Keys project.

The data generator creates mocked GitHub events, which are ingested into the table with the source “githubmock.” It creates following events:

* 5 mock commits with timestamps no earlier than a week ago
Expand All @@ -88,7 +66,7 @@ The data generator creates mocked GitHub events, which are ingested into the tab
* Associated mock incidents
* _Note: By default, less than 15% of deployments create a mock incident. This threshold can be adjusted in the script._

To run outside of the setup script:
To run this data generator:

1. Ensure that you’ve saved your webhook URL and secret in your environment variables:

Expand All @@ -114,24 +92,6 @@ To run outside of the setup script:
SELECT * FROM four_keys.events_raw WHERE source = 'githubmock';
```

## Reclassifying events / updating your queries

The scripts consider some events to be “changes”, “deploys”, and “incidents.” You may want to reclassify one or more of these events, for example, if you want to use a label for your incidents other than “incident.” To reclassify one of the events in the table, no changes are required on the architecture or code of the project.

1. Update the view in BigQuery for the following tables:

* `four_keys.changes`
* `four_keys.deployments`
* `four_keys.incidents`

To update the view, we recommend that you update the `sql` files in the `queries` folder, rather than in the BigQuery UI.

1. Once you've edited the SQL, run `terraform apply` to update the view that populates the table:

```sh
cd ./setup && terraform apply
```

Notes:

* To feed into the dashboard, the table name should be one of `changes`, `deployments`, `incidents`.
Expand Down
5 changes: 0 additions & 5 deletions dashboard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,3 @@ The dashboard is running in a transient container. It does not store data. Ther

To rebuild and deploy the container, you can run `gcloud builds submit` in this directory.


## To deploy dashboard
If using [Terraform](https://www.terraform.io), please see the [setup](../setup/) to create the resources.

Once the resource is created or if you are not using Terraform, feel free to build and deploy outside of Terraform by running `gcloud builds submit` in this directory.
72 changes: 0 additions & 72 deletions data-generator/tools/refresh_data.sh

This file was deleted.

38 changes: 0 additions & 38 deletions queries/changes.sql

This file was deleted.

154 changes: 0 additions & 154 deletions queries/deployments.sql

This file was deleted.

12 changes: 0 additions & 12 deletions queries/events.sql

This file was deleted.

5 changes: 0 additions & 5 deletions queries/function_json2array.js

This file was deleted.

20 changes: 0 additions & 20 deletions queries/function_multiFormatParseTimestamp.sql

This file was deleted.

Loading