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: better error message for invalid Helm Chart path during init #2839

Conversation

mattwelke
Copy link
Contributor

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.

Copy link

netlify bot commented Apr 12, 2024

Deploy Preview for devspace-docs canceled.

Built without sensitive environment variables

Name Link
🔨 Latest commit 84cbb8b
🔍 Latest deploy log https://app.netlify.com/sites/devspace-docs/deploys/6643db8045fe9100089677ec

@mattwelke mattwelke force-pushed the feat/better-err-msg-adding-chart-during-init branch from 980293d to 514e395 Compare April 12, 2024 19:38
@deniseschannon
Copy link

Fixes DSP-5

Copy link
Collaborator

@lizardruss lizardruss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

Just a couple minor changes.

pkg/devspace/configure/deployment.go Outdated Show resolved Hide resolved
pkg/devspace/configure/deployment.go Outdated Show resolved Hide resolved
@lizardruss
Copy link
Collaborator

@mattwelke

Can you take a look at the review feedback?

@mattwelke
Copy link
Contributor Author

@lizardruss Sorry about that, missed this in my inbox. Thanks for reviewing. I'll take a look soon!

@mattwelke
Copy link
Contributor Author

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 mattwelke force-pushed the feat/better-err-msg-adding-chart-during-init branch from 0c638c6 to 54e6524 Compare May 9, 2024 22:59
@lizardruss lizardruss self-requested a review May 14, 2024 14:00
Copy link
Collaborator

@lizardruss lizardruss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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?

@lizardruss
Copy link
Collaborator

@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.

@mattwelke mattwelke force-pushed the feat/better-err-msg-adding-chart-during-init branch from 1baa23d to 84cbb8b Compare May 14, 2024 21:45
Copy link
Collaborator

@lizardruss lizardruss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@lizardruss lizardruss merged commit 4a9f4fe into devspace-sh:main May 14, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unclear error message during init using path to existing Helm chart Chart.yaml file
3 participants