refactor(filesystem): add CopyDir method and optimize Fetch function (#2111)

* refactor(filesystem): add CopyDir method and optimize Fetch function

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

* fix(state): conditionally prepare charts for local helmfile command

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

* fix(state): conditionally prepare charts for local helmfile command

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

* refactor(state): optimize chart path generation and update dependencies

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

* fix(test): update path in fetch-forl-local-chart test

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

* add more test cases

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

---------

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero
2025-07-28 16:10:25 -04:00
committed by GitHub
parent b0911ab1a2
commit a76bec234c
9 changed files with 47 additions and 23 deletions
+1
View File
@@ -80,6 +80,7 @@ ${kubectl} create namespace ${test_ns} || fail "Could not create namespace ${tes
# TEST CASES----------------------------------------------------------------------------------------------------------
. ${dir}/test-cases/fetch-forl-local-chart.sh
. ${dir}/test-cases/suppress-output-line-regex.sh
. ${dir}/test-cases/chartify-jsonPatches-and-strategicMergePatches.sh
. ${dir}/test-cases/include-template-func.sh
+15
View File
@@ -0,0 +1,15 @@
fetch_forl_local_chart_input_dir="${cases_dir}/fetch-forl-local-chart/input"
fetch_forl_local_chart_tmp=$(mktemp -d)
case_title="fetch for local chart"
test_start "$case_title"
info "Comparing fetch-forl-local-chart diff log #$i"
${helmfile} -f ${fetch_forl_local_chart_input_dir}/helmfile.yaml.gotmpl fetch --output-dir ${fetch_forl_local_chart_tmp} || fail "\"helmfile fetch\" shouldn't fail"
cat ${fetch_forl_local_chart_tmp}/helmfile-tests/local-chart/raw/latest/Chart.yaml || fail "Chart.yaml should exist in the fetched local chart directory"
cat ${fetch_forl_local_chart_tmp}/helmfile-tests/local-chart/raw/latest/templates/resources.yaml || fail "templates/resources.yaml should exist in the fetched local chart directory"
echo code=$?
test_pass "$case_title"
@@ -0,0 +1,4 @@
releases:
- name: local-chart
chart: ../../../charts/raw
namespace: local-chart