From 276924fe8043f578afc1240b5303edd6ac3486b5 Mon Sep 17 00:00:00 2001 From: piomin Date: Tue, 10 Sep 2024 13:50:54 +0200 Subject: [PATCH] Fix empty 'lifecycle.preStop.exec.command' field, which results in deployment failure --- src/helm/blue-agent/templates/_helpers.tpl | 23 ++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/helm/blue-agent/templates/_helpers.tpl b/src/helm/blue-agent/templates/_helpers.tpl index 4aee7317..046fd9c2 100644 --- a/src/helm/blue-agent/templates/_helpers.tpl +++ b/src/helm/blue-agent/templates/_helpers.tpl @@ -141,31 +141,38 @@ containers: {{- toYaml (mustMergeOverwrite (include "blue-agent.defaultSecurityContext" . | fromYaml) .Values.securityContext) | nindent 6 }} image: "{{ .Values.image.repository | required "A value for .Values.image.repository is required" }}:{{ .Values.image.flavor | required "A value for .Values.image.flavor is required" }}-{{ default .Chart.Version .Values.image.version }}" imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- if .Values.image.isWindows }} + {{- if not .Values.pipelines.cache.volumeEnabled }} lifecycle: preStop: exec: command: - {{- if .Values.image.isWindows }} - {{- if not .Values.pipelines.cache.volumeEnabled }} - powershell - -Command - | # For security reasons, force clean the pipeline workspace at restart -- Sharing data bewteen pipelines is a security risk Remove-Item -Recurse -Force $Env:AZP_WORK; - {{- end }} - {{- else if or (not .Values.pipelines.cache.volumeEnabled) (not .Values.pipelines.tmpdir.volumeEnabled)}} + {{- end }} + {{- else if or (not .Values.pipelines.cache.volumeEnabled) (not .Values.pipelines.tmpdir.volumeEnabled)}} + lifecycle: + preStop: + exec: + command: + {{- if not .Values.pipelines.cache.volumeEnabled }} - bash - -c - | - {{- if not .Values.pipelines.cache.volumeEnabled }} # For security reasons, force clean the pipeline workspace at restart -- Sharing data bewteen pipelines is a security risk rm -rf ${AZP_WORK}; - {{- end }} - {{- if not .Values.pipelines.tmpdir.volumeEnabled }} + {{- end }} + {{- if not .Values.pipelines.tmpdir.volumeEnabled }} + - bash + - -c + - | # For security reasons, force clean the tmpdir at restart -- Sharing data bewteen pipelines is a security risk rm -rf ${TMPDIR}; - {{- end }} {{- end }} + {{- end }} env: - name: AGENT_DIAGLOGPATH {{- if .Values.image.isWindows }}