|
1 | 1 | import os |
2 | | -import subprocess |
3 | 2 | import tempfile |
4 | 3 | from datetime import datetime |
5 | 4 | from pathlib import Path |
|
10 | 9 | from django.utils.translation import gettext_lazy as _ |
11 | 10 | from sentry_sdk.integrations.django import DjangoIntegration |
12 | 11 |
|
| 12 | +from palvelutarjotin import __version__ |
13 | 13 | from palvelutarjotin.consts import CSP |
14 | 14 |
|
15 | 15 | checkout_dir = environ.Path(__file__) - 2 |
|
94 | 94 | SOCIAL_AUTH_TUNNISTAMO_SECRET=(str, ""), # empty to ignore it's being unset. |
95 | 95 | LOGIN_REDIRECT_URL=(str, "/admin/"), |
96 | 96 | LOGOUT_REDIRECT_URL=(str, "/admin/"), |
| 97 | + OPENSHIFT_BUILD_COMMIT=(str, ""), |
97 | 98 | ) |
98 | 99 |
|
99 | 100 | if os.path.exists(env_file): |
|
158 | 159 | ILMOITIN_QUEUE_NOTIFICATIONS = env("ILMOITIN_QUEUE_NOTIFICATIONS") |
159 | 160 | TRANSLATED_SMS_SENDER = env("TRANSLATED_SMS_SENDER") |
160 | 161 |
|
161 | | -try: |
162 | | - COMMIT_HASH = subprocess.check_output(["git", "rev-parse", "HEAD"]).strip() |
163 | | -except Exception: |
164 | | - COMMIT_HASH = b"n/a" |
165 | | - |
| 162 | +COMMIT_HASH = env("OPENSHIFT_BUILD_COMMIT") |
| 163 | +VERSION = __version__ |
166 | 164 | sentry_sdk.init( |
167 | 165 | dsn=env.str("SENTRY_DSN"), |
168 | | - release=COMMIT_HASH, |
| 166 | + release=env.str("OPENSHIFT_BUILD_COMMIT", VERSION), |
169 | 167 | environment=env("SENTRY_ENVIRONMENT"), |
170 | 168 | integrations=[DjangoIntegration()], |
171 | 169 | ) |
|
0 commit comments