chartmuseum / helm-push

Helm plugin to push chart package to ChartMuseum
Apache License 2.0
674 stars 170 forks source link

Add an option to skip the already exists error #90

Open alexandrevilain opened 3 years ago

alexandrevilain commented 3 years ago

Hi!

I'm using helm push on my CI/CD pipeline and I found that an option is missing for a simple use-case.

On a chart monorepo, think about a CI/CD pipeline that tries to push each chart to a chartmuseum to ensure that all charts are uploaded.

For instance, something like:

for d in ./charts/* ; do
    helm push $d chartmuseum
done

You don't want to use the --force flag, to prevent unversioned changes to be pushed on the chartmuseum but you don't want to see your pipeline fail each time it tries to push an already existing chart version.

Using helm-push v0.9.0 you get the following error:

$ helm push mychart/ chartmuseum
Pushing mychart-0.1.0.tgz to chartmuseum...
Error: 409: mychart-0.1.0.tgz already exists
Usage:
  helm push [flags]
[...]

And we get an exit code != 0.

I think we can add a flag to make helm-push ignore this error.

I will create a PR to fix this issue, let's discuss about it :)

karuppiah7890 commented 3 years ago

@alexandrevilain Thanks! I was having the same use case but we handled it in the bash script but yeah, I think the tool can help with this :)

BryanStenson-okta commented 2 years ago

I'd love to see this too....or, a richer exit code. (0 - no error, 1 - already exists, 127 - actual error)

nilampatel-engineer commented 2 years ago

@alexandrevilain Thanks! I was having the same use case but we handled it in the bash script but yeah, I think the tool can help with this :)

could you share the bash script you have used please?