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

devenv: minimum 1.13.0 version #79225

Merged
merged 3 commits into from
Oct 17, 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
2 changes: 1 addition & 1 deletion devenv/config.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[devenv]
minimum_version = 1.10.2
minimum_version = 1.13.0

[venv.sentry]
python = 3.12.6
Expand Down
64 changes: 41 additions & 23 deletions devenv/sync.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import importlib
import os
import shlex
import subprocess
Expand Down Expand Up @@ -70,7 +71,33 @@ def run_procs(
return all_good


# Temporary, see https://github.com/getsentry/sentry/pull/78881
def check_minimum_version(minimum_version: str):
version = importlib.metadata.version("sentry-devenv")

parsed_version = tuple(map(int, version.split(".")))
parsed_minimum_version = tuple(map(int, minimum_version.split(".")))

if parsed_version < parsed_minimum_version:
raise SystemExit(
f"""
Hi! To reduce potential breakage we've defined a minimum
devenv version ({minimum_version}) to run sync.

Please run the following to update your global devenv to the minimum:

{constants.root}/venv/bin/pip install -U 'sentry-devenv=={minimum_version}'

Then, use it to run sync this one time.

{constants.root}/bin/devenv sync
"""
)


def main(context: dict[str, str]) -> int:
check_minimum_version("1.13.0")

repo = context["repo"]
reporoot = context["reporoot"]
repo_config = config.get_config(f"{reporoot}/devenv/config.ini")
Expand All @@ -82,20 +109,15 @@ def main(context: dict[str, str]) -> int:

# repo-local devenv needs to update itself first with a successful sync
# so it'll take 2 syncs to get onto devenv-managed node, it is what it is
try:
from devenv.lib import node
from devenv.lib import node

node.install(
repo_config["node"]["version"],
repo_config["node"][constants.SYSTEM_MACHINE],
repo_config["node"][f"{constants.SYSTEM_MACHINE}_sha256"],
reporoot,
)
node.install_yarn(repo_config["node"]["yarn_version"], reporoot)
except ImportError:
from devenv.lib import volta # type: ignore[attr-defined]

volta.install(reporoot)
node.install(
repo_config["node"]["version"],
repo_config["node"][constants.SYSTEM_MACHINE],
repo_config["node"][f"{constants.SYSTEM_MACHINE}_sha256"],
reporoot,
)
node.install_yarn(repo_config["node"]["yarn_version"], reporoot)

# no more imports from devenv past this point! if the venv is recreated
# then we won't have access to devenv libs until it gets reinstalled
Expand All @@ -114,16 +136,12 @@ def main(context: dict[str, str]) -> int:
repo_config["colima"][f"{constants.SYSTEM_MACHINE}_sha256"],
reporoot,
)
try:
limactl.install(reporoot) # type: ignore[call-arg]
except TypeError:
# again, it'll take 2 syncs to get here
limactl.install(
repo_config["lima"]["version"],
repo_config["lima"][constants.SYSTEM_MACHINE],
repo_config["lima"][f"{constants.SYSTEM_MACHINE}_sha256"],
reporoot,
)
limactl.install(
repo_config["lima"]["version"],
repo_config["lima"][constants.SYSTEM_MACHINE],
repo_config["lima"][f"{constants.SYSTEM_MACHINE}_sha256"],
reporoot,
)

if not run_procs(
repo,
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev-frozen.txt
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ s3transfer==0.10.0
selenium==4.16.0
sentry-arroyo==2.16.5
sentry-cli==2.16.0
sentry-devenv==1.11.0
sentry-devenv==1.13.0
sentry-forked-django-stubs==5.1.0.post2
sentry-forked-djangorestframework-stubs==3.15.1.post2
sentry-kafka-schemas==0.1.111
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--index-url https://pypi.devinfra.sentry.io/simple

sentry-devenv>=1.11.0
sentry-devenv>=1.13.0

covdefaults>=2.3.0
docker>=6
Expand Down
Loading