mirror of
https://github.com/Crocmagnon/checkout.git
synced 2024-12-22 14:11:48 +01:00
Add a ping page with the commit sha
This commit is contained in:
parent
b691551e5b
commit
a697b3a6f1
6 changed files with 47 additions and 3 deletions
2
.github/workflows/publish.yaml
vendored
2
.github/workflows/publish.yaml
vendored
|
@ -50,4 +50,4 @@ jobs:
|
|||
max_attempts: 5
|
||||
retry_wait_seconds: 2
|
||||
warning_on_retry: false
|
||||
command: curl -sSL --fail -m 10 https://checkout.augendre.info | grep ${GITHUB_SHA::7} > /dev/null
|
||||
command: curl -sSL --fail -m 10 https://checkout.augendre.info/ping/ | grep ${GITHUB_SHA::7} > /dev/null
|
||||
|
|
|
@ -129,6 +129,7 @@ TEMPLATES = [
|
|||
"django.template.context_processors.request",
|
||||
"django.contrib.auth.context_processors.auth",
|
||||
"django.contrib.messages.context_processors.messages",
|
||||
"common.context_processors.app",
|
||||
],
|
||||
},
|
||||
},
|
||||
|
@ -228,3 +229,26 @@ CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5"
|
|||
CRISPY_TEMPLATE_PACK = "bootstrap5"
|
||||
|
||||
MESSAGE_TAGS = {messages.ERROR: "danger"}
|
||||
|
||||
APP = {
|
||||
"build": {
|
||||
"date": "latest-date",
|
||||
"commit": "latest-commit",
|
||||
"describe": "latest-describe",
|
||||
},
|
||||
}
|
||||
try:
|
||||
with Path("/app/git/build-date").open() as f:
|
||||
APP["build"]["date"] = f.read().strip()
|
||||
except Exception: # noqa: S110
|
||||
pass
|
||||
try:
|
||||
with Path("/app/git/git-commit").open() as f:
|
||||
APP["build"]["commit"] = f.read().strip()
|
||||
except Exception: # noqa: S110
|
||||
pass
|
||||
try:
|
||||
with Path("/app/git/git-describe").open() as f:
|
||||
APP["build"]["describe"] = f.read().strip()
|
||||
except Exception: # noqa: S110
|
||||
pass
|
||||
|
|
5
src/common/context_processors.py
Normal file
5
src/common/context_processors.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
from django.conf import settings
|
||||
|
||||
|
||||
def app(_):
|
||||
return settings.APP
|
10
src/common/templates/common/ping.html
Normal file
10
src/common/templates/common/ping.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
{% extends "common/base.html" %}
|
||||
{% block content %}
|
||||
<h1>Ping</h1>
|
||||
<h2>Versions</h2>
|
||||
<ul>
|
||||
<li>Build date: {{ build.date }}</li>
|
||||
<li>Commit: {{ build.commit }}</li>
|
||||
<li>Version: {{ build.describe }}</li>
|
||||
</ul>
|
||||
{% endblock %}
|
|
@ -1,8 +1,9 @@
|
|||
from django.urls import path
|
||||
|
||||
from common.views import home
|
||||
from common.views import home, ping
|
||||
|
||||
app_name = "common"
|
||||
urlpatterns = [
|
||||
path("ping/", ping, name="ping"),
|
||||
path("", home, name="home"),
|
||||
]
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
from django.shortcuts import redirect
|
||||
from django.shortcuts import redirect, render
|
||||
|
||||
|
||||
def home(_request):
|
||||
return redirect("purchase:new")
|
||||
|
||||
|
||||
def ping(request):
|
||||
return render(request, "common/ping.html", {})
|
||||
|
|
Loading…
Reference in a new issue