Skip to content

Commit

Permalink
fix: update helper function name to be consistent with naming convent…
Browse files Browse the repository at this point in the history
…ion (#7)

* fix: update helper function name to be consistent with naming convention

* disable waiting for pods in ct install

* update workflow

* update workflow

* update make targets and ct install args
  • Loading branch information
jinja2 authored Oct 9, 2024
1 parent 2c92ee9 commit 359bec8
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI Build Test
name: Lint and Test

on:
pull_request:
Expand Down Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Run helm-docs
id: helm-docs
run: |
./scripts/helm-docs.sh
make docker-docs
if [[ $(git diff --stat) != '' ]]; then
echo -e '\033[0;31mChart README is outdated! Please run "make docs".\033[0m ❌'
git diff --color
Expand All @@ -52,7 +52,8 @@ jobs:
- name: Run helm unit tests
run: |
helm plugin install https://github.com/helm-unittest/helm-unittest
echo "Installing latest version of helm unittest plugin..."
helm plugin install https://github.com/helm-unittest/helm-unittest >/dev/null 2>/dev/null
make unittest
- name: Create kind cluster
Expand Down
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ pre-commit: ## Test the Helm chart with pre-commit
.PHONY: unittest
unittest: ## Run unittests on the Helm chart
@echo "Running unit tests on helm chart..."
helm unittest --strict -f "../../tests/unittests/*.yaml" charts/splunk-synthetics-runner || exit 1
helm unittest --color --strict -f "../../tests/unittests/*.yaml" charts/splunk-synthetics-runner || exit 1

.PHONY: docker-docs
docker-docs: ## Update chart docs - Runs in docker container
@echo "Update docs for helm chart..."
./scripts/helm-docs.sh || exit 1

.PHONY: docs
docs: ## Run unittests on the Helm chart
docs: ## Update chart docs
@echo "Update docs for helm chart..."
helm-docs --chart-search-root=charts/ || exit 1

Expand Down
2 changes: 1 addition & 1 deletion charts/splunk-synthetics-runner/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Render security context
{{/*
Render names compliant with DNS label standard as defined in RFC 1123
*/}}
{{- define "cleanupNames" -}}
{{- define "splunk-synthetics-runner.cleanupNames" -}}
{{- $name := regexReplaceAll "[^A-Za-z0-9\\-]" . "-" | lower -}}
{{- $name = regexReplaceAll "^-+|-+$" $name "" | trunc 63 | trimSuffix "-" -}}
{{- $name -}}
Expand Down
4 changes: 2 additions & 2 deletions charts/splunk-synthetics-runner/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ spec:
{{- if .Values.synthetics.additionalCaCerts }}
{{- range $cert := keys .Values.synthetics.additionalCaCerts | sortAlpha }}
{{- $crtFile := regexReplaceAll "^(.*)\\.(\\w+)$" $cert "${1}.crt" }}
- name: {{ include "cleanupNames" $cert }}
- name: {{ include "splunk-synthetics-runner.cleanupNames" $cert }}
mountPath: {{ printf "/usr/local/share/ca-certificates/%s" $crtFile }}
subPath: {{ $crtFile }}
readOnly: false
Expand Down Expand Up @@ -124,7 +124,7 @@ spec:
{{- if .Values.synthetics.additionalCaCerts }}
{{- range $cert := keys .Values.synthetics.additionalCaCerts | sortAlpha }}
{{- $crtFile := regexReplaceAll "^(.*)\\.(\\w+)$" $cert "${1}.crt" }}
- name: {{ include "cleanupNames" $cert }}
- name: {{ include "splunk-synthetics-runner.cleanupNames" $cert }}
configMap:
name: {{ include "splunk-synthetics-runner.fullname" $ }}
items:
Expand Down
3 changes: 2 additions & 1 deletion scripts/helm-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ echo "Running helm-docs"
docker run \
-v "$REPO_ROOT:/helm-docs" \
-u $(id -u) \
jnorwood/helm-docs:v1.14.2
jnorwood/helm-docs:v1.14.2 \
--chart-search-root="charts/"

0 comments on commit 359bec8

Please sign in to comment.