Skip to content

Commit ab1f14a

Browse files
feat: Switch to devservices instead of sentry devservices (#88)
Use direnv + devservices to have a smaller dependency footprint. Sentry will also be moving to devservices in the new year and already has opt-in config for using devservices now. Fixes #85 Co-authored-by: Ian Woodard <17186604+IanWoodard@users.noreply.github.com>
1 parent c614a2a commit ab1f14a

File tree

7 files changed

+47
-32
lines changed

7 files changed

+47
-32
lines changed

.envrc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
# shellcheck disable=SC1091
3+
if [[ -f .env ]]; then
4+
dotenv .env
5+
fi
6+
7+
if [ ! -d .venv ]; then
8+
echo "warning: creating virtualenv for the first time"
9+
make setup
10+
source python/.venv/bin/activate
11+
else
12+
source python/.venv/bin/activate
13+
unset PS1
14+
fi

.github/workflows/ci.yml

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ jobs:
2626
- uses: swatinem/rust-cache@v2
2727

2828
- name: Run Rustfmt
29-
run: cargo fmt --all -- --check
29+
run: make style
3030

3131
- name: Run Clippy
32-
run: cargo clippy --workspace --all-features --tests -- -D clippy::all
32+
run: make lint
3333

3434
test:
3535
name: Tests (ubuntu)
@@ -38,27 +38,14 @@ jobs:
3838
steps:
3939
- uses: actions/checkout@v2
4040

41-
- name: Checkout sentry
42-
uses: actions/checkout@v4
43-
with:
44-
repository: getsentry/sentry
45-
path: sentry
41+
- name: Install Python Dependencies
42+
run: |
43+
make install-py-dev
4644
47-
- name: Setup steps
45+
- name: Start services
4846
id: setup
4947
run: |
50-
# We cannot execute actions that are not placed under .github of the main repo
51-
mkdir -p .github/actions
52-
cp -r sentry/.github/actions/* .github/actions
53-
54-
- name: Setup Sentry
55-
id: setup-sentry
56-
uses: ./.github/actions/setup-sentry
57-
with:
58-
workdir: sentry
59-
snuba: false
60-
kafka: true
61-
clickhouse: false
48+
devservices up
6249
6350
- name: Install protoc
6451
uses: arduino/setup-protoc@v3
@@ -79,12 +66,6 @@ jobs:
7966
command: test
8067
args: --all
8168

82-
- name: Install Python Dependencies
83-
run: |
84-
python -m venv python/.venv
85-
. python/.venv/bin/activate
86-
pip install -r python/requirements-dev.txt
87-
8869
- name: Run Python Integration Tests
8970
run: |
9071
export PYTEST_ADDOPTS=""

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Development
2-
setup: setup-git ## run setup tasks to create and configure a development environment
2+
setup: setup-git install-py-dev ## run setup tasks to create and configure a development environment
33
.PHONY: setup
44

55
setup-git: .git/hooks/pre-commit ## Setup git-hooks
@@ -27,7 +27,7 @@ style: ## Run style checking tools (cargo-fmt)
2727

2828
lint: ## Run linting tools (cargo-clippy)
2929
@rustup component add clippy 2> /dev/null
30-
cargo clippy --workspace --all-targets --all-features --no-deps --allow-dirty -- -D warnings
30+
cargo clippy --workspace --all-targets --all-features --no-deps -- -D warnings
3131
.PHONY: format
3232

3333
format: ## Run autofix mode for formatting and lint

config/config-sentry-dev.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
upkeep_task_interval_ms: 2000
2-
kafka_cluster: sentry_kafka:9093
2+
kafka_cluster: 127.0.0.1:9092

devservices/config.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Ignored by docker compose, used by devservices
2+
x-sentry-service-config:
3+
version: 0.1
4+
service_name: taskbroker
5+
dependencies:
6+
kafka:
7+
description: Shared instance of kafka used by sentry services
8+
remote:
9+
repo_name: sentry-shared-kafka
10+
branch: main
11+
repo_link: https://github.com/getsentry/sentry-shared-kafka
12+
modes:
13+
default: [kafka]
14+
containerized: [kafka]
15+
16+
networks:
17+
devservices:
18+
name: devservices
19+
external: true

python/integration_tests/helpers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def check_topic_exists(topic_name: str) -> bool:
1818
check_topic_cmd = [
1919
"docker",
2020
"exec",
21-
"sentry_kafka",
21+
"kafka-kafka-1",
2222
"kafka-topics",
2323
"--bootstrap-server",
2424
"localhost:9092",
@@ -37,7 +37,7 @@ def create_topic(topic_name: str, num_partitions: int) -> None:
3737
create_topic_cmd = [
3838
"docker",
3939
"exec",
40-
"sentry_kafka",
40+
"kafka-kafka-1",
4141
"kafka-topics",
4242
"--bootstrap-server",
4343
"localhost:9092",
@@ -59,7 +59,7 @@ def update_topic_partitions(topic_name: str, num_partitions: int) -> None:
5959
create_topic_cmd = [
6060
"docker",
6161
"exec",
62-
"sentry_kafka",
62+
"kafka-kafka-1",
6363
"kafka-topics",
6464
"--bootstrap-server",
6565
"localhost:9092",

python/requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
confluent_kafka>=2.3.0
2+
devservices==1.0.5
23
orjson>=3.10.10
34
protobuf>=5.28.3
45
pytest>=8.3.3

0 commit comments

Comments
 (0)