Skip to content

Commit 16c6be3

Browse files
authored
update ct to v3.11.0 / yamlint to 1.33.0 / yamale to 4.0.4 / add e2e test (#144)
* update ct to v3.11.0 / yamlint to 1.33.0 / yamale to 4.0.4 Signed-off-by: cpanato <[email protected]> * add e2e test Signed-off-by: cpanato <[email protected]> --------- Signed-off-by: cpanato <[email protected]>
1 parent af96d80 commit 16c6be3

File tree

9 files changed

+149
-19
lines changed

9 files changed

+149
-19
lines changed

.github/workflows/test-action.yml

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ jobs:
99

1010
name: Install chart-testing and test presence in path
1111
steps:
12-
- uses: actions/checkout@v4
12+
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
1313
- name: Install chart-testing
1414
uses: ./
1515
- name: Check install!
1616
run: |
1717
ct version
1818
CT_VERSION_OUTPUT=$(ct version 2>&1 /dev/null)
1919
ACTUAL_VERSION=$(echo "$CT_VERSION_OUTPUT" | grep Version | rev | cut -d ' ' -f1 | rev)
20-
if [[ $ACTUAL_VERSION != 'v3.10.1' ]]; then
21-
echo 'should be v3.10.1'
20+
if [[ $ACTUAL_VERSION != 'v3.11.0' ]]; then
21+
echo 'should be v3.11.0'
2222
exit 1
2323
else
2424
exit 0
@@ -38,7 +38,7 @@ jobs:
3838

3939
name: Install Custom chart-testing and test presence in path
4040
steps:
41-
- uses: actions/checkout@v4
41+
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
4242
- name: Install chart-testing
4343
uses: ./
4444
with:
@@ -65,3 +65,49 @@ jobs:
6565
else
6666
exit 0
6767
fi
68+
69+
test_ct_action_with_helm:
70+
runs-on: ubuntu-latest
71+
72+
name: run action to test a helm chart
73+
steps:
74+
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
75+
with:
76+
fetch-depth: 0
77+
78+
- name: Set up Helm
79+
uses: azure/setup-helm@fe7b79cd5ee1e45176fcad797de68ecaf3ca4814 # v4.2.0
80+
with:
81+
version: v3.14.4
82+
83+
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
84+
with:
85+
python-version: '3.x'
86+
check-latest: true
87+
88+
- name: Install chart-testing
89+
uses: ./
90+
91+
- run: |
92+
sed -i "s/version: .*/version: 2.0.0/" testdata/simple-deployment/Chart.yaml
93+
cat testdata/simple-deployment/Chart.yaml
94+
95+
- name: Run chart-testing (list-changed)
96+
id: list-changed
97+
run: |
98+
changed=$(ct list-changed --chart-dirs=testdata --target-branch ${{ github.event.repository.default_branch }})
99+
if [[ -n "$changed" ]]; then
100+
echo "changed=true" >> "$GITHUB_OUTPUT"
101+
fi
102+
103+
- name: Run chart-testing (lint)
104+
if: steps.list-changed.outputs.changed == 'true'
105+
run: ct lint --chart-dirs=testdata --target-branch ${{ github.event.repository.default_branch }}
106+
107+
- name: Create kind cluster
108+
if: steps.list-changed.outputs.changed == 'true'
109+
uses: helm/[email protected]
110+
111+
- name: Run chart-testing (install)
112+
if: steps.list-changed.outputs.changed == 'true'
113+
run: ct install --chart-dirs=testdata --target-branch ${{ github.event.repository.default_branch }}

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ A GitHub Action for installing the [helm/chart-testing](https://github.com/helm/
1515

1616
For more information on inputs, see the [API Documentation](https://developer.github.com/v3/repos/releases/#input)
1717

18-
- `version`: The chart-testing version to install (default: `3.10.1`)
19-
- `yamllint_version`: The `yamllint` version to install (default: `1.27.1`)
20-
- `yamale_version`: The `yamale` version to install (default: `3.0.4`)
18+
- `version`: The chart-testing version to install (default: `3.11.0`)
19+
- `yamllint_version`: The `yamllint` version to install (default: `1.33.0`)
20+
- `yamale_version`: The `yamale` version to install (default: `4.0.4`)
2121

2222
### Example Workflow
2323

@@ -42,17 +42,17 @@ jobs:
4242
fetch-depth: 0
4343

4444
- name: Set up Helm
45-
uses: azure/setup-helm@v3
45+
uses: azure/setup-helm@v4.2.0
4646
with:
47-
version: v3.14.0
47+
version: v3.14.4
4848

49-
- uses: actions/setup-python@v4
49+
- uses: actions/setup-python@v5
5050
with:
51-
python-version: '3.12'
51+
python-version: '3.x'
5252
check-latest: true
5353

5454
- name: Set up chart-testing
55-
uses: helm/chart-testing-action@v2.6.1
55+
uses: helm/chart-testing-action@v2.7.0
5656

5757
- name: Run chart-testing (list-changed)
5858
id: list-changed
@@ -68,7 +68,7 @@ jobs:
6868

6969
- name: Create kind cluster
7070
if: steps.list-changed.outputs.changed == 'true'
71-
uses: helm/kind-action@v1.8.0
71+
uses: helm/kind-action@v1.10.0
7272

7373
- name: Run chart-testing (install)
7474
if: steps.list-changed.outputs.changed == 'true'

action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ inputs:
88
version:
99
description: "The chart-testing version to install (default: 3.10.1)"
1010
required: false
11-
default: '3.10.1'
11+
default: '3.11.0'
1212
yamllint_version:
1313
description: "The yamllint version to install (default: 1.27.1)"
1414
required: false
15-
default: '1.27.1'
15+
default: '1.33.0'
1616
yamale_version:
1717
description: "The yamale version to install (default: 3.0.4)"
1818
required: false
19-
default: '3.0.4'
19+
default: '4.0.4'
2020
runs:
2121
using: composite
2222
steps:

ct.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ set -o errexit
44
set -o nounset
55
set -o pipefail
66

7-
DEFAULT_CHART_TESTING_VERSION=3.10.1
8-
DEFAULT_YAMLLINT_VERSION=1.27.1
9-
DEFAULT_YAMALE_VERSION=3.0.4
7+
DEFAULT_CHART_TESTING_VERSION=3.11.0
8+
DEFAULT_YAMLLINT_VERSION=1.33.0
9+
DEFAULT_YAMALE_VERSION=4.0.4
1010

1111
show_help() {
1212
cat << EOF

testdata/simple-deployment/Chart.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
appVersion: "1.0"
3+
description: A Helm chart for Kubernetes
4+
name: nginx
5+
version: 0.1.0
6+
maintainers:
7+
- name: cpanato
8+
- name: davidkarlsen

testdata/simple-deployment/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Simple chart with a Deployment.
2+
3+
The integration test will install first simple-deployment and then try to upgrade
4+
to simple-deployment-different-selector failing as expected
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "nginx.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12+
If release name contains chart name it will be used as a full name.
13+
*/}}
14+
{{- define "nginx.fullname" -}}
15+
{{- if .Values.fullnameOverride -}}
16+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
17+
{{- else -}}
18+
{{- $name := default .Chart.Name .Values.nameOverride -}}
19+
{{- if contains $name .Release.Name -}}
20+
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
21+
{{- else -}}
22+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
23+
{{- end -}}
24+
{{- end -}}
25+
{{- end -}}
26+
27+
{{/*
28+
Create chart name and version as used by the chart label.
29+
*/}}
30+
{{- define "nginx.chart" -}}
31+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
32+
{{- end -}}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "nginx.fullname" . }}
5+
labels:
6+
app.kubernetes.io/name: {{ include "nginx.name" . }}
7+
helm.sh/chart: {{ include "nginx.chart" . }}
8+
app.kubernetes.io/instance: {{ .Release.Name }}
9+
app.kubernetes.io/managed-by: {{ .Release.Service }}
10+
spec:
11+
replicas: 1
12+
selector:
13+
matchLabels:
14+
app.kubernetes.io/name: {{ include "nginx.name" . }}
15+
app.kubernetes.io/instance: {{ .Release.Name }}
16+
template:
17+
metadata:
18+
labels:
19+
app.kubernetes.io/name: {{ include "nginx.name" . }}
20+
app.kubernetes.io/instance: {{ .Release.Name }}
21+
spec:
22+
containers:
23+
- name: {{ .Chart.Name }}
24+
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
25+
imagePullPolicy: {{ .Values.image.pullPolicy }}
26+
ports:
27+
- name: http
28+
containerPort: 80
29+
protocol: TCP
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Default values for nginx.
2+
# This is a YAML-formatted file.
3+
# Declare variables to be passed into your templates.
4+
5+
image:
6+
repository: nginx
7+
tag: stable
8+
pullPolicy: IfNotPresent
9+
10+
nameOverride: ""
11+
fullnameOverride: ""

0 commit comments

Comments
 (0)