Remove all v0.x references (#1919)

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* refactor(two_pass_renderer): remove unused imports and functions

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

* fix tests

Signed-off-by: yxxhero <aiopsclub@163.com>

---------

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero
2025-03-08 07:43:21 -06:00
committed by GitHub
parent 3f6d5f52ab
commit 5d29f03782
229 changed files with 510 additions and 9464 deletions
+1 -1
View File
@@ -223,7 +223,7 @@ func testHelmfileTemplateWithBuildCommand(t *testing.T, goccyGoYaml bool) {
helmConfigHome := filepath.Join(tmpDir, "helm_config")
t.Logf("Using HELM_CACHE_HOME=%s, HELMFILE_CACHE_HOME=%s, HELM_CONFIG_HOME=%s", helmCacheHome, helmfileCacheHome, helmConfigHome)
inputFile := filepath.Join(testdataDir, name, "input.yaml")
inputFile := filepath.Join(testdataDir, name, "input.yaml.gotmpl")
outputFile := filepath.Join(testdataDir, name, "output.yaml")
ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second)
@@ -4,13 +4,13 @@ environments:
- test.yaml.gotmpl
---
helmfiles:
- path: helmfiles/test.yaml
- path: helmfiles/test.yaml.gotmpl
values:
- envName: {{ .Values.envName }}
- path: helmfiles/prod.yaml
- path: helmfiles/prod.yaml.gotmpl
values:
- envName: {{ .Values.envName }}
- path: helmfiles/no-envs.yaml
- path: helmfiles/no-envs.yaml.gotmpl
values:
- envName: {{ .Values.envName }}
- path: helmfiles/no-values.yaml
- path: helmfiles/no-values.yaml.gotmpl
@@ -1,5 +0,0 @@
chartifyTempDir: envs_releases_within_same_yaml_part
helmfileArgs:
- --environment
- prod
- template
@@ -0,0 +1,5 @@
chartifyTempDir: envs_releases_without_same_yaml_part
helmfileArgs:
- --environment
- prod
- template
@@ -1,4 +1,3 @@
WARNING: environments and releases cannot be defined within the same YAML part. Use --- to extract the environments into a dedicated part
Building dependency release=raw, chart=../../charts/raw-0.0.1
Templating release=raw, chart=../../charts/raw-0.0.1
---
@@ -1,7 +1,7 @@
---
# Source: __workingdir__/testdata/snapshot/issue_2098_release_template_needs/input.yaml
# Source: __workingdir__/testdata/snapshot/issue_2098_release_template_needs/input.yaml.gotmpl
filepath: input.yaml
filepath: input.yaml.gotmpl
helmBinary: helm
kustomizeBinary: kustomize
environments:
+1 -8
View File
@@ -1,14 +1,7 @@
chart_need_case_input_dir="${cases_dir}/chart-needs/input"
chart_need_case_output_dir="${cases_dir}/chart-needs/output"
config_file="helmfile.yaml"
if [[ ${HELMFILE_V1MODE} = true ]]; then
pushd "${chart_need_case_input_dir}"
mv "${config_file}" "${config_file}.gotmpl"
config_file="${config_file}.gotmpl"
popd
fi
config_file="helmfile.yaml.gotmpl"
chart_needs_tmp=$(mktemp -d)
chart_needs_template_reverse=${chart_needs_tmp}/chart.needs.template.log
chart_needs_lint_reverse=${chart_needs_tmp}/chart.needs.lint.log
@@ -1,14 +1,7 @@
chartify_jsonPatches_and_strategicMergePatches_case_input_dir="${cases_dir}/chartify-jsonPatches-and-strategicMergePatches/input"
chartify_jsonPatches_and_strategicMergePatches_case_output_dir="${cases_dir}/chartify-jsonPatches-and-strategicMergePatches/output"
config_file="helmfile.yaml"
if [[ ${HELMFILE_V1MODE} = true ]]; then
pushd "${chartify_jsonPatches_and_strategicMergePatches_case_input_dir}"
mv "${config_file}" "${config_file}.gotmpl"
config_file="${config_file}.gotmpl"
popd
fi
config_file="helmfile.yaml.gotmpl"
chartify_jsonPatches_and_strategicMergePatches_tmp=$(mktemp -d)
chartify_jsonPatches_and_strategicMergePatches_template_reverse=${chartify_jsonPatches_and_strategicMergePatches_tmp}/chartify_jsonPatches_and_strategicMergePatches.template.log
+1 -8
View File
@@ -1,14 +1,7 @@
chartify_case_input_dir="${cases_dir}/chartify/input"
chartify_case_output_dir="${cases_dir}/chartify/output"
config_file="helmfile.yaml"
if [[ ${HELMFILE_V1MODE} = true ]]; then
pushd "${chartify_case_input_dir}"
mv "${config_file}" "${config_file}.gotmpl"
config_file="${config_file}.gotmpl"
popd
fi
config_file="helmfile.yaml.gotmpl"
chartify_tmp=$(mktemp -d)
chartify_template_reverse=${chartify_tmp}/chartify.template.log
@@ -6,24 +6,12 @@ cli_overwrite_environment_values_reverse=${cli_overwrite_environment_values_tmp}
case_title="cli overwrite environment values"
if [[ ${HELMFILE_V1MODE} = true ]]; then
test_start "$case_title for v1"
info "Comparing ${case_title} for v1 output ${cli_overwrite_environment_values_reverse} with ${cli_overwrite_environment_values_output_dir}/overwritten.yaml"
for i in $(seq 10); do
info "Comparing build/cli-overwrite-environment-values #$i"
${helmfile} -f ${cli_overwrite_environment_values_input_dir}/input_v1.yaml.gotmpl template --state-values-set ns=test3 --state-values-set-string imageTag=1.23.3,zone="zone1,zone2" > ${cli_overwrite_environment_values_reverse} || fail "\"helmfile template\" shouldn't fail"
diff -u ${cli_overwrite_environment_values_output_dir}/output_v1.yaml ${cli_overwrite_environment_values_reverse} || fail "\"helmfile template\" should be consistent"
echo code=$?
done
test_pass "cli overwrite environment values for v1"
else
test_start "${case_title}"
info "Comparing ${case_title} output ${cli_overwrite_environment_values_reverse} with ${cli_overwrite_environment_values_output_dir}/overwritten.yaml"
for i in $(seq 10); do
info "Comparing build/cli-overwrite-environment-values #$i"
${helmfile} -f ${cli_overwrite_environment_values_input_dir}/input_v1.yaml.gotmpl template --state-values-set ns=test3 --state-values-set-string imageTag=1.23.3,zone="zone1,zone2" > ${cli_overwrite_environment_values_reverse} || fail "\"helmfile template\" shouldn't fail"
diff -u ${cli_overwrite_environment_values_output_dir}/output_v1.yaml ${cli_overwrite_environment_values_reverse} || fail "\"helmfile template\" should be consistent"
echo code=$?
done
test_pass "${case_title}"
fi
test_start "$case_title"
info "Comparing ${case_title} for output ${cli_overwrite_environment_values_reverse} with ${cli_overwrite_environment_values_output_dir}/overwritten.yaml"
for i in $(seq 10); do
info "Comparing build/cli-overwrite-environment-values #$i"
${helmfile} -f ${cli_overwrite_environment_values_input_dir}/input.yaml.gotmpl template --state-values-set ns=test3 --state-values-set-string imageTag=1.23.3,zone="zone1,zone2" > ${cli_overwrite_environment_values_reverse} || fail "\"helmfile template\" shouldn't fail"
diff -u ${cli_overwrite_environment_values_output_dir}/output.yaml ${cli_overwrite_environment_values_reverse} || fail "\"helmfile template\" should be consistent"
echo code=$?
done
test_pass "cli overwrite environment values for v1"
@@ -1,17 +0,0 @@
environments:
default:
values:
- base.yaml
- override.yaml
repositories:
- name: bitnami
url: https://charts.bitnami.com/bitnami
releases:
- name: test
chart: bitnami/nginx
namespace: {{ .Values.ns }}
version: 13.2.27
values:
- values.yaml.gotmpl
@@ -1,9 +1,3 @@
Warning: environments and releases cannot be defined within the same YAML part. Use --- to extract the environments into a dedicated part
Warning: environments and releases cannot be defined within the same YAML part. Use --- to extract the environments into a dedicated part
Adding repo bitnami https://charts.bitnami.com/bitnami
"bitnami" has been added to your repositories
Templating release=test, chart=bitnami/nginx
---
# Source: nginx/templates/svc.yaml
apiVersion: v1
@@ -57,6 +51,7 @@ spec:
app.kubernetes.io/instance: test
app.kubernetes.io/managed-by: Helm
annotations:
zone: "zone1,zone2"
spec:
automountServiceAccountToken: false
@@ -81,7 +76,7 @@ spec:
initContainers:
containers:
- name: nginx
image: docker.io/bitnami/nginx:test3
image: docker.io/bitnami/nginx:1.23.3
imagePullPolicy: "IfNotPresent"
env:
- name: BITNAMI_DEBUG
@@ -1,111 +0,0 @@
---
# Source: nginx/templates/svc.yaml
apiVersion: v1
kind: Service
metadata:
name: test-nginx
namespace: "test3"
labels:
app.kubernetes.io/name: nginx
helm.sh/chart: nginx-13.2.27
app.kubernetes.io/instance: test
app.kubernetes.io/managed-by: Helm
annotations:
spec:
type: LoadBalancer
sessionAffinity: None
externalTrafficPolicy: "Cluster"
ports:
- name: http
port: 80
targetPort: http
selector:
app.kubernetes.io/name: nginx
app.kubernetes.io/instance: test
---
# Source: nginx/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: test-nginx
namespace: "test3"
labels:
app.kubernetes.io/name: nginx
helm.sh/chart: nginx-13.2.27
app.kubernetes.io/instance: test
app.kubernetes.io/managed-by: Helm
spec:
replicas: 1
strategy:
rollingUpdate: {}
type: RollingUpdate
selector:
matchLabels:
app.kubernetes.io/name: nginx
app.kubernetes.io/instance: test
template:
metadata:
labels:
app.kubernetes.io/name: nginx
helm.sh/chart: nginx-13.2.27
app.kubernetes.io/instance: test
app.kubernetes.io/managed-by: Helm
annotations:
zone: "zone1,zone2"
spec:
automountServiceAccountToken: false
shareProcessNamespace: false
serviceAccountName: default
affinity:
podAffinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchLabels:
app.kubernetes.io/name: nginx
app.kubernetes.io/instance: test
topologyKey: kubernetes.io/hostname
weight: 1
nodeAffinity:
hostNetwork: false
hostIPC: false
initContainers:
containers:
- name: nginx
image: docker.io/bitnami/nginx:1.23.3
imagePullPolicy: "IfNotPresent"
env:
- name: BITNAMI_DEBUG
value: "false"
- name: NGINX_HTTP_PORT_NUMBER
value: "8080"
envFrom:
ports:
- name: http
containerPort: 8080
livenessProbe:
failureThreshold: 6
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 5
tcpSocket:
port: http
readinessProbe:
failureThreshold: 3
initialDelaySeconds: 5
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 3
tcpSocket:
port: http
resources:
limits: {}
requests: {}
volumeMounts:
volumes:
+1 -8
View File
@@ -2,14 +2,7 @@ test_start "happypath - simple rollout of httpbin chart"
happypath_case_input_dir="${cases_dir}/happypath/input"
happypath_case_output_dir="${cases_dir}/happypath/output"
config_file="happypath.yaml"
if [[ ${HELMFILE_V1MODE} = true ]]; then
pushd "${happypath_case_input_dir}"
mv "${config_file}" "${config_file}.gotmpl"
config_file="${config_file}.gotmpl"
popd
fi
config_file="happypath.yaml.gotmpl"
info "Diffing ${happypath_case_input_dir}/${config_file}"
bash -c "${helmfile} -f ${happypath_case_input_dir}/${config_file} diff --detailed-exitcode; code="'$?'"; [ "'${code}'" -eq 2 ]" || fail "unexpected exit code returned by helmfile diff"
+1 -8
View File
@@ -1,14 +1,7 @@
postrender_case_input_dir="${cases_dir}/postrender/input"
postrender_case_output_dir="${cases_dir}/postrender/output"
config_file="helmfile.yaml"
if [[ ${HELMFILE_V1MODE} = true ]]; then
pushd "${postrender_case_input_dir}"
mv "${config_file}" "${config_file}.gotmpl"
config_file="${config_file}.gotmpl"
popd
fi
config_file="helmfile.yaml.gotmpl"
postrender_diff_out_file=${postrender_case_output_dir}/diff-result
if [[ $EXTRA_HELMFILE_FLAGS == *--enable-live-output* ]]; then
postrender_diff_out_file=${postrender_case_output_dir}/diff-result-live
+4 -28
View File
@@ -4,44 +4,20 @@ test_start "regression tests"
regression_case_input_dir="${cases_dir}/regression/input"
info "https://github.com/roboll/helmfile/issues/1857"
config_file="issue.1857.yaml"
if [[ ${HELMFILE_V1MODE} = true ]]; then
pushd "${regression_case_input_dir}"
mv "${config_file}" "${config_file}.gotmpl"
config_file="${config_file}.gotmpl"
popd
fi
config_file="issue.1857.yaml.gotmpl"
(${helmfile} -f ${regression_case_input_dir}/${config_file} --state-values-set grafanaEnabled=true template | grep grafana 1>/dev/null) || fail "\"helmfile template\" shouldn't include grafana"
! (${helmfile} -f ${regression_case_input_dir}/${config_file} --state-values-set grafanaEnabled=false template | grep grafana) || fail "\"helmfile template\" shouldn't include grafana"
info "https://github.com/roboll/helmfile/issues/1867"
config_file="issue.1867.yaml"
if [[ ${HELMFILE_V1MODE} = true ]]; then
pushd "${regression_case_input_dir}"
mv "${config_file}" "${config_file}.gotmpl"
config_file="${config_file}.gotmpl"
popd
fi
config_file="issue.1867.yaml.gotmpl"
(${helmfile} -f ${regression_case_input_dir}/${config_file} template 1>/dev/null) || fail "\"helmfile template\" shouldn't fail"
info "https://github.com/roboll/helmfile/issues/2118"
config_file="issue.2118.yaml"
if [[ ${HELMFILE_V1MODE} = true ]]; then
pushd "${regression_case_input_dir}"
mv "${config_file}" "${config_file}.gotmpl"
config_file="${config_file}.gotmpl"
popd
fi
config_file="issue.2118.yaml.gotmpl"
(${helmfile} -f ${regression_case_input_dir}/${config_file} template 1>/dev/null) || fail "\"helmfile template\" shouldn't fail"
info "https://github.com/helmfile/helmfile/issues/1682"
config_file="issue.1682.yaml"
if [[ ${HELMFILE_V1MODE} = true ]]; then
pushd "${regression_case_input_dir}"
mv "${config_file}" "${config_file}.gotmpl"
config_file="${config_file}.gotmpl"
popd
fi
config_file="issue.1682.yaml.gotmpl"
(${helmfile} -f ${regression_case_input_dir}/${config_file} deps 1>/dev/null) || fail "\"helmfile deps\" shouldn't fail"
test_pass "regression tests"
+1 -7
View File
@@ -4,13 +4,7 @@ sops="sops --hc-vault-transit $VAULT_ADDR/v1/sops/keys/key"
secretssops_case_input_dir="${cases_dir}/secretssops/input"
secretssops_case_output_dir="${cases_dir}/secretssops/output"
config_file="secretssops.yaml"
if [[ ${HELMFILE_V1MODE} = true ]]; then
pushd "${secretssops_case_input_dir}"
mv "${config_file}" "${config_file}.gotmpl"
config_file="${config_file}.gotmpl"
popd
fi
config_file="secretssops.yaml.gotmpl"
mkdir -p ${secretssops_case_input_dir}/tmp
@@ -1,19 +1,20 @@
if [[ ${HELMFILE_V1MODE} = true ]]; then
v1_subhelmfile_multi_bases_with_array_values_input_dir="${cases_dir}/v1-subhelmfile-multi-bases-with-array-values/input"
v1_subhelmfile_multi_bases_with_array_values_output_dir="${cases_dir}/v1-subhelmfile-multi-bases-with-array-values/output"
v1_subhelmfile_multi_bases_with_array_values_input_dir="${cases_dir}/v1-subhelmfile-multi-bases-with-array-values/input"
v1_subhelmfile_multi_bases_with_array_values_output_dir="${cases_dir}/v1-subhelmfile-multi-bases-with-array-values/output"
yaml_overwrite_tmp=$(mktemp -d)
yaml_overwrite_reverse=${yaml_overwrite_tmp}/helmfile_template_result
yaml_overwrite_tmp=$(mktemp -d)
yaml_overwrite_reverse=${yaml_overwrite_tmp}/helmfile_template_result
test_start "v1 subhelmfile multi bases with array values"
info "Comparing v1 subhelmfile multi bases with array values output ${yaml_overwrite_reverse} with ${v1_subhelmfile_multi_bases_with_array_values_output_dir}/result"
for i in $(seq 10); do
info "Comparing build/v1-subhelmfile-multi-bases-with-array-values #$i"
${helmfile} -f ${v1_subhelmfile_multi_bases_with_array_values_input_dir}/helmfile.yaml.gotmpl template -e dev &> ${yaml_overwrite_reverse} || fail "\"helmfile template\" shouldn't fail"
diff -u ${v1_subhelmfile_multi_bases_with_array_values_output_dir}/result ${yaml_overwrite_reverse} || fail "\"helmfile template\" should be consistent"
echo code=$?
done
test_pass "v1 subhelmfile multi bases with array values"
else
test_pass "[skipped] v1 subhelmfile multi bases with array values"
fi
v1_subhelmfile_multi_bases_with_array_values_output_file=${v1_subhelmfile_multi_bases_with_array_values_output_dir}/result
if [[ $EXTRA_HELMFILE_FLAGS == *--enable-live-output* ]]; then
v1_subhelmfile_multi_bases_with_array_values_output_file=${v1_subhelmfile_multi_bases_with_array_values_output_dir}/result-live
fi
test_start "v1 subhelmfile multi bases with array values"
info "Comparing v1 subhelmfile multi bases with array values output ${yaml_overwrite_reverse} with ${v1_subhelmfile_multi_bases_with_array_values_output_file}"
for i in $(seq 10); do
info "Comparing build/v1-subhelmfile-multi-bases-with-array-values #$i"
${helmfile} -f ${v1_subhelmfile_multi_bases_with_array_values_input_dir}/helmfile.yaml.gotmpl template -e dev &> ${yaml_overwrite_reverse} || fail "\"helmfile template\" shouldn't fail"
diff -u ${v1_subhelmfile_multi_bases_with_array_values_output_file} ${yaml_overwrite_reverse} || fail "\"helmfile template\" should be consistent"
echo code=$?
done
test_pass "v1 subhelmfile multi bases with array values"
@@ -0,0 +1,25 @@
Live output is enabled
Adding repo incubator https://charts.helm.sh/incubator/
"incubator" has been added to your repositories
Templating release=helmfile-test, chart=incubator/raw
---
# Source: raw/templates/resources.yaml
apiVersion: v1
kind: Pod
metadata:
labels:
app: raw
chart: raw-0.1.0
heritage: Helm
release: helmfile-test
name: test
spec:
containers:
- command:
- /bin/sh
- -c
- env
image: registry.k8s.io/busybox
name: test-container
+13 -17
View File
@@ -1,19 +1,15 @@
if [[ ${HELMFILE_V1MODE} = true ]]; then
yaml_overwrite_case_input_dir="${cases_dir}/yaml-overwrite/input"
yaml_overwrite_case_output_dir="${cases_dir}/yaml-overwrite/output"
yaml_overwrite_case_input_dir="${cases_dir}/yaml-overwrite/input"
yaml_overwrite_case_output_dir="${cases_dir}/yaml-overwrite/output"
yaml_overwrite_tmp=$(mktemp -d)
yaml_overwrite_reverse=${yaml_overwrite_tmp}/yaml.override.build.yaml
yaml_overwrite_tmp=$(mktemp -d)
yaml_overwrite_reverse=${yaml_overwrite_tmp}/yaml.override.build.yaml
test_start "yaml overwrite feature"
info "Comparing yaml overwrite feature output ${yaml_overwrite_reverse} with ${yaml_overwrite_case_output_dir}/overwritten.yaml"
for i in $(seq 10); do
info "Comparing build/yaml-overwrite #$i"
${helmfile} -f ${yaml_overwrite_case_input_dir}/issue.657.yaml.gotmpl template --skip-deps > ${yaml_overwrite_reverse} || fail "\"helmfile template\" shouldn't fail"
./dyff between -bs ${yaml_overwrite_case_output_dir}/overwritten.yaml ${yaml_overwrite_reverse} || fail "\"helmfile template\" should be consistent"
echo code=$?
done
test_pass "yaml overwrite feature"
else
test_pass "[skipped] yaml overwrite feature"
fi
test_start "yaml overwrite feature"
info "Comparing yaml overwrite feature output ${yaml_overwrite_reverse} with ${yaml_overwrite_case_output_dir}/overwritten.yaml"
for i in $(seq 10); do
info "Comparing build/yaml-overwrite #$i"
${helmfile} -f ${yaml_overwrite_case_input_dir}/issue.657.yaml.gotmpl template --skip-deps > ${yaml_overwrite_reverse} || fail "\"helmfile template\" shouldn't fail"
./dyff between -bs ${yaml_overwrite_case_output_dir}/overwritten.yaml ${yaml_overwrite_reverse} || fail "\"helmfile template\" should be consistent"
echo code=$?
done
test_pass "yaml overwrite feature"