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 the error return for building helm repositories #1911

Merged
merged 6 commits into from
Jul 27, 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
2 changes: 1 addition & 1 deletion .github/actions/save-logs/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ runs:
steps:
- name: Fix log permissions
run: |
sudo chown $USER /tmp/zarf-*.log
stat -t /tmp/zarf-*.log >/dev/null 2>&1 && sudo chown $USER /tmp/zarf-*.log
shell: bash

- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/test-bigbang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,4 @@ jobs:
run: "go test ./src/extensions/bigbang/test -failfast -v -timeout 30m"

- name: Save logs
if: always() && ${{ env.IRONBANK_USERNAME != '' }}
env:
IRONBANK_USERNAME: ${{ secrets.IRONBANK_USERNAME }}
uses: ./.github/actions/save-logs
4 changes: 0 additions & 4 deletions .github/workflows/test-upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ jobs:
# chown the logs since they were originally created as root
run: |
sudo env "PATH=$PATH" CI=true zarf init --components k3s,git-server,logging --confirm
sudo chown $USER /tmp/zarf-*.log

# Before we run the regular tests we need to aggressively cleanup files to reduce disk pressure
- name: Cleanup files
Expand All @@ -93,15 +92,13 @@ jobs:
sudo env "PATH=$PATH" CI=true zarf package deploy zarf-package-test-upgrade-package-amd64-6.3.3.tar.zst --confirm
sudo env "PATH=$PATH" CI=true zarf tools kubectl describe deployments -n=podinfo-upgrade
sudo env "PATH=$PATH" CI=true zarf tools kubectl describe pods -n=podinfo-upgrade
sudo chown $USER /tmp/zarf-*.log

- name: "Run the PR's tests"
# NOTE: "PATH=$PATH" preserves the default user $PATH. This is needed to maintain the version of go installed
# in a previous step. This test run will use this PR's Zarf to create a K3s cluster.
# chown the logs since they were originally created as root
run: |
sudo env "PATH=$PATH" CI=true APPLIANCE_MODE=true APPLIANCE_MODE_KEEP=true make test-e2e ARCH=amd64
sudo chown $USER /tmp/zarf-*.log

- name: "Describe nodes, pods and deployments"
# NOTE: We describe nodes, pods and deployments here to help understand failures
Expand All @@ -124,7 +121,6 @@ jobs:
zarf package create src/test/upgrade --set PODINFO_VERSION=6.3.4 --confirm

sudo env "PATH=$PATH" CI=true make test-upgrade ARCH=amd64
sudo chown $USER /tmp/zarf-*.log

- name: Save logs
if: always()
Expand Down
13 changes: 11 additions & 2 deletions src/internal/packager/helm/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,13 @@ func (h *Helm) PackageChartFromLocalFiles(destination string) (string, error) {
spinner.Errorf(err, "Validation failed for chart from %s (%s)", h.Chart.LocalPath, err.Error())
return "", err
}
h.buildChartDependencies(spinner)

err = h.buildChartDependencies(spinner)
if err != nil {
spinner.Errorf(err, "Unable to build dependencies for the chart: %s", err.Error())
return "", err
}

client := action.NewPackage()

client.Destination = destination
Expand Down Expand Up @@ -206,7 +212,10 @@ func (h *Helm) buildChartDependencies(spinner *message.Spinner) error {
// Build the deps from the helm chart
err = man.Build()
if e, ok := err.(downloader.ErrRepoNotFound); ok {
return fmt.Errorf("%s. Please add the missing repos via 'helm repo add'", e.Error())
return fmt.Errorf("%s. Please add the missing repo via 'helm repo add <name> <url>'", e.Error())
} else if err != nil {
return err
}

return nil
}