update helm chart to support drafts
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Nikolai Rodionov 2023-02-25 18:06:56 +01:00
parent b9733a6a21
commit 1f106860ff
4 changed files with 11 additions and 3 deletions

View File

@ -2,5 +2,5 @@ apiVersion: v2
name: badhouseplants-net name: badhouseplants-net
description: A Helm chart for Kubernetes description: A Helm chart for Kubernetes
type: application type: application
version: 0.3.5 version: 0.3.6
appVersion: "1.16.0" appVersion: "1.16.0"

View File

@ -49,6 +49,9 @@ spec:
args: args:
- --baseURL - --baseURL
- {{ .Values.hugo.baseURL }} - {{ .Values.hugo.baseURL }}
{{- if .Values.hugo.buildDrafts }}
- --buildDrafts
{{- end }}
volumeMounts: volumeMounts:
- name: {{ .Values.volumes.rclone.name }} - name: {{ .Values.volumes.rclone.name }}
mountPath: /src/static mountPath: /src/static

View File

@ -34,6 +34,7 @@ hugo:
pullPolicy: Always pullPolicy: Always
tag: latest tag: latest
baseURL: badhouseplants.net baseURL: badhouseplants.net
buildDrafts: false
istio: istio:
enabled: true enabled: true

View File

@ -40,7 +40,7 @@ Before I can start deploying them, I have to prepare the application for that. A
1. Container must not contain any static content 1. Container must not contain any static content
2. I can't use only latest tags anymore 2. I can't use only latest tags anymore
3. Helm chart has a lot of stuff that's hardcoded 3. Helm chart has a lot of stuff that's hardcoded
4. CI pipelines must be rewritten almost completely 4. CI pipelines must be adjusted
5. Deployment process should be rethought 5. Deployment process should be rethought
### Static Container ### Static Container
@ -142,6 +142,7 @@ I had to find all the values, that should be different between different environ
1. Istio `VirtualServices` hostnames (Or Ingress hostname, if you don't use Istio) 1. Istio `VirtualServices` hostnames (Or Ingress hostname, if you don't use Istio)
2. Image tag for the container with the source code 2. Image tag for the container with the source code
3. And a hostname that should be passed to hugo as a base URL 3. And a hostname that should be passed to hugo as a base URL
4. Preview environments should display pages that are still `drafts`
So all of that I've put to `values.yaml` So all of that I've put to `values.yaml`
```YAML ```YAML
@ -152,6 +153,7 @@ istio:
image: image:
tag: $COMMIT_SHA tag: $COMMIT_SHA
baseURL: https://badhouseplants.net/ baseURL: https://badhouseplants.net/
buildDrafts: false
``` ```
### CI pipelines ### CI pipelines
@ -179,3 +181,5 @@ Now I need to push a new image on each commit instead of pushing only once the c
repo: git.badhouseplants.net/allanger/badhouseplants-net repo: git.badhouseplants.net/allanger/badhouseplants-net
tags: ${DRONE_COMMIT_SHA} tags: ${DRONE_COMMIT_SHA}
``` ```
Now if my code is not really broken, I'll have an image for each commit. And when I merge my branch to `main` I can use a tag from the latest preview build on for the production instance. So I'm almost sure that what I've tested before is what a visitor will see.