Skip to content
Snippets Groups Projects
Verified Commit a2c4e1b5 authored by Sebastian Bergandy's avatar Sebastian Bergandy :keyboard:
Browse files

Merge branch 'main' into OZG-7473-save-statistic-fields

parents a4cb72a7 b7711221
Branches
Tags
1 merge request!104Administration: Neu hinzugefügte Felder für Statistik speichern
Showing
with 89 additions and 108 deletions
......@@ -462,7 +462,7 @@ Void initEnvAdminDefaultVersions() {
env.ADMINISTRATION_HELM_CHART_VERSION = getHelmChartVersion(values)
env.ADMINISTRATION_HELM_REPO_URL = getHelmRepoUrl()
values = getApplicationValues('admin-client')
values = getApplicationValues('administration-client')
env.ADMIN_CLIENT_IMAGE_TAG = getImageTag(values)
env.ADMIN_CLIENT_HELM_CHART_VERSION = getHelmChartVersion(values)
env.ADMIN_CLIENT_HELM_REPO_URL = getHelmRepoUrl()
......@@ -565,8 +565,8 @@ Void generateAdminNamespaceYaml() {
envValues.administration.put("helm", ['version': env.ADMINISTRATION_HELM_CHART_VERSION, 'repoUrl': env.ADMINISTRATION_HELM_REPO_URL])
envValues.administration.put("ozgcloud", ['feature': ['organisationsEinheiten': "true"], 'organisationEinheit': ['zufiSearchUri': generateZufiSearchUri(bezeichner)]])
envValues.admin_client.put("image", ['tag': env.ADMIN_CLIENT_IMAGE_TAG])
envValues.admin_client.put("helm", ['version': env.ADMIN_CLIENT_HELM_CHART_VERSION, 'repoUrl': env.ADMIN_CLIENT_HELM_REPO_URL])
envValues.administration_client.put("image", ['tag': env.ADMIN_CLIENT_IMAGE_TAG])
envValues.administration_client.put("helm", ['version': env.ADMIN_CLIENT_HELM_CHART_VERSION, 'repoUrl': env.ADMIN_CLIENT_HELM_REPO_URL])
}
return writeYamlToGitOps(bezeichner, envValues);
}
......@@ -657,7 +657,7 @@ Void waitForAlfaRollout(ozgCloudBezeichner) {
Void waitForAdminRollout(String bezeichner) {
waitForAlfaRollout([bezeichner])
waitForHealthyApplication(bezeichner, 'administration')
waitForHealthyApplication(bezeichner, 'admin-client')
waitForHealthyApplication(bezeichner, 'administration-client')
}
Void waitForAlfaRollout(String bezeichner) {
......
......@@ -87,7 +87,7 @@ alfa_client:
ingress:
use_staging_cert: true
admin_client:
administration_client:
enabled: true
ingress:
use_staging_cert: true
......
......@@ -50,7 +50,7 @@ pipeline {
steps {
script {
FAILED_STAGE = env.STAGE_NAME
VERSION = getAdminPackageJsonVersion()
VERSION = getPackageJsonVersion()
if(isReleaseBranch()){
if ( !isReleaseVersion([VERSION]) ) {
......@@ -65,7 +65,7 @@ pipeline {
}
}
stage('Build admin client and its docker image') {
stage('Build administration client and its docker image') {
steps {
script {
FAILED_STAGE=env.STAGE_NAME
......@@ -75,9 +75,9 @@ pipeline {
sh 'pnpm install --frozen-lockfile'
if (isReleaseBranch()) {
sh 'pnpm run ci-prodBuild-admin'
sh 'pnpm run ci-prodBuild-administration'
} else {
sh 'pnpm run ci-build-admin'
sh 'pnpm run ci-build-administration'
}
if (isMainBranch()) {
withSonarQubeEnv('sonarqube-ozg-sh'){
......@@ -148,7 +148,7 @@ pipeline {
stage('Trigger Test rollout') {
when {
branch 'release-admin'
branch 'release-administration'
}
steps {
script {
......@@ -176,7 +176,7 @@ pipeline {
Boolean isReleaseBranch() {
return env.BRANCH_NAME == 'release-admin'
return env.BRANCH_NAME == 'release-administration'
}
def validateBranchName(branchName) {
......@@ -224,24 +224,24 @@ Void setNewTestVersion() {
Void setNewGitopsVersion(String environment) {
dir("gitops") {
def envFile = "${environment}/application/values/admin-client-values.yaml"
def envFile = "${environment}/application/values/administration-client-values.yaml"
def envVersions = readYaml file: envFile
envVersions.admin_client.image.tag = IMAGE_TAG
envVersions.admin_client.helm.version = HELM_CHART_VERSION
envVersions.administration_client.image.tag = IMAGE_TAG
envVersions.administration_client.helm.version = HELM_CHART_VERSION
writeYaml file: envFile, data: envVersions, overwrite: true
if (hasValuesFileChanged(environment)) {
sh "git add ${envFile}"
sh "git commit -m 'jenkins rollout ${environment} admin_client version ${IMAGE_TAG}'"
sh "git commit -m 'jenkins rollout ${environment} administration_client version ${IMAGE_TAG}'"
}
}
}
Boolean hasValuesFileChanged(String environment) {
return sh (script: "git status | grep '${environment}/application/values/admin-client-values.yaml'", returnStatus: true) == env.SH_SUCCESS_STATUS_CODE as Integer
return sh (script: "git status | grep '${environment}/application/values/administration-client-values.yaml'", returnStatus: true) == env.SH_SUCCESS_STATUS_CODE as Integer
}
......@@ -263,11 +263,11 @@ Void tagAndPushDockerImage(String newTag){
withCredentials([usernamePassword(credentialsId: 'jenkins-nexus-login', usernameVariable: 'USER', passwordVariable: 'PASSWORD')]) {
sh 'docker login docker.ozg-sh.de -u ${USER} -p ${PASSWORD}'
sh "docker tag docker.ozg-sh.de/admin-client:build-latest docker.ozg-sh.de/admin-client:${newTag}"
sh "docker push docker.ozg-sh.de/admin-client:${newTag}"
sh "docker tag docker.ozg-sh.de/administration-client:build-latest docker.ozg-sh.de/administration-client:${newTag}"
sh "docker push docker.ozg-sh.de/administration-client:${newTag}"
}
}
String getAdminPackageJsonVersion() {
String getPackageJsonVersion() {
def packageJSON = readJSON file: 'alfa-client/apps/admin/package.json'
def packageJSONVersion = packageJSON.version
echo packageJSONVersion
......@@ -277,10 +277,10 @@ String getAdminPackageJsonVersion() {
Void deployHelmChart(String helmChartVersion) {
withCredentials([usernamePassword(credentialsId: 'jenkins-nexus-login', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]){
if (isReleaseBranch()) {
result = sh script: '''curl -u $USERNAME:$PASSWORD https://nexus.ozg-sh.de/service/rest/v1/components?repository=ozg-base-apps -F file=@admin-client-'''+helmChartVersion+'''.tgz''', returnStdout: true
result = sh script: '''curl -u $USERNAME:$PASSWORD https://nexus.ozg-sh.de/service/rest/v1/components?repository=ozg-base-apps -F file=@administration-client-'''+helmChartVersion+'''.tgz''', returnStdout: true
}
else {
result = sh script: '''curl -u $USERNAME:$PASSWORD https://nexus.ozg-sh.de/service/rest/v1/components?repository=ozg-base-apps-snapshot -F file=@admin-client-'''+helmChartVersion+'''.tgz''', returnStdout: true
result = sh script: '''curl -u $USERNAME:$PASSWORD https://nexus.ozg-sh.de/service/rest/v1/components?repository=ozg-base-apps-snapshot -F file=@administration-client-'''+helmChartVersion+'''.tgz''', returnStdout: true
}
if (result != '') {
......@@ -296,9 +296,9 @@ Boolean isMainBranch() {
Void sendFailureMessage() {
def room = ''
def data = """{"msgtype":"m.text", \
"body":"Admin-Client: Build Failed. Stage: ${FAILED_STAGE} Build-ID: ${env.BUILD_NUMBER} Link: ${JENKINS_URL}", \
"body":"Administration-Client: Build Failed. Stage: ${FAILED_STAGE} Build-ID: ${env.BUILD_NUMBER} Link: ${JENKINS_URL}", \
"format": "org.matrix.custom.html", \
"formatted_body":"Admin-Client: Build Failed. Stage: ${FAILED_STAGE} Build-ID: <a href='${JENKINS_URL}'>${env.BUILD_NUMBER}</a>"}"""
"formatted_body":"Administration-Client: Build Failed. Stage: ${FAILED_STAGE} Build-ID: <a href='${JENKINS_URL}'>${env.BUILD_NUMBER}</a>"}"""
if (isMainBranch()) {
room = "!iQPAvQIiRwRpNOszjw:matrix.ozg-sh.de"
......
......@@ -15,10 +15,7 @@
"main": "apps/admin/src/main.ts",
"polyfills": ["zone.js"],
"tsConfig": "apps/admin/tsconfig.app.json",
"allowedCommonJsDependencies": [
"sanitize-filename-ts",
"jsrsasign"
],
"allowedCommonJsDependencies": ["sanitize-filename-ts", "jsrsasign"],
"assets": [
"apps/admin/src/assets",
{
......@@ -112,7 +109,7 @@
"engine": "docker",
"push": false,
"metadata": {
"images": ["docker.ozg-sh.de/admin-client"],
"images": ["docker.ozg-sh.de/administration-client"],
"load": true,
"tags": ["build-latest"]
}
......
......@@ -24,7 +24,7 @@
apiVersion: v1
appVersion: '1.0'
description: A Helm chart for Admin Client
name: admin-client
description: A Helm chart for Administration Client
name: administration-client
version: 0.0.0-MANAGED-BY-JENKINS
icon: https://simpleicons.org/icons/helm.svg
......@@ -51,7 +51,7 @@
{{/* Default Labels: Helm recommended best-practice labels https://helm.sh/docs/chart_best_practices/labels/ */}}
{{- define "app.defaultLabels" }}
app.kubernetes.io/instance: admin-client
app.kubernetes.io/instance: administration-client
app.kubernetes.io/managed-by: {{ include "app.managedBy" . }}
app.kubernetes.io/name: {{ .Release.Name }}
app.kubernetes.io/namespace: {{ include "app.namespace" . }}
......@@ -80,12 +80,12 @@ app.kubernetes.io/namespace: {{ include "app.namespace" . }}
{{- define "app.serviceAccountName" -}}
{{ printf "%s" ( (.Values.serviceAccount).name | default "admin-client-service-account" ) }}
{{ printf "%s" ( (.Values.serviceAccount).name | default "administration-client-service-account" ) }}
{{- end -}}
{{- define "app.baseDomain" -}}
{{- printf "%s-%s.%s" (include "app.ozgcloudBezeichner" . ) (.Values.ozgcloud).adminDomainSuffix (include "app.baseUrl" . ) }}
{{- printf "%s-%s.%s" (include "app.ozgcloudBezeichner" . ) (.Values.ozgcloud).administrationDomainSuffix (include "app.baseUrl" . ) }}
{{- end -}}
{{- define "app.ozgcloudBezeichner" -}}
......
......@@ -45,7 +45,7 @@ spec:
metadata:
labels:
{{- include "app.defaultLabels" . | indent 8 }}
component: admin-client
component: administration-client
spec:
{{- if (.Values.serviceAccount).create }}
serviceAccountName: {{ include "app.serviceAccountName" . }}
......@@ -69,7 +69,7 @@ spec:
image: "{{ .Values.image.repo }}/{{ .Values.image.name }}:{{ coalesce (.Values.image).tag "latest" }}"
imagePullPolicy: Always
name: admin-client
name: administration-client
startupProbe:
httpGet:
......
......@@ -55,7 +55,7 @@ spec:
pathType: Prefix
backend:
service:
name: admin-client
name: administration-client
port:
number: 8080
......
......@@ -26,7 +26,7 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: network-policy-admin-client
name: network-policy-administration-client
namespace: {{ .Release.Namespace }}
spec:
podSelector:
......
......@@ -29,7 +29,7 @@ metadata:
namespace: {{ include "app.namespace" . }}
labels:
{{- include "app.defaultLabels" . | indent 4 }}
component: admin-client-service
component: administration-client-service
spec:
type: ClusterIP
ports:
......@@ -40,4 +40,4 @@ spec:
selector:
{{- include "app.matchLabels" . | indent 4 }}
component: admin-client
\ No newline at end of file
component: administration-client
\ No newline at end of file
......@@ -24,9 +24,9 @@
image:
repo: docker.ozg-sh.de
name: admin-client
name: administration-client
tag: 0.1.0 # [default: latest]
replicaCount: 1
ozgcloud:
adminDomainSuffix: admin
administrationDomainSuffix: administration
......@@ -24,7 +24,7 @@
suite: test deyploment less than 63 chars
release:
name: admin-client
name: administration-client
namespace: sh-helm-test
templates:
......@@ -49,7 +49,7 @@ tests:
version: 1.0-test1234567890123123456789012345678901234567890123456789012345678901234567890123456789012345678904567890
asserts:
- failedTemplate:
errorMessage: .Chart.Name-.Chart.Version admin-client-1.0-test1234567890123123456789012345678901234567890123456789012345678901234567890123456789012345678904567890 ist zu lang (max. 63 Zeichen)
errorMessage: .Chart.Name-.Chart.Version administration-client-1.0-test1234567890123123456789012345678901234567890123456789012345678901234567890123456789012345678904567890 ist zu lang (max. 63 Zeichen)
- it: should not fail on .Chart.Name-.Chart.Version length less than 63 characters
asserts:
- notFailedTemplate: {}
......@@ -24,7 +24,7 @@
suite: test deployment container basics
release:
name: admin-client
name: administration-client
namespace: sh-helm-test
templates:
- templates/deployment.yaml
......@@ -38,20 +38,10 @@ tests:
asserts:
- equal:
path: spec.template.spec.containers[0].image
value: docker.ozg-sh.de/admin-client:0.1.0
value: docker.ozg-sh.de/administration-client:0.1.0
- equal:
path: spec.template.spec.containers[0].name
value: admin-client
value: administration-client
- equal:
path: spec.template.spec.containers[0].imagePullPolicy
value: Always
#- it: should have correct values for container ports
# asserts:
# - contains:
# path: spec.template.spec.containers[0].ports
# content:
# containerPort: 8081
# name: metrics
# protocol: TCP
......@@ -22,7 +22,6 @@
# unter der Lizenz sind dem Lizenztext zu entnehmen.
#
#
# Copyright (C) 2022 Das Land Schleswig-Holstein vertreten durch den
# Ministerpräsidenten des Landes Schleswig-Holstein
......@@ -49,7 +48,7 @@
suite: test deployment container other values
release:
name: admin-client
name: administration-client
namespace: sh-helm-test
templates:
- templates/deployment.yaml
......
......@@ -24,7 +24,7 @@
suite: test deployment container security context
release:
name: admin-client
name: administration-client
namespace: sh-helm-test
templates:
- templates/deployment.yaml
......
......@@ -24,7 +24,7 @@
suite: test deployment default labels
release:
name: admin-client
name: administration-client
namespace: sh-helm-test
templates:
- templates/deployment.yaml
......@@ -39,33 +39,32 @@ tests:
- equal:
path: metadata.labels
value:
app.kubernetes.io/instance: admin-client
app.kubernetes.io/instance: administration-client
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: admin-client
app.kubernetes.io/name: administration-client
app.kubernetes.io/namespace: sh-helm-test
app.kubernetes.io/part-of: ozgcloud
app.kubernetes.io/version: 0.0.0-MANAGED-BY-JENKINS
helm.sh/chart: admin-client-0.0.0-MANAGED-BY-JENKINS
helm.sh/chart: administration-client-0.0.0-MANAGED-BY-JENKINS
- it: should set spec.selector.matchLabels
asserts:
- equal:
path: spec.selector.matchLabels
value:
app.kubernetes.io/name: admin-client
app.kubernetes.io/name: administration-client
app.kubernetes.io/namespace: sh-helm-test
- it: should have correct deyploment spec.template.metadata.labels
asserts:
- equal:
path: spec.template.metadata.labels
value:
app.kubernetes.io/instance: admin-client
app.kubernetes.io/instance: administration-client
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: admin-client
app.kubernetes.io/name: administration-client
app.kubernetes.io/namespace: sh-helm-test
app.kubernetes.io/part-of: ozgcloud
app.kubernetes.io/version: 0.0.0-MANAGED-BY-JENKINS
component: admin-client
helm.sh/chart: admin-client-0.0.0-MANAGED-BY-JENKINS
\ No newline at end of file
component: administration-client
helm.sh/chart: administration-client-0.0.0-MANAGED-BY-JENKINS
......@@ -24,7 +24,7 @@
suite: test deployment topology spread constrains
release:
name: admin-client
name: administration-client
namespace: sh-helm-test
templates:
- templates/deployment.yaml
......@@ -49,4 +49,4 @@ tests:
value: ScheduleAnyway
- equal:
path: spec.template.spec.topologySpreadConstraints[0].labelSelector.matchLabels["app.kubernetes.io/name"]
value: admin-client
\ No newline at end of file
value: administration-client
......@@ -24,7 +24,7 @@
suite: test deployment general values
release:
name: admin-client
name: administration-client
namespace: sh-helm-test
templates:
- templates/deployment.yaml
......@@ -33,25 +33,23 @@ set:
environment: dev
imagePullSecret: test-image-secret
tests:
- it: should have correct apiVersion
asserts:
- isKind:
of: Deployment
- isAPIVersion:
of: "apps/v1"
of: 'apps/v1'
- it: should have correct deployment metadata
asserts:
- equal:
path: metadata.name
value: admin-client
value: administration-client
- equal:
path: metadata.namespace
value: sh-helm-test
- it: should have correct deyployment general spec values
asserts:
- equal:
......@@ -72,5 +70,3 @@ tests:
maxSurge: 1
maxUnavailable: 0
type: RollingUpdate
......@@ -24,7 +24,7 @@
suite: deployment host aliases
release:
name: admin-client
name: administration-client
namespace: sh-helm-test
templates:
- templates/deployment.yaml
......@@ -40,15 +40,15 @@ tests:
- it: should set spec.template.spec.hostAliases
set:
hostAliases:
- ip: "127.0.0.1"
- ip: '127.0.0.1'
hostname:
- "eins"
- "zwei"
- 'eins'
- 'zwei'
asserts:
- contains:
path: spec.template.spec.hostAliases
content:
ip: "127.0.0.1"
ip: '127.0.0.1'
hostname:
- "eins"
- "zwei"
- 'eins'
- 'zwei'
......@@ -24,7 +24,7 @@
suite: test deployment image pull secret
release:
name: admin-client
name: administration-client
namespace: sh-helm-test
templates:
- templates/deployment.yaml
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment