diff --git a/Jenkinsfile b/Jenkinsfile index d34ba477bb5c3fdfef948b45d1de4a044451a1fa..30d21c16296ea6b50cdef5f425e871e341b12398 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -437,7 +437,7 @@ Void setNewGitopsVersion(String environment) { envFile = "${environment}/application/values/alfa-client-values.yaml" commitMessage = "jenkins rollout ${environment} alfa-client version ${IMAGE_TAG}"; - setNewGitopsVersion(envFile, commitMessage); + setNewAlfaClientGitopsVersion(envFile, commitMessage); } Void setNewBarrierefreiheitVersion() { @@ -462,6 +462,22 @@ Void setNewGitopsVersion(String envFile, String commitMessage) { } } +Void setNewAlfaClientGitopsVersion(String envFile, String commitMessage) { + dir("gitops") { + def envVersions = readYaml file: envFile + + envVersions.alfa_client.image.tag = IMAGE_TAG + envVersions.alfa_client.helm.version = HELM_CHART_VERSION + + writeYaml file: envFile, data: envVersions, overwrite: true + + if (hasValuesFileChanged(envFile)) { + sh "git add ${envFile}" + sh "git commit -m '${commitMessage}'" + } + } +} + String getCommitHash() { return "-${env.GIT_COMMIT.take(7)}"; } diff --git a/alfa-client/src/main/helm/templates/ingress.yaml b/alfa-client/src/main/helm/templates/ingress.yaml index a0ef0c25111454191b1ad086644cfbc6d28f5ed7..9a5842145f6b0e6232ee7db43adf91c745dfa630 100644 --- a/alfa-client/src/main/helm/templates/ingress.yaml +++ b/alfa-client/src/main/helm/templates/ingress.yaml @@ -14,7 +14,7 @@ metadata: cert-manager.io/cluster-issuer: letsencrypt-prod {{- end }} spec: - {{- if and (.Values.ingress).className (ne (.Values).cluster_env "dataport") }} + {{- if (.Values.ingress).className }} ingressClassName: {{ .Values.ingress.className }} {{- end }} rules: @@ -42,6 +42,6 @@ spec: - {{ include "app.baseDomain" . }} {{- if (.Values.ingress).tlsSecretName }} secretName: {{ (.Values.ingress).tlsSecretName }} - {{- else if ne (.Values).cluster_env "dataport" }} + {{- else }} secretName: {{ .Values.ozgcloud.bezeichner }}-{{ .Release.Name }}-tls {{- end }} \ No newline at end of file diff --git a/alfa-client/src/test/helm/deployment_imagepull_secret_test.yaml b/alfa-client/src/test/helm/deployment_imagepull_secret_test.yaml index 8b97639531973271d9f401221eeff1a8aba6cc95..96e8e2b6e5bf8d735102854d8a1cc4195c5710de 100644 --- a/alfa-client/src/test/helm/deployment_imagepull_secret_test.yaml +++ b/alfa-client/src/test/helm/deployment_imagepull_secret_test.yaml @@ -28,12 +28,17 @@ release: namespace: sh-helm-test templates: - templates/deployment.yaml -set: - imagePullSecret: test-image-secret + tests: - it: should use correct imagePull secret + set: + imagePullSecret: test-image-secret asserts: - equal: path: spec.template.spec.imagePullSecrets[0].name - value: test-image-secret \ No newline at end of file + value: test-image-secret + - it: should fail template when image pull secret not set + asserts: + - failedTemplate: + errormessage: imagePullSecret must be set \ No newline at end of file diff --git a/alfa-client/src/test/helm/ingress_tests.yaml b/alfa-client/src/test/helm/ingress_tests.yaml index dc474ff834df7ad7dc4c0fc4305e80dcbd501a2f..54877a33b13ddcac2105448505cf30df9cf21e0f 100644 --- a/alfa-client/src/test/helm/ingress_tests.yaml +++ b/alfa-client/src/test/helm/ingress_tests.yaml @@ -38,20 +38,33 @@ tests: asserts: - isKind: of: Ingress - - it: should create ingress tls + - it: should create default ingress tls asserts: - equal: path: spec.tls[0].secretName value: helm-alfa-client-tls + - it: should set ingress tls + set: + ingress: + tlsSecretName: client-tls + asserts: + - equal: + path: spec.tls[0].secretName + value: client-tls - - it: should not create ingress tls/ingressClass - set: - cluster_env: dataport + - it: should not create ingress tls/ingressClass by default asserts: - isNull: path: spec.ingressClassName - - isNull: - path: spec.tls[0].secretName + - it: should set ingress tls/ingressClass + set: + ingress: + className: ingress + asserts: + - equal: + path: spec.ingressClassName + value: ingress + - it: should use default letsencrypt-prod cluster-issuer asserts: