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

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero 2025-07-28 13:12:46 +08:00
parent 4ba241e958
commit 687944815c
6 changed files with 22 additions and 22 deletions

19
Vagrantfile vendored
View File

@ -1,19 +0,0 @@
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/focal64"
config.vm.hostname = "minikube.box"
config.vm.provision :shell, privileged: false,
inline: <<-EOS
set -e
sudo apt-get update
sudo apt-get install -y make docker.io
sudo systemctl start docker
sudo usermod -G docker $USER
cd /vagrant/.circleci
make all
EOS
config.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 2
end
end

2
go.mod
View File

@ -84,7 +84,7 @@ require (
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/otiai10/copy v1.14.1 // indirect
github.com/otiai10/copy v1.14.1
github.com/pkg/errors v0.9.1
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect

View File

@ -1373,8 +1373,8 @@ func (st *HelmState) PrepareCharts(helm helmexec.Interface, dir string, concurre
// a broken remote chart won't completely block their job.
chartPath = normalizedChart
if helmfileCommand == "pull" && isLocal {
// copy chart to a temporary directory
chartPath, err = generateChartPath(chartName, dir, release, opts.OutputDirTemplate)
chartAbsPath := strings.TrimSuffix(filepath.Clean(normalizedChart), "/")
chartPath, err = generateChartPath(filepath.Base(chartAbsPath), dir, release, opts.OutputDirTemplate)
if err != nil {
results <- &chartPrepareResult{err: err}
return

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

View File

@ -0,0 +1,14 @@
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}/local-chart/local-chart/raw/latest/Chart.yaml || fail "Chart.yaml should exist in the fetched local chart directory"
echo code=$?
test_pass "$case_title"

View File

@ -0,0 +1,4 @@
releases:
- name: local-chart
chart: ../../../charts/raw
namespace: local-chart