fix: better error message for invalid Helm Chart path during init
What issue type does this pull request address? (keep at least one, remove the others) /kind bugfix
What does this pull request do? Which issues does it resolve? Resolves #2838. See that issue for details.
New error message displayed when following the repro steps documented in the issue:
~/helm-test > helm create foo
Creating foo
~/helm-test > ls
foo
~/helm-test > cd foo
~/helm-test/foo > l
charts/ Chart.yaml templates/ values.yaml
~/helm-test/foo > cd ..
~/helm-test > alias devspace=/home/matt/code/github.com/mattwelke/devspace/devspace
~/helm-test > devspace init
%########%
%###########% ____ _____
%#########% | _ \ ___ __ __ / ___/ ____ ____ ____ ___
%#########% | | | | / _ \\ \ / / \___ \ | _ \ / _ | / __// _ \
%#############% | |_| |( __/ \ V / ____) )| |_) )( (_| |( (__( __/
%#############% |____/ \___| \_/ \____/ | __/ \__,_| \___\\___|
%###############% |_|
%###########%
info Detecting programming language...
? Select the programming language of this project other
? How do you want to deploy this project?
? Do you already have a Helm chart for this project? Yes
? Which Helm chart do you want to use?
? Please enter the relative path to your local Helm chart (e.g. ./chart) foo/Chart.yaml
error Local path `foo/Chart.yaml` is not a Helm chart (path is not a directory)
? Which Helm chart do you want to use?
? Please enter the relative path to your local Helm chart (e.g. ./chart) .
error Local path `.` is not a Helm chart (Chart.yaml missing)
? Which Helm chart do you want to use?
? Please enter the relative path to your local Helm chart (e.g. ./chart) foo
? Do you want to develop this project with DevSpace or just deploy it? [Use arrows to move, type to filter] [Use arrows to move, type to filter]
> I want to develop this project and my current working dir contains the source code
I just want to deploy this project
Note the "path is not a directory".
Please provide a short message that should be published in the DevSpace release notes Fixed an issue where DevSpace's error message given a path to a file within a Chart directory instead of the Chart directory itself was unclear
What else do we need to know?
I didn't see any tests that called the function I changed, so I did not update or add any tests. But I did build the binary using the instructions in CONTRIBUTING.md and manually tested it. I used the built binary to produce the new command output above.
I followed instructions in CONTRIBUTING.md to run unit tests and integration tests. Integration tests did not pass, but I'm creating this PR to see if it was just my local env that prevented them from passing.
Deploy Preview for devspace-docs canceled.
Built without sensitive environment variables
| Name | Link |
|---|---|
| Latest commit | 84cbb8bd91730bd377559101d7c57b57134170fc |
| Latest deploy log | https://app.netlify.com/sites/devspace-docs/deploys/6643db8045fe9100089677ec |
Fixes DSP-5
@mattwelke
Can you take a look at the review feedback?
@lizardruss Sorry about that, missed this in my inbox. Thanks for reviewing. I'll take a look soon!
Made the changes. Ran my test again. It looks good still (it behaves the same way as before where the error message talks about it being a directory).
> <devspace_bin> init
%########%
%###########% ____ _____
%#########% | _ \ ___ __ __ / ___/ ____ ____ ____ ___
%#########% | | | | / _ \\ \ / / \___ \ | _ \ / _ | / __// _ \
%#############% | |_| |( __/ \ V / ____) )| |_) )( (_| |( (__( __/
%#############% |____/ \___| \_/ \____/ | __/ \__,_| \___\\___|
%###############% |_|
%###########%
info Detecting programming language...
? Select the programming language of this project other
? How do you want to deploy this project?
? Do you already have a Helm chart for this project? Yes
? Which Helm chart do you want to use?
? Please enter the relative path to your local Helm chart (e.g. ./chart) my-chart/Chart.yaml
error Local path `my-chart/Chart.yaml` is not a Helm chart (path is not a directory)
? Which Helm chart do you want to use? [Use arrows to move, type to filter]
> Use a local Helm chart (e.g. ./helm/chart/)
Use a Helm chart repository (e.g. app-chart stored in https://charts.company.tld)
Use a .tar.gz archive from URL (e.g. https://artifacts.company.tld/chart.tar.gz)
Use a chart from another git repository (e.g. you have an infra repo)
Abort and return to more options
@mattwelke
Apologies, but the linting and e2e tests failed, but the cause may be unrelated to your changes. I'm aiming to resolve those with this PR.
Once complete, can you rebase your branch against main so we can try again?
@mattwelke I think you can go ahead and rebase this branch. There are some test flakes that will need more investigation, but imo they should not hold up this PR.