admin: include git build hash in gh-* tags and show build hash in admin overview
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
a9339589bb
commit
07ca82e599
|
@ -15,6 +15,9 @@ WORKDIR /
|
||||||
COPY --from=locker /app/requirements.txt /
|
COPY --from=locker /app/requirements.txt /
|
||||||
COPY --from=locker /app/requirements-dev.txt /
|
COPY --from=locker /app/requirements-dev.txt /
|
||||||
|
|
||||||
|
ARG GIT_BUILD_HASH
|
||||||
|
ENV GIT_BUILD_HASH=$GIT_BUILD_HASH
|
||||||
|
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y --no-install-recommends curl ca-certificates gnupg && \
|
apt-get install -y --no-install-recommends curl ca-certificates gnupg && \
|
||||||
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
|
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
"""authentik"""
|
"""authentik"""
|
||||||
__version__ = "2021.3.3"
|
__version__ = "2021.3.3"
|
||||||
|
ENV_GIT_HASH_KEY = "GIT_BUILD_HASH"
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
"""authentik administration overview"""
|
"""authentik administration overview"""
|
||||||
|
from os import environ
|
||||||
|
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
from django.db.models import Model
|
from django.db.models import Model
|
||||||
from drf_yasg2.utils import swagger_auto_schema
|
from drf_yasg2.utils import swagger_auto_schema
|
||||||
|
@ -11,7 +13,7 @@ from rest_framework.response import Response
|
||||||
from rest_framework.serializers import Serializer
|
from rest_framework.serializers import Serializer
|
||||||
from rest_framework.viewsets import GenericViewSet
|
from rest_framework.viewsets import GenericViewSet
|
||||||
|
|
||||||
from authentik import __version__
|
from authentik import ENV_GIT_HASH_KEY, __version__
|
||||||
from authentik.admin.tasks import VERSION_CACHE_KEY, update_latest_version
|
from authentik.admin.tasks import VERSION_CACHE_KEY, update_latest_version
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,8 +22,13 @@ class VersionSerializer(Serializer):
|
||||||
|
|
||||||
version_current = SerializerMethodField()
|
version_current = SerializerMethodField()
|
||||||
version_latest = SerializerMethodField()
|
version_latest = SerializerMethodField()
|
||||||
|
build_hash = SerializerMethodField()
|
||||||
outdated = SerializerMethodField()
|
outdated = SerializerMethodField()
|
||||||
|
|
||||||
|
def get_build_hash(self, _) -> str:
|
||||||
|
"""Get build hash, if version is not latest or released"""
|
||||||
|
return environ.get(ENV_GIT_HASH_KEY, "")
|
||||||
|
|
||||||
def get_version_current(self, _) -> str:
|
def get_version_current(self, _) -> str:
|
||||||
"""Get current version"""
|
"""Get current version"""
|
||||||
return __version__
|
return __version__
|
||||||
|
|
|
@ -24,7 +24,7 @@ from sentry_sdk.integrations.celery import CeleryIntegration
|
||||||
from sentry_sdk.integrations.django import DjangoIntegration
|
from sentry_sdk.integrations.django import DjangoIntegration
|
||||||
from sentry_sdk.integrations.redis import RedisIntegration
|
from sentry_sdk.integrations.redis import RedisIntegration
|
||||||
|
|
||||||
from authentik import __version__
|
from authentik import ENV_GIT_HASH_KEY, __version__
|
||||||
from authentik.core.middleware import structlog_add_request_id
|
from authentik.core.middleware import structlog_add_request_id
|
||||||
from authentik.lib.config import CONFIG
|
from authentik.lib.config import CONFIG
|
||||||
from authentik.lib.logging import add_process_id
|
from authentik.lib.logging import add_process_id
|
||||||
|
@ -474,6 +474,7 @@ for _app in INSTALLED_APPS:
|
||||||
|
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
CELERY_TASK_ALWAYS_EAGER = True
|
CELERY_TASK_ALWAYS_EAGER = True
|
||||||
|
os.environ[ENV_GIT_HASH_KEY] = "dev"
|
||||||
|
|
||||||
INSTALLED_APPS.append("authentik.core.apps.AuthentikCoreConfig")
|
INSTALLED_APPS.append("authentik.core.apps.AuthentikCoreConfig")
|
||||||
|
|
||||||
|
|
|
@ -381,6 +381,13 @@ stages:
|
||||||
inputs:
|
inputs:
|
||||||
containerRegistry: 'beryjuorg-harbor'
|
containerRegistry: 'beryjuorg-harbor'
|
||||||
repository: 'authentik/server'
|
repository: 'authentik/server'
|
||||||
command: 'buildAndPush'
|
command: 'build'
|
||||||
Dockerfile: 'Dockerfile'
|
Dockerfile: 'Dockerfile'
|
||||||
tags: "gh-$(branchName)"
|
tags: 'gh-$(branchName)'
|
||||||
|
arguments: '--build-arg GIT_BUILD_HASH=$(git rev-parse HEAD)'
|
||||||
|
- task: Docker@2
|
||||||
|
inputs:
|
||||||
|
containerRegistry: 'beryjuorg-harbor'
|
||||||
|
repository: 'authentik/server'
|
||||||
|
command: 'push'
|
||||||
|
tags: 'gh-$(branchName)'
|
||||||
|
|
|
@ -10106,6 +10106,10 @@ definitions:
|
||||||
title: Version latest
|
title: Version latest
|
||||||
type: string
|
type: string
|
||||||
readOnly: true
|
readOnly: true
|
||||||
|
build_hash:
|
||||||
|
title: Build hash
|
||||||
|
type: string
|
||||||
|
readOnly: true
|
||||||
outdated:
|
outdated:
|
||||||
title: Outdated
|
title: Outdated
|
||||||
type: boolean
|
type: boolean
|
||||||
|
|
|
@ -2,3 +2,4 @@ apis/**
|
||||||
models/**
|
models/**
|
||||||
index.ts
|
index.ts
|
||||||
runtime.ts
|
runtime.ts
|
||||||
|
.openapi-generator/**
|
||||||
|
|
|
@ -1,167 +0,0 @@
|
||||||
apis/AdminApi.ts
|
|
||||||
apis/CoreApi.ts
|
|
||||||
apis/CryptoApi.ts
|
|
||||||
apis/EventsApi.ts
|
|
||||||
apis/FlowsApi.ts
|
|
||||||
apis/OutpostsApi.ts
|
|
||||||
apis/PoliciesApi.ts
|
|
||||||
apis/PropertymappingsApi.ts
|
|
||||||
apis/ProvidersApi.ts
|
|
||||||
apis/RootApi.ts
|
|
||||||
apis/SourcesApi.ts
|
|
||||||
apis/StagesApi.ts
|
|
||||||
apis/index.ts
|
|
||||||
index.ts
|
|
||||||
models/Application.ts
|
|
||||||
models/AuthenticateWebAuthnStage.ts
|
|
||||||
models/AuthenticatorStaticStage.ts
|
|
||||||
models/AuthenticatorTOTPStage.ts
|
|
||||||
models/AuthenticatorValidateStage.ts
|
|
||||||
models/Cache.ts
|
|
||||||
models/CaptchaStage.ts
|
|
||||||
models/CertificateData.ts
|
|
||||||
models/CertificateKeyPair.ts
|
|
||||||
models/Challenge.ts
|
|
||||||
models/Config.ts
|
|
||||||
models/ConsentStage.ts
|
|
||||||
models/Coordinate.ts
|
|
||||||
models/DenyStage.ts
|
|
||||||
models/DockerServiceConnection.ts
|
|
||||||
models/DummyPolicy.ts
|
|
||||||
models/DummyStage.ts
|
|
||||||
models/EmailStage.ts
|
|
||||||
models/ErrorDetail.ts
|
|
||||||
models/Event.ts
|
|
||||||
models/EventMatcherPolicy.ts
|
|
||||||
models/EventTopPerUser.ts
|
|
||||||
models/ExpressionPolicy.ts
|
|
||||||
models/Flow.ts
|
|
||||||
models/FlowDiagram.ts
|
|
||||||
models/FlowStageBinding.ts
|
|
||||||
models/Group.ts
|
|
||||||
models/GroupMembershipPolicy.ts
|
|
||||||
models/HaveIBeenPwendPolicy.ts
|
|
||||||
models/IPReputation.ts
|
|
||||||
models/IdentificationStage.ts
|
|
||||||
models/InlineResponse200.ts
|
|
||||||
models/InlineResponse2001.ts
|
|
||||||
models/InlineResponse20010.ts
|
|
||||||
models/InlineResponse20011.ts
|
|
||||||
models/InlineResponse20012.ts
|
|
||||||
models/InlineResponse20013.ts
|
|
||||||
models/InlineResponse20014.ts
|
|
||||||
models/InlineResponse20015.ts
|
|
||||||
models/InlineResponse20016.ts
|
|
||||||
models/InlineResponse20017.ts
|
|
||||||
models/InlineResponse20018.ts
|
|
||||||
models/InlineResponse20019.ts
|
|
||||||
models/InlineResponse2002.ts
|
|
||||||
models/InlineResponse20020.ts
|
|
||||||
models/InlineResponse20021.ts
|
|
||||||
models/InlineResponse20022.ts
|
|
||||||
models/InlineResponse20023.ts
|
|
||||||
models/InlineResponse20024.ts
|
|
||||||
models/InlineResponse20025.ts
|
|
||||||
models/InlineResponse20026.ts
|
|
||||||
models/InlineResponse20027.ts
|
|
||||||
models/InlineResponse20028.ts
|
|
||||||
models/InlineResponse20029.ts
|
|
||||||
models/InlineResponse2003.ts
|
|
||||||
models/InlineResponse20030.ts
|
|
||||||
models/InlineResponse20031.ts
|
|
||||||
models/InlineResponse20032.ts
|
|
||||||
models/InlineResponse20033.ts
|
|
||||||
models/InlineResponse20034.ts
|
|
||||||
models/InlineResponse20035.ts
|
|
||||||
models/InlineResponse20036.ts
|
|
||||||
models/InlineResponse20037.ts
|
|
||||||
models/InlineResponse20038.ts
|
|
||||||
models/InlineResponse20039.ts
|
|
||||||
models/InlineResponse2004.ts
|
|
||||||
models/InlineResponse20040.ts
|
|
||||||
models/InlineResponse20041.ts
|
|
||||||
models/InlineResponse20042.ts
|
|
||||||
models/InlineResponse20043.ts
|
|
||||||
models/InlineResponse20044.ts
|
|
||||||
models/InlineResponse20045.ts
|
|
||||||
models/InlineResponse20046.ts
|
|
||||||
models/InlineResponse20047.ts
|
|
||||||
models/InlineResponse20048.ts
|
|
||||||
models/InlineResponse20049.ts
|
|
||||||
models/InlineResponse2005.ts
|
|
||||||
models/InlineResponse20050.ts
|
|
||||||
models/InlineResponse20051.ts
|
|
||||||
models/InlineResponse20052.ts
|
|
||||||
models/InlineResponse20053.ts
|
|
||||||
models/InlineResponse20054.ts
|
|
||||||
models/InlineResponse20055.ts
|
|
||||||
models/InlineResponse20056.ts
|
|
||||||
models/InlineResponse20057.ts
|
|
||||||
models/InlineResponse20058.ts
|
|
||||||
models/InlineResponse20059.ts
|
|
||||||
models/InlineResponse2006.ts
|
|
||||||
models/InlineResponse20060.ts
|
|
||||||
models/InlineResponse2007.ts
|
|
||||||
models/InlineResponse2008.ts
|
|
||||||
models/InlineResponse2009.ts
|
|
||||||
models/InlineResponse200Pagination.ts
|
|
||||||
models/Invitation.ts
|
|
||||||
models/InvitationStage.ts
|
|
||||||
models/KubernetesServiceConnection.ts
|
|
||||||
models/LDAPPropertyMapping.ts
|
|
||||||
models/LDAPSource.ts
|
|
||||||
models/LDAPSourceSyncStatus.ts
|
|
||||||
models/LoginMetrics.ts
|
|
||||||
models/Notification.ts
|
|
||||||
models/NotificationRule.ts
|
|
||||||
models/NotificationRuleGroup.ts
|
|
||||||
models/NotificationRuleGroupParent.ts
|
|
||||||
models/NotificationRuleTransports.ts
|
|
||||||
models/NotificationTransport.ts
|
|
||||||
models/NotificationTransportTest.ts
|
|
||||||
models/OAuth2Provider.ts
|
|
||||||
models/OAuth2ProviderSetupURLs.ts
|
|
||||||
models/OAuthSource.ts
|
|
||||||
models/OpenIDConnectConfiguration.ts
|
|
||||||
models/Outpost.ts
|
|
||||||
models/OutpostHealth.ts
|
|
||||||
models/PasswordExpiryPolicy.ts
|
|
||||||
models/PasswordPolicy.ts
|
|
||||||
models/PasswordStage.ts
|
|
||||||
models/Policy.ts
|
|
||||||
models/PolicyBinding.ts
|
|
||||||
models/PolicyBindingPolicy.ts
|
|
||||||
models/PolicyBindingUser.ts
|
|
||||||
models/PolicyBindingUserAkGroups.ts
|
|
||||||
models/PolicyBindingUserGroups.ts
|
|
||||||
models/PolicyBindingUserSources.ts
|
|
||||||
models/PolicyBindingUserUserPermissions.ts
|
|
||||||
models/Prompt.ts
|
|
||||||
models/PromptStage.ts
|
|
||||||
models/PropertyMapping.ts
|
|
||||||
models/Provider.ts
|
|
||||||
models/ProxyOutpostConfig.ts
|
|
||||||
models/ProxyProvider.ts
|
|
||||||
models/ReputationPolicy.ts
|
|
||||||
models/SAMLMetadata.ts
|
|
||||||
models/SAMLPropertyMapping.ts
|
|
||||||
models/SAMLProvider.ts
|
|
||||||
models/SAMLSource.ts
|
|
||||||
models/ScopeMapping.ts
|
|
||||||
models/ServiceConnection.ts
|
|
||||||
models/ServiceConnectionState.ts
|
|
||||||
models/Source.ts
|
|
||||||
models/Stage.ts
|
|
||||||
models/Task.ts
|
|
||||||
models/Token.ts
|
|
||||||
models/TokenView.ts
|
|
||||||
models/TypeCreate.ts
|
|
||||||
models/User.ts
|
|
||||||
models/UserDeleteStage.ts
|
|
||||||
models/UserLoginStage.ts
|
|
||||||
models/UserLogoutStage.ts
|
|
||||||
models/UserReputation.ts
|
|
||||||
models/UserWriteStage.ts
|
|
||||||
models/Version.ts
|
|
||||||
models/index.ts
|
|
||||||
runtime.ts
|
|
|
@ -1 +0,0 @@
|
||||||
5.1.0-SNAPSHOT
|
|
|
@ -12,17 +12,22 @@ export class VersionStatusCard extends AdminStatusCard<Version> {
|
||||||
}
|
}
|
||||||
|
|
||||||
getStatus(value: Version): Promise<AdminStatus> {
|
getStatus(value: Version): Promise<AdminStatus> {
|
||||||
|
if (value.buildHash) {
|
||||||
|
return Promise.resolve<AdminStatus>({
|
||||||
|
icon: "fa fa-check-circle pf-m-success",
|
||||||
|
message: gettext(`Build hash: ${value.buildHash?.substring(0, 10)}`),
|
||||||
|
});
|
||||||
|
}
|
||||||
if (value.outdated) {
|
if (value.outdated) {
|
||||||
return Promise.resolve<AdminStatus>({
|
return Promise.resolve<AdminStatus>({
|
||||||
icon: "fa fa-exclamation-triangle pf-m-warning",
|
icon: "fa fa-exclamation-triangle pf-m-warning",
|
||||||
message: gettext(`${value.versionLatest} is available!`),
|
message: gettext(`${value.versionLatest} is available!`),
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
return Promise.resolve<AdminStatus>({
|
|
||||||
icon: "fa fa-check-circle pf-m-success",
|
|
||||||
message: gettext("Up-to-date!")
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
return Promise.resolve<AdminStatus>({
|
||||||
|
icon: "fa fa-check-circle pf-m-success",
|
||||||
|
message: gettext("Up-to-date!")
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
renderValue(): TemplateResult {
|
renderValue(): TemplateResult {
|
||||||
|
|
Reference in New Issue