From b8de5e080b9404cacf6b02579de4d89d9e2f6f89 Mon Sep 17 00:00:00 2001 From: Julius de Jeu Date: Sun, 14 Nov 2021 16:08:44 +0100 Subject: [PATCH 1/3] Add link to git --- .drone.yml | 4 ++++ .gitignore | 1 + Dockerfile | 1 + app.py | 7 ++++++- templates/sidebar.html | 1 + 5 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 80e7fe9..30d4ce2 100644 --- a/.drone.yml +++ b/.drone.yml @@ -12,6 +12,10 @@ trigger: - pull_request steps: +- name: commit hash magic + image: bitnami/git:2.33.0 + commands: + - git show -s --format=%h > hash - name: kaniko image: plugins/kaniko settings: diff --git a/.gitignore b/.gitignore index 3562f45..686fc35 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .vscode/ dist/ +hash \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 3c2d800..dcf2aa0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,6 +9,7 @@ RUN pip install pipenv && pipenv install --system COPY app.py /app/app.py COPY templates/ /app/templates COPY data/ /app/data +COPY hash /app/hash RUN python ./app.py diff --git a/app.py b/app.py index ad599a2..aebc1f3 100644 --- a/app.py +++ b/app.py @@ -26,11 +26,16 @@ update = date.today() tijden = render("tijden.md") nieuws = render("nieuws.md") +def read_hash(): + with open("hash") as f: + line = f.readline() + return {"long": line, "short": line[0:7]} inject_now = {'now': date.today().year, 'tijden': tijden, 'nieuws': nieuws, - 'update': update} + 'update': update, + 'hash': read_hash()} diff --git a/templates/sidebar.html b/templates/sidebar.html index 857f8a9..2a74f12 100644 --- a/templates/sidebar.html +++ b/templates/sidebar.html @@ -54,6 +54,7 @@

Laatste update: {{ update }}
+ Build {{hash.short}}
Webmaster: Julius de Jeu -- 2.44.1 From 73f822ce46aad4abd7113d81f8371af0761f8ea7 Mon Sep 17 00:00:00 2001 From: Julius de Jeu Date: Sun, 14 Nov 2021 16:20:59 +0100 Subject: [PATCH 2/3] Fix drone config --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 30d4ce2..28b686d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -15,7 +15,7 @@ steps: - name: commit hash magic image: bitnami/git:2.33.0 commands: - - git show -s --format=%h > hash + - git show -s --format=%H > hash - name: kaniko image: plugins/kaniko settings: -- 2.44.1 From 4a05646533da4ae6254e9130b96fad33c1ca0278 Mon Sep 17 00:00:00 2001 From: Julius de Jeu Date: Sun, 14 Nov 2021 16:30:58 +0100 Subject: [PATCH 3/3] Output hash in logs --- .drone.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 28b686d..88deb88 100644 --- a/.drone.yml +++ b/.drone.yml @@ -15,7 +15,7 @@ steps: - name: commit hash magic image: bitnami/git:2.33.0 commands: - - git show -s --format=%H > hash + - git show -s --format=%H | tee hash - name: kaniko image: plugins/kaniko settings: -- 2.44.1