The previous approach to enable race detection was too radical and accidently led to build our binaries with the race flage enabled, which caused issues when building images down the line. This happened because putting a `test --something` in bazelrc also sets it on `build` which is absolutely not what we wanted. Usually folks get this one working by having a `--stamp` config setting that fixes this when releasing binaries, which we don't at this stage, as we're still learning Bazel. Luckily, this was caught swiftly. The current approach insteads takes a more granular approach, which makes the `go_test` rule uses our own variant, which injects the `race = "on"` attribute, but only on `go_test`. ## Test plan <!-- All pull requests REQUIRE a test plan: https://docs.sourcegraph.com/dev/background-information/testing_principles --> CI, being a main-dry-run, this will cover the container building jobs, which were the ones failing. --------- Co-authored-by: Alex Ostrikov <alex.ostrikov@sourcegraph.com> |
||
|---|---|---|
| .. | ||
| build | ||
| config | ||
| notify | ||
| util | ||
| .gitignore | ||
| BUILD.bazel | ||
| build.sh | ||
| Dockerfile | ||
| integration_test.go | ||
| main_test.go | ||
| main.go | ||
| README.md | ||
| server_test.go | ||
BUILD TRACKER
Build Tracker is a server that listens for build events from Buildkite and stores them in memory and sends notifications about builds if they've failed.
The server currently listens for two events:
build.finishedjob.finished
For each job.finished event that is received, the corresponding build is updated with the job that has finished. On receipt of a build.finished event, the server will determine if the build has failed by going through all the contained jobs of the build. If one or more jobs have indeed failed, a notification will be sent over slack.
Deployment infrastructure
Build Tracker is deployed in the Buildkite kubernetes cluster of the Sourcegraph CI project on GCP. For more information on the deployment see infrastructure
Build
Execute the build.sh script which will build the docker container and push it to correct GCP registry. Once the image has been pushed the pod needs to be restarted so that it can pick up the new image!
Test
To run the tests execute go test .
Notification testing
To test the notifications that get sent over slack you can pass the flag -RunIntegrationTest as part of your test invocation, with some required configuration:
export SLACK_TOKEN='my valid token'
export BUILDKITE_WEBHOOK_TOKEN='optional'
export GITHUB_TOKEN='optional'
go test . -RunIntegrationTest
You can enable Slack client debugging by exporting the following environment variable BUILD_TRACKER_SLACK_DEBUG=1