Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add versioning info #470

Merged
merged 2 commits into from
Aug 8, 2024
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
16 changes: 10 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ RUN mkdir /app/rdwatch \
&& touch /app/rdwatch/smartflow/__init__.py \
&& touch /app/README.md \
&& poetry install --only main
RUN poetry self add poetry-dynamic-versioning@^1.4.0


# Build stage that also installs dev dependencies.
Expand All @@ -94,10 +95,13 @@ RUN mkdir /app/rdwatch \
&& touch /app/rdwatch/smartflow/__init__.py \
&& touch /app/README.md \
&& poetry install --with dev
RUN poetry self add poetry-dynamic-versioning@^1.4.0
# Copy git metadata to enable display of version information
RUN git config --global --add safe.directory /app/
COPY .git/ /app/.git/
COPY manage.py /app/manage.py
# Generate versioning info
RUN poetry dynamic-versioning


# Built static assets for vue-rdwatch
Expand All @@ -117,7 +121,12 @@ FROM django-builder AS django-dist
COPY rdwatch/ /app/rdwatch/
COPY manage.py /app/manage.py
RUN chmod -R u=rX,g=rX,o= .

# Copy git metadata to enable display of version information
COPY .git/ \
/app/.git/
RUN git config --global --add safe.directory /app
# Generate versioning info
RUN poetry dynamic-versioning

# Final image
FROM base
Expand All @@ -136,8 +145,3 @@ COPY --from=vue-dist \
--chown=unit:unit \
/app/vue/dist \
/app/vue/dist
# Copy git metadata to enable display of version information
COPY --chown=rdwatch:rdwatch \
.git/ \
/app/.git/
RUN git config --global --add safe.directory /app
2 changes: 2 additions & 0 deletions vue/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script setup lang="ts">
import { useRouter } from 'vue-router';
import { state } from './store';
import type { ServerStatus } from './client';

import { onBeforeMount, onErrorCaptured, ref } from "vue";

Expand All @@ -23,6 +24,7 @@ onBeforeMount(async () => {
return;
}
isLoggedIn.value = true;
state.appVersion = (json as ServerStatus).rdwatch_version;
} catch (e) {
if (import.meta.env.PROD) {
window.location.href = `/accounts/gitlab/login/?next=${window.location.pathname}`;
Expand Down
1 change: 1 addition & 0 deletions vue/src/client/models/ServerStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ export type ServerStatus = {
};
hostname: string;
ip: string;
rdwatch_version: string;
};
16 changes: 9 additions & 7 deletions vue/src/components/SideBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,15 @@ const satelliteLoadingColor = computed(() => {
dense
>
<ErrorPopup />
<img
height="50"
class="mx-auto pb-4"
src="../assets/logo.svg"
alt="Resonant GeoData"
draggable="false"
>
<div class="d-flex flex-column align-center mx-auto pb-4">
<img
height="38"
src="../assets/logo.svg"
alt="Resonant GeoData"
draggable="false"
>
<span class="text-caption">{{ state.appVersion }}</span>
</div>
</v-row>
<mode-selector />
<v-row>
Expand Down
2 changes: 2 additions & 0 deletions vue/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ export interface KeyedModelRun extends ModelRun {
}

export const state = reactive<{
appVersion: string;
errorText: string;
timestamp: number;
timeMin: number;
Expand Down Expand Up @@ -203,6 +204,7 @@ export const state = reactive<{
regionMap: RegionMapType;
regionList: RegionDetail[];
}>({
appVersion: '',
errorText: '',
timestamp: Math.floor(Date.now() / 1000),
timeMin: new Date(0).valueOf(),
Expand Down
Loading