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

feat(devservices): Support migrations in devenv sync for new devservices #80834

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
50 changes: 37 additions & 13 deletions devenv/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ def main(context: dict[str, str]) -> int:

FRONTEND_ONLY = os.environ.get("SENTRY_DEVENV_FRONTEND_ONLY") is not None

USE_NEW_DEVSERVICES = os.environ.get("USE_NEW_DEVSERVICES") is not None

from devenv.lib import node

node.install(
Expand Down Expand Up @@ -253,18 +255,40 @@ def main(context: dict[str, str]) -> int:
print("Skipping python migrations since SENTRY_DEVENV_FRONTEND_ONLY is set.")
return 0

# TODO: check healthchecks for redis and postgres to short circuit this
proc.run(
(
f"{venv_dir}/bin/{repo}",
"devservices",
"up",
"redis",
"postgres",
),
pathprepend=f"{reporoot}/.devenv/bin",
exit=True,
)
if USE_NEW_DEVSERVICES:
# Ensure old sentry devservices is not being used, otherwise ports will conflict
proc.run(
(
f"{venv_dir}/bin/{repo}",
"devservices",
"down",
),
pathprepend=f"{reporoot}/.devenv/bin",
exit=True,
)
proc.run(
(
f"{venv_dir}/bin/devservices",
"start",
),
pathprepend=f"{reporoot}/.devenv/bin",
exit=True,
)
postgres_container_name = "sentry-postgres-1"
else:
# TODO: check healthchecks for redis and postgres to short circuit this
proc.run(
(
f"{venv_dir}/bin/{repo}",
"devservices",
"up",
"redis",
"postgres",
),
pathprepend=f"{reporoot}/.devenv/bin",
exit=True,
)
postgres_container_name = "sentry_postgres"

if not run_procs(
repo,
Expand All @@ -286,7 +310,7 @@ def main(context: dict[str, str]) -> int:
(
"docker",
"exec",
"sentry_postgres",
postgres_container_name,
"psql",
"sentry",
"postgres",
Expand Down
Loading