Skip to content

Commit 008295a

Browse files
authored
devenv: replace volta (#75554)
1 parent da18da6 commit 008295a

File tree

7 files changed

+41
-34
lines changed

7 files changed

+41
-34
lines changed

.envrc

+5-4
Original file line numberDiff line numberDiff line change
@@ -179,14 +179,15 @@ python3 -m tools.docker_memory_check
179179
debug "Checking node..."
180180

181181
if ! require node; then
182-
die "You don't seem to have node installed. Install volta (a node version manager): https://develop.sentry.dev/environment/#javascript"
182+
die "You don't seem to have node installed. Please run devenv sync."
183183
fi
184184

185-
make node-version-check
185+
if ! node -pe "process.exit(Number(!(process.version == 'v' + require('./.volta.json').volta.node )))"; then
186+
die "Unexpected $(command -v node) version. Please run devenv sync."
187+
fi
186188

187189
if [ ! -x "node_modules/.bin/webpack" ]; then
188-
warn "You don't seem to have yarn packages installed."
189-
commands_to_run+=("devenv sync")
190+
die "You don't seem to have yarn packages installed. Please run devenv sync."
190191
fi
191192

192193
PATH_add node_modules/.bin

Makefile

+6-7
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ run-dependent-services \
2020
drop-db \
2121
create-db \
2222
apply-migrations \
23-
reset-db \
24-
node-version-check :
23+
reset-db :
2524
@./scripts/do.sh $@
2625

2726
develop \
@@ -35,7 +34,7 @@ install-py-dev :
3534
devenv-sync:
3635
devenv sync
3736

38-
build-js-po: node-version-check
37+
build-js-po:
3938
mkdir -p build
4039
rm -rf node_modules/.cache/babel-loader
4140
SENTRY_EXTRACT_TRANSLATIONS=1 $(WEBPACK)
@@ -107,18 +106,18 @@ test-cli: create-db
107106
rm -r test_cli
108107
@echo ""
109108

110-
test-js-build: node-version-check
109+
test-js-build:
111110
@echo "--> Running type check"
112111
@yarn run tsc -p config/tsconfig.build.json
113112
@echo "--> Building static assets"
114113
@NODE_ENV=production yarn webpack-profile > .artifacts/webpack-stats.json
115114

116-
test-js: node-version-check
115+
test-js:
117116
@echo "--> Running JavaScript tests"
118117
@yarn run test
119118
@echo ""
120119

121-
test-js-ci: node-version-check
120+
test-js-ci:
122121
@echo "--> Running CI JavaScript tests"
123122
@yarn run test-ci
124123
@echo ""
@@ -186,7 +185,7 @@ test-symbolicator:
186185
python3 -b -m pytest tests/relay_integration/lang/java/ -vv -m symbolicator
187186
@echo ""
188187

189-
test-acceptance: node-version-check
188+
test-acceptance:
190189
@echo "--> Building static assets"
191190
@$(WEBPACK)
192191
make run-acceptance

devenv/config.ini

+12
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@ linux_x86_64_sha256 = a73ba777b5d55ca89edef709e6b8521e3f3d4289581f174c8699adfb60
2727
linux_arm64 = https://github.com/indygreg/python-build-standalone/releases/download/20240415/cpython-3.12.3+20240415-aarch64-unknown-linux-gnu-install_only.tar.gz
2828
linux_arm64_sha256 = ec8126de97945e629cca9aedc80a29c4ae2992c9d69f2655e27ae73906ba187d
2929

30+
[node]
31+
# upstream (https://nodejs.org/dist/) is not reliable enough so we've mirrored it to GCS
32+
darwin_x86_64 = https://storage.googleapis.com/sentry-dev-infra-assets/node/node-v20.13.1-darwin-x64.tar.xz
33+
darwin_x86_64_sha256 = c83bffeb4eb793da6cb61a44c422b399048a73d7a9c5eb735d9c7f5b0e8659b6
34+
darwin_arm64 = https://storage.googleapis.com/sentry-dev-infra-assets/node/node-v20.13.1-darwin-arm64.tar.xz
35+
darwin_arm64_sha256 = e8a8e78b91485bc95d20f2aa86201485593685c828ee609245ce21c5680d07ce
36+
linux_x86_64 = https://storage.googleapis.com/sentry-dev-infra-assets/node/node-v20.13.1-linux-x64.tar.xz
37+
linux_x86_64_sha256 = efc0f295dd878e510ab12ea36bbadc3db03c687ab30c07e86c7cdba7eed879a9
38+
# used for autoupdate
39+
version = v20.13.1
40+
yarn_version = 1.22.22
41+
3042
[colima]
3143
darwin_x86_64 = https://github.com/abiosoft/colima/releases/download/v0.6.6/colima-Darwin-x86_64
3244
darwin_x86_64_sha256 = 84e72678945aacba5805fe363f6c7c87dc73e05cbbfdfc09f9b57cedf110865d

devenv/sync.py

+16-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
from __future__ import annotations
22

3-
import configparser
43
import os
54
import shlex
65
import subprocess
76

87
from devenv import constants
9-
from devenv.lib import colima, config, fs, limactl, proc, venv, volta
8+
from devenv.lib import colima, config, fs, limactl, proc, venv
109

1110

1211
# TODO: need to replace this with a nicer process executor in devenv.lib
@@ -30,7 +29,6 @@ def run_procs(
3029
**constants.user_environ,
3130
**proc.base_env,
3231
"VIRTUAL_ENV": venv_path,
33-
"VOLTA_HOME": f"{reporoot}/.devenv/bin/volta-home",
3432
"PATH": f"{venv_path}/bin:{reporoot}/.devenv/bin:{proc.base_path}",
3533
}
3634
if extra_env:
@@ -75,6 +73,7 @@ def run_procs(
7573
def main(context: dict[str, str]) -> int:
7674
repo = context["repo"]
7775
reporoot = context["reporoot"]
76+
repo_config = config.get_config(f"{reporoot}/devenv/config.ini")
7877

7978
# TODO: context["verbose"]
8079
verbose = os.environ.get("SENTRY_DEVENV_VERBOSE") is not None
@@ -88,17 +87,24 @@ def main(context: dict[str, str]) -> int:
8887
print(f"ensuring {repo} venv at {venv_dir}...")
8988
venv.ensure(venv_dir, python_version, url, sha256)
9089

91-
# TODO: move volta version into per-repo config
90+
# repo-local devenv needs to update itself first with a successful sync
91+
# so it'll take 2 syncs to get onto devenv-managed node, it is what it is
9292
try:
93+
from devenv.lib import node
94+
95+
node.install(
96+
repo_config["node"]["version"],
97+
repo_config["node"][constants.SYSTEM_MACHINE],
98+
repo_config["node"][f"{constants.SYSTEM_MACHINE}_sha256"],
99+
reporoot,
100+
)
101+
node.install_yarn(repo_config["node"]["yarn_version"], reporoot)
102+
except ImportError:
103+
from devenv.lib import volta
104+
93105
volta.install(reporoot)
94-
except TypeError:
95-
# this is needed for devenv <=1.4.0,>1.2.3 to finish syncing and therefore update itself
96-
volta.install()
97106

98107
if constants.DARWIN:
99-
repo_config = configparser.ConfigParser()
100-
repo_config.read(f"{reporoot}/devenv/config.ini")
101-
102108
try:
103109
colima.install(
104110
repo_config["colima"]["version"],

requirements-dev-frozen.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ s3transfer==0.10.0
179179
selenium==4.16.0
180180
sentry-arroyo==2.16.5
181181
sentry-cli==2.16.0
182-
sentry-devenv==1.8.0
182+
sentry-devenv==1.10.0
183183
sentry-forked-django-stubs==5.0.4.post2
184184
sentry-forked-djangorestframework-stubs==3.15.0.post1
185185
sentry-kafka-schemas==0.1.106

requirements-dev.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
--index-url https://pypi.devinfra.sentry.io/simple
22

3-
sentry-devenv>=1.8.0
3+
sentry-devenv>=1.10.0
44

55
covdefaults>=2.3.0
66
docker>=6

scripts/lib.sh

-11
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,6 @@ sudo-askpass() {
7878
fi
7979
}
8080

81-
node-version-check() {
82-
# Checks to see if node's version matches the one specified in package.json for Volta.
83-
node -pe "process.exit(Number(!(process.version == 'v' + require('./.volta.json').volta.node )))" ||
84-
(
85-
echo 'Unexpected node version. Recommended to use https://github.com/volta-cli/volta'
86-
echo 'Run `volta install node` and `volta install yarn` to update your toolchain.'
87-
echo 'If you do not have volta installed run `curl https://get.volta.sh | bash` or visit https://volta.sh'
88-
exit 1
89-
)
90-
}
91-
9281
init-config() {
9382
sentry init --dev --no-clobber
9483
}

0 commit comments

Comments
 (0)