Skip to content

Unable to install because install script uses CRLF line endings #317

Closed

Description

@davidmnoriega

I happen to be using Ubuntu via WSL2, but its just Linux. I've found I cant properly install helm-diff because the install script uses Windows line endings.

$ helm --debug plugin install https://github.com/databus23/helm-diff --version 3.1.3
[debug] vcs_installer.go:162: updating https://github.com/databus23/helm-diff
[debug] vcs_installer.go:131: found refs: [v2.10.0+1 v2.11.0+1 v2.11.0+2 v2.11.0+3 v2.11.0+4 v2.11.0+5 v2.2.1+1 v2.2.1+2 v2.3.1+1 v2.4.0+1 v2.5.0+1 v2.7.0+1 v2.8.0+1 v2.8.2+1 v2.8.2+2 v2.9.0+1 v2.9.0+2 v2.9.0+3 v3.0.0-rc.1 v3.0.0-rc.2 v3.0.0-rc.3 v3.0.0-rc.4 v3.0.0-rc.5 v3.0.0-rc.6 v3.0.0-rc.7 v3.1.0 v3.1.1 v3.1.2 v3.1.3]
[debug] vcs_installer.go:142: setting to v3.1.3
[debug] vcs_installer.go:152: setting version to "3.1.3"
[debug] vcs_installer.go:91: copying /home/dnoriega/.cache/helm/plugins/https-github.com-databus23-helm-diff to /home/dnoriega/.local/share/helm/plugins/helm-diff
plugin_install.go:82: [debug] loading plugin from /home/dnoriega/.local/share/helm/plugins/helm-diff
plugin.go:60: [debug] running install hook: /usr/bin/sh -c $HELM_PLUGIN_DIR/install-binary.sh
/usr/bin/env: ‘sh\r’: No such file or directory
Error: plugin install hook for "diff" exited with error
helm.go:88: [debug] plugin install hook for "diff" exited with error
main.runHook
        helm.sh/helm/v3/cmd/helm/plugin.go:67
main.(*pluginInstallOptions).run
        helm.sh/helm/v3/cmd/helm/plugin_install.go:88
main.newPluginInstallCmd.func3
        helm.sh/helm/v3/cmd/helm/plugin_install.go:59
github.com/spf13/cobra.(*Command).execute
        github.com/spf13/cobra@v1.2.1/command.go:856
github.com/spf13/cobra.(*Command).ExecuteC
        github.com/spf13/cobra@v1.2.1/command.go:974
github.com/spf13/cobra.(*Command).Execute
        github.com/spf13/cobra@v1.2.1/command.go:902
main.main
        helm.sh/helm/v3/cmd/helm/helm.go:87
runtime.main
        runtime/proc.go:225
runtime.goexit
        runtime/asm_amd64.s:1371

When I git clone and dos2unix the script install-binary.sh I am able to install successfully

$ helm --debug  plugin install ~/repos/helm-diff/[debug] local_installer.go:49: symlinking /home/dnoriega/repos/helm-diff to /home/dnoriega/.local/share/helm/plugins/helm-diff
plugin_install.go:82: [debug] loading plugin from /home/dnoriega/.local/share/helm/plugins/helm-diff
plugin.go:60: [debug] running install hook: /usr/bin/sh -c $HELM_PLUGIN_DIR/install-binary.sh
Downloading https://github.com/databus23/helm-diff/releases/download/v3.1.3/helm-diff-linux.tgz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   656  100   656    0     0   4151      0 --:--:-- --:--:-- --:--:--  4151
100 14.9M  100 14.9M    0     0  27.2M      0 --:--:-- --:--:-- --:--:-- 59.8M
Preparing to install into /home/dnoriega/.local/share/helm/plugins/helm-diff
helm-diff installed into /home/dnoriega/.local/share/helm/plugins/helm-diff/helm-diff

The Helm Diff Plugin

