Skip to content

Commit

Permalink
Configure for Codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwhitacre committed Jul 26, 2023
1 parent 3f30771 commit ac77ebe
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 6 deletions.
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The events sent by the bot are defined under "Subscribe to bot events" in the "E
- [A message was posted in a direct message channel](https://api.slack.com/events/message.im)
- [A member's data has changed](https://api.slack.com/events/user_change).

### Github Sentry Webhooks
### GitHub Sentry Webhooks

Under Sentry's [webhooks](https://github.com/organizations/getsentry/settings/hooks) there's webhooks to the production backend with the route "webhooks/github".

Expand Down Expand Up @@ -167,11 +167,9 @@ You'll also need to create a private key for the service account (it should down
- Leave the `privateKey` as-is, it's the name of an environment variable to pull from (the main `github-orgs.yml` holds public config and is checked into version control).
- In a terminal, log into the Github CLI using `gh auth login`.
- In a terminal, log into the GitHub CLI using `gh auth login`.
- Use [this](https://docs.github.com/en/issues/planning-and-tracking-with-projects/automating-your-project/using-the-api-to-manage-projects#finding-the-node-id-of-an-organization-project) GraphQL query to identify the node ID of the project you made earlier; set `project.nodeId` to match.
- Use [this](https://docs.github.com/en/issues/planning-and-tracking-with-projects/automating-your-project/using-the-api-to-manage-projects#finding-the-node-id-of-a-field) GraphQL query to identify the IDs of the project fields you set up, and use those to populate `project.fieldIds`.
- Use the script at `bin/get-project-ids.sh $orgSlug $projectNumber` to determine the ids to set in `github-orgs.yml` for your project.
1. Follow the steps of the "Development & tests" section below to get the server running.
Expand Down Expand Up @@ -248,7 +246,7 @@ yarn test
This section only matters if you want to gather metrics from other projects than the ones we currently do.
Install [the Github application](https://github.com/organizations/getsentry/settings/apps/getsantry/installations) to relevant repos (you will need to contact IT for access to this app). This app is used for GitHub API access to the repos it is installed on.
Install [the GitHub application](https://github.com/organizations/getsentry/settings/apps/getsantry/installations) to relevant repos (you will need to contact IT for access to this app). This app is used for GitHub API access to the repos it is installed on.
### Deploying
Expand Down
1 change: 1 addition & 0 deletions bin/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ IMAGE=gcr.io/${PROJECT}/product-eng-webhooks

env_vars="ENV=production,"
env_vars="${env_vars}GH_APP_PRIVATE_KEY_FOR_GETSENTRY=${GH_APP_PRIVATE_KEY_FOR_GETSENTRY},"
env_vars="${env_vars}GH_APP_PRIVATE_KEY_FOR_CODECOV=${GH_APP_PRIVATE_KEY_FOR_CODECOV},"
env_vars="${env_vars}GH_WEBHOOK_SECRET=${GH_WEBHOOK_SECRET},"
env_vars="${env_vars}SLACK_SIGNING_SECRET=${SLACK_SIGNING_SECRET},"
env_vars="${env_vars}SLACK_BOT_USER_ACCESS_TOKEN=${SLACK_BOT_USER_ACCESS_TOKEN},"
Expand Down
41 changes: 41 additions & 0 deletions bin/get-project-ids.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env zsh

nodeId=$(
gh api graphql -f query='
query{
organization(login: "'$1'"){
projectV2(number: '$2') {
id
}
}
}' \
| jq -r '.data.organization.projectV2.id'
)

fields=$(
gh api graphql -f query='
query{
node(id: "'$nodeId'") {
... on ProjectV2 {
fields(first: 20) {
nodes {
... on ProjectV2FieldCommon {
id
name
}
}
}
}
}
}' \
)

function id () {
echo "$fields" | jq -r '.data.node.fields.nodes[] | select(.name=="'"$1"'").id'
}

echo " nodeId: '$nodeId'"
echo " fieldIds:"
echo " productArea: '"$(id 'Product Area')"'"
echo " status: '"$(id 'Status')"'"
echo " responseDue: '"$(id 'Response Due')"'"
14 changes: 14 additions & 0 deletions github-orgs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,17 @@ getsentry:
- 'sentry-android-gradle-plugin'
- 'sentry-dotnet'
- 'sentry-dart-plugin'
codecov:
appAuth:
appId: 343171
privateKey: 'GH_APP_PRIVATE_KEY_FOR_CODECOV'
installationId: 40036835
project:
nodeId: 'PVT_kwDOAH2Fnc4ARzsq'
fieldIds:
productArea: 'PVTSSF_lADOAH2Fnc4ARzsqzgLXyZg'
status: 'PVTSSF_lADOAH2Fnc4ARzsqzgLXyI4'
responseDue: 'PVTF_lADOAH2Fnc4ARzsqzgLXyhE'
repos:
withoutRouting:
- 'feedback'

0 comments on commit ac77ebe

Please sign in to comment.