Skip to content

Commit ecddbcf

Browse files
authored
Merge pull request #87 from GrantBirki/bug-fixes
bug: `allow_multiple_documents` crashes the action in certain JSON parsing cases
2 parents 947ae8a + 0fd70e6 commit ecddbcf

File tree

6 files changed

+69
-5
lines changed

6 files changed

+69
-5
lines changed

.github/workflows/acceptance-test.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,12 @@ jobs:
7777
json_schema: ./__tests__/fixtures/schemas/schema1.json
7878
files: |
7979
__tests__/fixtures/yaml_as_json/valid_multi/yaml1.yaml
80+
81+
- name: acceptance test - excluding helm charts
82+
uses: ./
83+
id: json-yaml-validate-exclude-helm-charts-test
84+
with:
85+
comment: "true"
86+
yaml_exclude_regex: "(charts/external-dns/templates.*|mkdocs.yml)"
87+
allow_multiple_documents: "true"
88+
base_dir: __tests__/acceptance
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{{- $providerName := include "external-dns.providerName" . }}
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: {{ include "external-dns.fullname" . }}
6+
namespace: {{ .Release.Namespace }}
7+
labels:
8+
{{- include "external-dns.labels" . | nindent 4 }}
9+
{{- with .Values.service.annotations }}
10+
annotations:
11+
{{- toYaml . | nindent 4 }}
12+
{{- end }}
13+
spec:
14+
{{- with .Values.service.ipFamilies }}
15+
ipFamilies:
16+
{{- toYaml . | nindent 4 }}
17+
{{- end }}
18+
{{- with .Values.service.ipFamilyPolicy }}
19+
ipFamilyPolicy: {{ . }}
20+
{{- end }}
21+
type: ClusterIP
22+
selector:
23+
{{- include "external-dns.selectorLabels" . | nindent 4 }}
24+
ports:
25+
- name: http
26+
port: {{ .Values.service.port }}
27+
targetPort: http
28+
protocol: TCP
29+
{{- if eq $providerName "webhook" }}
30+
{{- with .Values.provider.webhook.service }}
31+
- name: http-webhook
32+
port: {{ .port }}
33+
targetPort: http-webhook
34+
protocol: TCP
35+
{{- end }}
36+
{{- end }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{{- if .Values.serviceAccount.create -}}
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
name: {{ include "external-dns.serviceAccountName" . }}
6+
namespace: {{ .Release.Namespace }}
7+
labels:
8+
{{- include "external-dns.labels" . | nindent 4 }}
9+
{{- with .Values.serviceAccount.labels }}
10+
{{- toYaml . | nindent 4 }}
11+
{{- end }}
12+
{{- with .Values.serviceAccount.annotations }}
13+
annotations:
14+
{{- range $k, $v := . }}
15+
{{- printf "%s: %s" (toYaml (tpl $k $)) (toYaml (tpl $v $)) | nindent 4 }}
16+
{{- end }}
17+
{{- end }}
18+
automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
19+
{{- end }}

dist/index.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/functions/json-validator.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ export async function jsonValidator(exclude) {
244244
newData.push(doc.toJS())
245245
})
246246
data = newData
247-
}
248-
if (allowMultipleDocuments !== true) {
247+
} else {
248+
// For JSON files or single YAML documents, wrap in array
249249
data = [data]
250250
}
251251

0 commit comments

Comments
 (0)