diff --git a/authentik/outposts/api/outposts.py b/authentik/outposts/api/outposts.py index de8852d3e..7ba2b7563 100644 --- a/authentik/outposts/api/outposts.py +++ b/authentik/outposts/api/outposts.py @@ -1,4 +1,6 @@ """Outpost API Views""" +from os import environ + from dacite.core import from_dict from dacite.exceptions import DaciteError from django_filters.filters import ModelMultipleChoiceFilter @@ -12,6 +14,7 @@ from rest_framework.response import Response from rest_framework.serializers import JSONField, ModelSerializer, ValidationError from rest_framework.viewsets import ModelViewSet +from authentik import ENV_GIT_HASH_KEY from authentik.core.api.providers import ProviderSerializer from authentik.core.api.used_by import UsedByMixin from authentik.core.api.utils import PassiveSerializer, is_dict @@ -98,8 +101,12 @@ class OutpostHealthSerializer(PassiveSerializer): last_seen = DateTimeField(read_only=True) version = CharField(read_only=True) version_should = CharField(read_only=True) + version_outdated = BooleanField(read_only=True) + build_hash = CharField(read_only=True, required=False) + build_hash_should = CharField(read_only=True, required=False) + class OutpostFilter(FilterSet): """Filter for Outposts""" @@ -146,6 +153,8 @@ class OutpostViewSet(UsedByMixin, ModelViewSet): "version": state.version, "version_should": state.version_should, "version_outdated": state.version_outdated, + "build_hash": state.build_hash, + "build_hash_should": environ.get(ENV_GIT_HASH_KEY, ""), } ) return Response(OutpostHealthSerializer(states, many=True).data) diff --git a/schema.yml b/schema.yml index 6c23ce225..e48e8fe8c 100644 --- a/schema.yml +++ b/schema.yml @@ -23525,7 +23525,15 @@ components: version_outdated: type: boolean readOnly: true + build_hash: + type: string + readOnly: true + build_hash_should: + type: string + readOnly: true required: + - build_hash + - build_hash_should - last_seen - version - version_outdated diff --git a/web/src/pages/outposts/OutpostHealth.ts b/web/src/pages/outposts/OutpostHealth.ts index 7568951f5..07313dc17 100644 --- a/web/src/pages/outposts/OutpostHealth.ts +++ b/web/src/pages/outposts/OutpostHealth.ts @@ -32,6 +32,13 @@ export class OutpostHealthElement extends LitElement { if (!this.outpostHealth) { return html``; } + let versionString = this.outpostHealth.version; + if (this.outpostHealth.buildHash) { + versionString = `${versionString} (build ${this.outpostHealth.buildHash.substring( + 0, + 8, + )})`; + } return html` `;