feat: add build id from commit hash (#1095)

* fix old ref

* capture git commit as build ID

* generate new types

* display build on Site Settings page

* fix extras crash it extras is none
This commit is contained in:
Hayden 2022-03-24 20:29:01 -08:00 committed by GitHub
parent 7f102f513d
commit ffb3b45ac2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 21 additions and 16 deletions

View file

@ -47,6 +47,7 @@ jobs:
docker build --push --no-cache \
--tag hkotel/mealie:api-nightly \
--platform linux/amd64,linux/arm64 .
--build-arg COMMIT=$(git rev-parse HEAD) \
#
# Build Discord Notification
#

View file

@ -91,6 +91,9 @@ FROM python-base as production
ENV PRODUCTION=true
ENV TESTING=false
ARG COMMIT
ENV GIT_COMMIT_HASH=$COMMIT
# curl for used by healthcheck
RUN apt-get update \
&& apt-get install --no-install-recommends -y \

View file

@ -1,4 +1,5 @@
import { BaseAPI } from "../_base";
import { AdminAboutInfo } from "~/types/api-types/admin";
const prefix = "/api";
@ -8,17 +9,6 @@ const routes = {
check: `${prefix}/admin/about/check`,
};
export interface AdminAboutInfo {
production: boolean;
version: string;
demoStatus: boolean;
apiPort: number;
apiDocs: boolean;
dbType: string;
dbUrl: string;
defaultGroup: string;
versionLatest: string;
}
export interface AdminStatistics {
totalRecipes: number;

View file

@ -238,6 +238,11 @@ export default defineComponent({
icon: $globals.icons.information,
value: data.version,
},
{
name: "Build",
icon: $globals.icons.information,
value: data.buildId,
},
{
name: i18n.t("about.application-mode"),
icon: $globals.icons.devTo,

View file

@ -16,6 +16,7 @@ export interface AdminAboutInfo {
dbType: string;
dbUrl?: string;
defaultGroup: string;
buildId: string;
}
export interface AllBackups {
imports: BackupFile[];

View file

@ -13,9 +13,9 @@
import InputLabelType from "@/components/global/InputLabelType.vue";
import BaseStatCard from "@/components/global/BaseStatCard.vue";
import DevDumpJson from "@/components/global/DevDumpJson.vue";
import LanguageDialog from "@/components/global/LanguageDialog.vue";
import InputQuantity from "@/components/global/InputQuantity.vue";
import ToggleState from "@/components/global/ToggleState.vue";
import LanguageDialog from "~/components/global/LanguageDialog.vue";
import AppButtonCopy from "@/components/global/AppButtonCopy.vue";
import CrudTable from "@/components/global/CrudTable.vue";
import InputColor from "@/components/global/InputColor.vue";
@ -48,9 +48,9 @@ declare module "vue" {
InputLabelType: typeof InputLabelType;
BaseStatCard: typeof BaseStatCard;
DevDumpJson: typeof DevDumpJson;
LanguageDialog: typeof LanguageDialog;
InputQuantity: typeof InputQuantity;
ToggleState: typeof ToggleState;
LanguageDialog: typeof LanguageDialog;
AppButtonCopy: typeof AppButtonCopy;
CrudTable: typeof CrudTable;
InputColor: typeof InputColor;

View file

@ -55,7 +55,8 @@ setup-model: ## 🤖 Get the latest NLP CRF++ Model
@echo Fetching NLP Model - CRF++ is still Required
curl -L0 https://github.com/mealie-recipes/nlp-model/releases/download/v1.0.0/model.crfmodel --output ./mealie/services/parser_services/crfpp/model.crfmodel
clean-data: clean ## ⚠️ Removes All Developer Data for a fresh server start
clean-data: ## ⚠️ Removes All Developer Data for a fresh server start
rm -r ./dev/data/recipes/
rm -r ./dev/data/users/
rm -f ./dev/data/mealie*.db

View file

@ -32,6 +32,8 @@ class AppSettings(BaseSettings):
TOKEN_TIME: int = 48 # Time in Hours
SECRET: str
GIT_COMMIT_HASH: str = "unknown"
ALLOW_SIGNUP: bool = True
@property

View file

@ -31,8 +31,8 @@ def recipe_extras(func):
if extras is None:
extras = []
extras = [{"key": key, "value": value} for key, value in extras.items()]
else:
extras = [{"key": key, "value": value} for key, value in extras.items()]
return func(*args, extras=extras, **kwargs)

View file

@ -26,6 +26,7 @@ class AdminAboutController(BaseAdminController):
db_url=settings.DB_URL_PUBLIC,
default_group=settings.DEFAULT_GROUP,
allow_signup=settings.ALLOW_SIGNUP,
build_id=settings.GIT_COMMIT_HASH,
)
@router.get("/statistics", response_model=AppStatistics)

View file

@ -23,6 +23,7 @@ class AdminAboutInfo(AppInfo):
db_type: str
db_url: str | None
default_group: str
build_id: str
class CheckAppConfig(CamelModel):