Skip to content

Commit

Permalink
Merge pull request #1304 from ScilifelabDataCentre/add-version
Browse files Browse the repository at this point in the history
Add version to web pages
  • Loading branch information
i-oden authored Oct 20, 2022
2 parents b6af931 + 00d829f commit b065a03
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/publish_and_trivyscan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,6 @@ jobs:
file: Dockerfiles/backend.Dockerfile
context: .
push: true
build-args: version=${{ github.ref_name }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,4 @@ Please add a _short_ line describing the PR you make, if the PR implements a spe

- Limit projects listing to active projects only; a `--show-all` flag can be used for listing all projects, active and inactive ([#1302](https://github.com/ScilifelabDataCentre/dds_web/pull/1302))
- Return name of project creator from UserProjects ([#1303](https://github.com/ScilifelabDataCentre/dds_web/pull/1303))
- Add version to the footer of the web pages ([#1304](https://github.com/ScilifelabDataCentre/dds_web/pull/1304))
4 changes: 4 additions & 0 deletions Dockerfiles/backend.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ RUN apk add jpeg-dev zlib-dev libjpeg
RUN apk add tzdata
ENV TZ="UCT"

# Extract version from Github during build
ARG version
ENV DDS_VERSION=$version

# Copy the content to a code folder in container
COPY ./requirements.txt /code/requirements.txt

Expand Down
5 changes: 5 additions & 0 deletions dds_web/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,11 @@ def load_user(user_id):
app.cli.add_command(update_uploaded_file_with_log)
app.cli.add_command(lost_files_s3_db)

# Make version available inside jinja templates:
@app.template_filter("dds_version")
def dds_version_filter(_):
return os.environ.get("DDS_VERSION", "Unknown")

with app.app_context(): # Everything in here has access to sessions
from dds_web.database import models

Expand Down
5 changes: 5 additions & 0 deletions dds_web/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ <h3>Important Information</h3>

<div class="footer border-top bg-light text-muted py-5 mt-5">
<div class="container">
<div class="row mb-3">
<div class="text-md-center small fw-bold">
Version: {{ "Unknown" | dds_version }}
</div>
</div>
<div class="row">
<div class="col-md-4">
<p class="small mb-0 mt-2">Dark mode</p>
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ services:
working_dir: /code
command: sh -c "flask db upgrade && flask init-db $$DB_TYPE && flask run -h 0.0.0.0 -p 5000"
environment:
- DDS_VERSION=local-dev
- DDS_APP_CONFIG=/code/dds_web/sensitive/dds_app.cfg
- FLASK_ENV=development
- FLASK_APP=dds_web
Expand Down

0 comments on commit b065a03

Please sign in to comment.