Skip to content

Commit 4f01511

Browse files
committed
build(helm): fix nil pointer evaluation
1 parent e50198c commit 4f01511

File tree

2 files changed

+57
-29
lines changed

2 files changed

+57
-29
lines changed

install/kubernetes/github-actions-cache-server/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 1.0.1
18+
version: 1.0.2
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to

install/kubernetes/github-actions-cache-server/templates/_helpers.tpl

Lines changed: 56 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -146,34 +146,42 @@ Generate environment variables from config values.
146146
- name: STORAGE_FILESYSTEM_PATH
147147
value: {{ .Values.config.storage.filesystem.path | quote }}
148148
{{- else if eq .Values.config.storage.driver "s3" }}
149+
{{- with .Values.config.storage.s3 }}
150+
{{- if .bucket }}
149151
- name: STORAGE_S3_BUCKET
150-
value: {{ .Values.config.storage.s3.bucket | quote }}
151-
{{- if .Values.config.storage.s3.region }}
152+
value: {{ .bucket | quote }}
153+
{{- end }}
154+
{{- if .region }}
152155
- name: AWS_REGION
153-
value: {{ .Values.config.storage.s3.region | quote }}
156+
value: {{ .region | quote }}
154157
{{- end }}
155-
{{- if .Values.config.storage.s3.endpointUrl }}
158+
{{- if .endpointUrl }}
156159
- name: AWS_ENDPOINT_URL
157-
value: {{ .Values.config.storage.s3.endpointUrl | quote }}
160+
value: {{ .endpointUrl | quote }}
158161
{{- end }}
159-
{{- if .Values.config.storage.s3.accessKeyId }}
162+
{{- if .accessKeyId }}
160163
- name: AWS_ACCESS_KEY_ID
161-
value: {{ .Values.config.storage.s3.accessKeyId | quote }}
164+
value: {{ .accessKeyId | quote }}
162165
{{- end }}
163-
{{- if .Values.config.storage.s3.secretAccessKey }}
166+
{{- if .secretAccessKey }}
164167
- name: AWS_SECRET_ACCESS_KEY
165-
value: {{ .Values.config.storage.s3.secretAccessKey | quote }}
168+
value: {{ .secretAccessKey | quote }}
169+
{{- end }}
166170
{{- end }}
167171
{{- else if eq .Values.config.storage.driver "gcs" }}
172+
{{- with .Values.config.storage.gcs }}
173+
{{- if .bucket }}
168174
- name: STORAGE_GCS_BUCKET
169-
value: {{ .Values.config.storage.gcs.bucket | quote }}
170-
{{- if .Values.config.storage.gcs.serviceAccountKey }}
175+
value: {{ .bucket | quote }}
176+
{{- end }}
177+
{{- if .serviceAccountKey }}
171178
- name: STORAGE_GCS_SERVICE_ACCOUNT_KEY
172-
value: {{ .Values.config.storage.gcs.serviceAccountKey | quote }}
179+
value: {{ .serviceAccountKey | quote }}
173180
{{- end }}
174-
{{- if .Values.config.storage.gcs.endpoint }}
181+
{{- if .endpoint }}
175182
- name: STORAGE_GCS_ENDPOINT
176-
value: {{ .Values.config.storage.gcs.endpoint | quote }}
183+
value: {{ .endpoint | quote }}
184+
{{- end }}
177185
{{- end }}
178186
{{- end }}
179187
{{/* Database driver */}}
@@ -183,35 +191,55 @@ Generate environment variables from config values.
183191
- name: DB_SQLITE_PATH
184192
value: {{ .Values.config.db.sqlite.path | quote }}
185193
{{- else if eq .Values.config.db.driver "postgres" }}
186-
{{- if .Values.config.db.postgres.url }}
194+
{{- with .Values.config.db.postgres }}
195+
{{- if .url }}
187196
- name: DB_POSTGRES_URL
188-
value: {{ .Values.config.db.postgres.url | quote }}
197+
value: {{ .url | quote }}
189198
{{- else }}
199+
{{- if .database }}
190200
- name: DB_POSTGRES_DATABASE
191-
value: {{ .Values.config.db.postgres.database | quote }}
201+
value: {{ .database | quote }}
202+
{{- end }}
203+
{{- if .host }}
192204
- name: DB_POSTGRES_HOST
193-
value: {{ .Values.config.db.postgres.host | quote }}
205+
value: {{ .host | quote }}
206+
{{- end }}
207+
{{- if .port }}
194208
- name: DB_POSTGRES_PORT
195-
value: {{ .Values.config.db.postgres.port | quote }}
209+
value: {{ .port | quote }}
210+
{{- end }}
211+
{{- if .user }}
196212
- name: DB_POSTGRES_USER
197-
value: {{ .Values.config.db.postgres.user | quote }}
198-
{{- if .Values.config.db.postgres.password }}
213+
value: {{ .user | quote }}
214+
{{- end }}
215+
{{- if .password }}
199216
- name: DB_POSTGRES_PASSWORD
200-
value: {{ .Values.config.db.postgres.password | quote }}
217+
value: {{ .password | quote }}
218+
{{- end }}
201219
{{- end }}
202220
{{- end }}
203221
{{- else if eq .Values.config.db.driver "mysql" }}
222+
{{- with .Values.config.db.mysql }}
223+
{{- if .database }}
204224
- name: DB_MYSQL_DATABASE
205-
value: {{ .Values.config.db.mysql.database | quote }}
225+
value: {{ .database | quote }}
226+
{{- end }}
227+
{{- if .host }}
206228
- name: DB_MYSQL_HOST
207-
value: {{ .Values.config.db.mysql.host | quote }}
229+
value: {{ .host | quote }}
230+
{{- end }}
231+
{{- if .port }}
208232
- name: DB_MYSQL_PORT
209-
value: {{ .Values.config.db.mysql.port | quote }}
233+
value: {{ .port | quote }}
234+
{{- end }}
235+
{{- if .user }}
210236
- name: DB_MYSQL_USER
211-
value: {{ .Values.config.db.mysql.user | quote }}
212-
{{- if .Values.config.db.mysql.password }}
237+
value: {{ .user | quote }}
238+
{{- end }}
239+
{{- if .password }}
213240
- name: DB_MYSQL_PASSWORD
214-
value: {{ .Values.config.db.mysql.password | quote }}
241+
value: {{ .password | quote }}
242+
{{- end }}
215243
{{- end }}
216244
{{- end }}
217245
{{- end }}

0 commit comments

Comments
 (0)