Skip to content
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 .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Ruff pre-commit hook documentation:
# - https://github.com/astral-sh/ruff-pre-commit
default_language_version:
python: python3.12
python: python3
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# NOTE: Don't move the trailing "ruff-pre-commit version" comment from
Expand Down
5 changes: 1 addition & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ RUN yum update -y && yum install -y \
&& uwsgi --build-plugin https://github.com/City-of-Helsinki/uwsgi-sentry \
&& yum clean all

# fatal: detected dubious ownership in repository at '/app'
RUN git config --system --add safe.directory /app

COPY --chown=root:root --chmod=755 docker-entrypoint.sh /entrypoint/docker-entrypoint.sh
ENTRYPOINT ["/entrypoint/docker-entrypoint.sh"]

Expand All @@ -46,4 +43,4 @@ FROM appbase AS production
RUN SECRET_KEY="only-used-for-collectstatic" python manage.py collectstatic

USER default
EXPOSE 8000/tcp
EXPOSE 8000/tcp
2 changes: 1 addition & 1 deletion common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def update_object_with_translations(model, model_data):


def get_api_version():
return " | ".join((__version__, settings.COMMIT_HASH.decode("utf-8")))
return " | ".join((__version__, settings.COMMIT_HASH))


def get_node_id_from_global_id(global_id, node_name):
Expand Down
12 changes: 5 additions & 7 deletions palvelutarjotin/settings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import subprocess
import tempfile
from datetime import datetime
from pathlib import Path
Expand All @@ -10,6 +9,7 @@
from django.utils.translation import gettext_lazy as _
from sentry_sdk.integrations.django import DjangoIntegration

from palvelutarjotin import __version__
from palvelutarjotin.consts import CSP

checkout_dir = environ.Path(__file__) - 2
Expand Down Expand Up @@ -94,6 +94,7 @@
SOCIAL_AUTH_TUNNISTAMO_SECRET=(str, ""), # empty to ignore it's being unset.
LOGIN_REDIRECT_URL=(str, "/admin/"),
LOGOUT_REDIRECT_URL=(str, "/admin/"),
OPENSHIFT_BUILD_COMMIT=(str, ""),
)

if os.path.exists(env_file):
Expand Down Expand Up @@ -158,14 +159,11 @@
ILMOITIN_QUEUE_NOTIFICATIONS = env("ILMOITIN_QUEUE_NOTIFICATIONS")
TRANSLATED_SMS_SENDER = env("TRANSLATED_SMS_SENDER")

try:
COMMIT_HASH = subprocess.check_output(["git", "rev-parse", "HEAD"]).strip()
except Exception:
COMMIT_HASH = b"n/a"

COMMIT_HASH = env("OPENSHIFT_BUILD_COMMIT")
Comment thread
charn marked this conversation as resolved.
VERSION = __version__
sentry_sdk.init(
dsn=env.str("SENTRY_DSN"),
release=COMMIT_HASH,
release=env.str("OPENSHIFT_BUILD_COMMIT", VERSION),
environment=env("SENTRY_ENVIRONMENT"),
integrations=[DjangoIntegration()],
)
Expand Down
2 changes: 1 addition & 1 deletion palvelutarjotin/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def readiness(*args, **kwargs):
"status": "ok",
"release": settings.APP_RELEASE,
"packageVersion": __version__,
"commitHash": settings.COMMIT_HASH.decode("utf-8"),
"commitHash": settings.COMMIT_HASH,
"buildTime": settings.APP_BUILD_TIME.strftime("%Y-%m-%dT%H:%M:%S.000Z"),
}
return JsonResponse(response_json, status=200)
Expand Down