* Shows a diff explaining what a helm upgrade would change:
    This fetches the currently deployed version of a release
  and compares it to a local chart plus values. This can be 
  used visualize what changes a helm upgrade will perform.

* Shows a diff explaining what had changed between two revisions:
    This fetches previously deployed versions of a release
  and compares them. This can be used visualize what changes 
  were made during revision change.

* Shows a diff explaining what a helm rollback would change:
    This fetches the currently deployed version of a release
  and compares it to adeployed versions of a release, that you 
  want to rollback. This can be used visualize what changes a 
  helm rollback will perform.

Usage:
  diff [flags]
  diff [command]

Available Commands:
  release     Shows diff between release's manifests
  revision    Shows diff between revision's manifests
  rollback    Show a diff explaining what a helm rollback could perform
  upgrade     Show a diff explaining what a helm upgrade would change.
  version     Show version of the helm diff plugin

Flags:
      --allow-unreleased             enables diffing of releases that are not yet deployed via Helm
  -C, --context int                  output NUM lines of context around changes (default -1)
      --detailed-exitcode            return a non-zero exit code when there are changes
      --devel                        use development versions, too. Equivalent to version '>0.0.0-0'. If --version is set, this is ignored.
      --disable-openapi-validation   disables rendered templates validation against the Kubernetes OpenAPI Schema
      --disable-validation           disables rendered templates validation against the Kubernetes cluster you are currently pointing to. This is the same validation performed on an install
      --dry-run                      disables cluster access and show diff as if it was install. Implies --install, --reset-values, and --disable-validation
  -h, --help                         help for diff
      --include-tests                enable the diffing of the helm test hooks
      --install                      enables diffing of releases that are not yet deployed via Helm (equivalent to --allow-unreleased, added to match "helm upgrade --install" command
      --kubeconfig string            This flag is ignored, to allow passing of this top level flag to helm
      --no-color                     remove colors from the output
      --no-hooks                     disable diffing of hooks
      --output string                Possible values: diff, simple, json, template. When set to "template", use the env var HELM_DIFF_TPL to specify the template. (default "diff")
      --post-renderer string         the path to an executable to be used for post rendering. If it exists in $PATH, the binary will be used, otherwise it will try to look for the executable at the given path
      --reset-values                 reset the values to the ones built into the chart and merge in any new values
      --reuse-values                 reuse the last release's values and merge in any new values. If '--reset-values' is specified, this is ignored
      --set stringArray              set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
      --set-file stringArray         set values from respective files specified via the command line (can specify multiple or separate values with commas: key1=path1,key2=path2)
      --set-string stringArray       set STRING values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)
      --show-secrets                 do not redact secret values in the output
      --suppress stringArray         allows suppression of the values listed in the diff output
  -q, --suppress-secrets             suppress secrets in the output
  -f, --values valueFiles            specify values in a YAML file (can specify multiple) (default [])
      --version string               specify the exact chart version to use. If this is not specified, the latest version is used

Additional help topics:
  diff          

Use "diff [command] --help" for more information about a command.
Installed plugin: diff

Activity

  1. mumoshu commented on Jan 9, 2022

    @mumoshu
    Collaborator

    @davidmnoriega Hey! I think we don't use CRLF at all. Perhaps it's helm or git called by helm who is rewriting our install-binary.sh script with CRLF? How did you install helm and git in your WSL2 env?

  2. jkroepke commented on Jan 13, 2022

    @jkroepke
    Contributor

    By default, git for windows does some aufocrlf actions.

    https://stackoverflow.com/questions/4181870/git-on-windows-what-do-the-crlf-settings-mean

    But the PR should disable this behavior.

    #286

  3. mumoshu commented on Jan 13, 2022

    @mumoshu
    Collaborator

    @jkroepke Ah, that's good to know! This issue should have been resolved since v3.2.0 as your contribution (#286) has been included since then.

    For anyone experienced this in the future, please try 3.2.0 or greater.

    Thank you so much for your help, @jkroepke ☺️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions