Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: clear v1beta2 helm directory before writing new charts #4048

Merged
merged 3 commits into from
Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3261,6 +3261,33 @@ jobs:
sleep 1
done

# validate that the conditional chart is installed
COUNTER=1
while [ "$(helm ls -n "$APP_SLUG" | awk 'NR>1{print $1}' | grep my-conditional-chart-release)" == "" ]; do
((COUNTER += 1))
if [ $COUNTER -gt 120 ]; then
echo "Timed out waiting for my-conditional-chart-release to be installed"
helm ls -n "$APP_SLUG"
exit 1
fi
sleep 1
done

# toggle the config option to exclude the conditional chart
./bin/kots set config "$APP_SLUG" install_conditional_chart=0 --deploy --namespace "$APP_SLUG"

# wait for my-conditional-chart-release to be uninstalled
COUNTER=1
while [ "$(helm ls -n "$APP_SLUG" | awk 'NR>1{print $1}' | grep my-conditional-chart-release)" != "" ]; do
((COUNTER += 1))
if [ $COUNTER -gt 120 ]; then
echo "Timed out waiting for my-conditional-chart-release to be uninstalled"
helm ls -n "$APP_SLUG"
exit 1
fi
sleep 1
done


- name: Generate support bundle on failure
if: failure()
Expand Down
6 changes: 5 additions & 1 deletion pkg/apparchive/helm-v1beta2.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ type WriteV1Beta2HelmChartsOptions struct {

// WriteV1Beta2HelmCharts copies the upstream helm chart archive and rendered values to the helm directory and processes online images (if necessary)
func WriteV1Beta2HelmCharts(opts WriteV1Beta2HelmChartsOptions) error {
// clear the previous helm dir before writing
helmDir := opts.Upstream.GetHelmDir(opts.WriteUpstreamOptions)
os.RemoveAll(helmDir)

if opts.KotsKinds == nil || opts.KotsKinds.V1Beta2HelmCharts == nil {
return nil
}
Expand All @@ -91,7 +95,7 @@ func WriteV1Beta2HelmCharts(opts WriteV1Beta2HelmChartsOptions) error {
}
}

chartDir := path.Join(opts.Upstream.GetHelmDir(opts.WriteUpstreamOptions), helmChart.GetDirName())
chartDir := path.Join(helmDir, helmChart.GetDirName())
if err := os.MkdirAll(chartDir, 0744); err != nil {
return errors.Wrap(err, "failed to create chart dir")
}
Expand Down
Loading