Skip to content

Commit

Permalink
feat(utils): make deploy release URL configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
nijel committed May 23, 2024
1 parent 4d39211 commit 2dc037d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions weblate/utils/management/commands/sentry_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from weblate.utils.management.base import BaseCommand

TAGS_API = "https://api.github.com/repos/WeblateOrg/weblate/git/ref/tags/{}"
RELEASES_API = "https://sentry.weblate.org/api/0/organizations/weblate/releases/"


class Command(BaseCommand):
Expand All @@ -29,7 +28,8 @@ def handle(self, *args, **options) -> None:
ref = response.json()["object"]["sha"]

sentry_auth = {"Authorization": f"Bearer {settings.SENTRY_TOKEN}"}
release_url = RELEASES_API + version + "/"
sentry_url = settings.SENTRY_RELEASES_API_URL
release_url = sentry_url + version + "/"

# Ensure the release is tracked on Sentry
response = requests.get(release_url, headers=sentry_auth, timeout=1)
Expand All @@ -41,7 +41,7 @@ def handle(self, *args, **options) -> None:
"refs": [{"repository": "WeblateOrg/weblate", "commit": ref}],
}
response = requests.post(
RELEASES_API, json=data, headers=sentry_auth, timeout=1
sentry_url, json=data, headers=sentry_auth, timeout=1
)
self.stdout.write(f"Created new release {version}")
response.raise_for_status()
Expand Down
1 change: 1 addition & 0 deletions weblate/utils/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class WeblateConf(AppConf):
SENTRY_TOKEN = None
SENTRY_SEND_PII = True
SENTRY_PROJECTS = ["weblate"]
SENTRY_RELEASES_API_URL = "https://sentry.io/api/0/organizations/4507304895905792/"
SENTRY_EXTRA_ARGS = {}
SENTRY_TRACES_SAMPLE_RATE = 0
SENTRY_PROFILES_SAMPLE_RATE = 0
Expand Down

0 comments on commit 2dc037d

Please sign in to comment.