chartmuseum / helm-push

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

Installation fails on ubuntu 16.04 #19

Open mehemken opened 5 years ago

mehemken commented 5 years ago

Hello Chartmuseum folks,

I'm having trouble installing this plugin. It fails at line zero of the install script:

➜  helm-push git:(master) helm plugin install .
/bin/sh: 0: Illegal option -
Error: plugin install hook for "push" exited with error

I've tried changing the shebang to stuff I normally use (#!/usr/bin/env bash) but no luck. I've also tried to remove the -e flag. When I do that I get the following:

➜  helm-push git:(master) ✗ helm plugin install .
sh: 1: scripts/install_plugin.sh: not found
Error: plugin install hook for "push" exited with error
➜  helm-push git:(master) ✗ file scripts/install_plugin.sh
scripts/install_plugin.sh: POSIX shell script, ASCII text executable, with CRLF line terminators

So I'm confused about this. Help?

roh85 commented 4 years ago

I have the same issue on Ubuntu 18.04 LTS on my build server. This issue is caused by an invalid line ending explain in this post:

https://askubuntu.com/questions/304999/not-able-to-execute-a-sh-file-bin-bashm-bad-interpreter

I fixed it by replacing the line ending with the following command sed -i -e 's/\r$//' scripts/install_plugin.sh

I created a fork and modified the plugin.yaml to include this command in the install and update hook and everything works as expected:

name: "push"
version: "0.8.1"
usage: "Please see https://github.com/chartmuseum/helm-push for usage"
description: "Push chart package to ChartMuseum"
command: "$HELM_PLUGIN_DIR/bin/helmpush"
downloaders:
- command: "bin/helmpush"
  protocols:
  - "cm"
useTunnel: false
hooks:
  install: "cd $HELM_PLUGIN_DIR; sed -i -e 's/\r$//' scripts/install_plugin.sh; scripts/install_plugin.sh"
  update: "cd $HELM_PLUGIN_DIR; sed -i -e 's/\r$//' scripts/install_plugin.sh; scripts/install_plugin.sh"

I can now successfully install using helm plugin install https://github.com/Dynalinq/helm-push

@jdolitsky Can you have a look at the line ending issue so we can switch back to your original repository? When I do a replacement with sed I don't see any changes in git to commit so I can't make a PR. I don't think the changes to the plugin.yaml are necessary if the line endings in the install_plugin scripts are fixed.

jdolitsky commented 4 years ago

I'm not sure exactly how to address this. Im unable to convert it also. Perhaps "git clone" autoconverts it depending on your system and settings? https://help.github.com/en/github/using-git/configuring-git-to-handle-line-endings