helm-diff icon indicating copy to clipboard operation
helm-diff copied to clipboard

"helm plugin install https://github.com/databus23/helm-diff" fails - download url incorrect

Open scottgrover opened this issue 5 years ago • 10 comments

Tl;dr:

this plugin install fails when trying to build a docker container. I believe this is caused by an uninitialized download url variable in the build.sh script.

Info:

While building a docker container today, I was trying to install helm-diff. Below is the step that it fails on during my Docker build.

As defined in the docker file: RUN helm plugin install https://github.com/databus23/helm-diff

Docker output:

 ---> Running in d5955ed2182d
Downloading 
curl: (3) URL using bad/illegal format or missing URL
Failed to install helm-diff
        For support, go to https://github.com/databus23/helm-diff.
Error: plugin install hook for "diff" exited with error
The command '/bin/sh -c helm plugin install https://github.com/databus23/helm-diff' returned a non-zero code: 1

If I understand correctly, "Downloading" should have a URL following it. I believe that the $DOWNLOAD_URL variable is not initialized on line 77, but do not know the cause yet.

scottgrover avatar Mar 04 '21 21:03 scottgrover

Hmm, yeah we just ran into a similar issue as well:

  helm plugin install https://github.com/databus23/helm-diff --version v3.1.3
  shell: /usr/bin/bash -e {0}
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

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   625  100   625    0     0  39062      0 --:--:-- --:--:-- --:--:-- 39062

  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:02 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:03 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:04 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:05 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:06 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:07 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:08 --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:09 --:--:--     0
100     9    0     9    0     0      0      0 --:--:--  0:00:09 --:--:--     2
tar: This does not look like a tar archive

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
Error: plugin install hook for "diff" exited with error
Failed to install helm-diff
	For support, go to https://github.com/databus23/helm-diff.
Error: Process completed with exit code 1.

Chili-Man avatar Mar 05 '21 23:03 Chili-Man

@scottgrover Hey! Thanks for reporting. First of all, would you mind sharing your Dockerfile or the base image you're using for reproduction?

Also, what's the output from uname -m (https://github.com/databus23/helm-diff/blob/master/install-binary.sh#L29) and uname | tr '[:upper:]' '[:lower:](https://github.com/databus23/helm-diff/blob/master/install-binary.sh#L44)? Are you sure that git command is installed in the Dockerfile before running the failing helm-plugin-install command? I think those are major contributors to the problem.

mumoshu avatar Apr 12 '21 00:04 mumoshu

@Chili-Man Hey! What output does running curl -L https://github.com/databus23/helm-diff/releases/download/v3.1.3/helm-diff-linux.tgz within your Dockerfile provides you?

The URL does seem correct as I've successfully verified curl -LO https://github.com/databus23/helm-diff/releases/download/v3.1.3/helm-diff-linux.tgz to work locally.

mumoshu avatar Apr 12 '21 00:04 mumoshu

hey @mumoshu , so looks like that issue has since subsided. Looked like it was only a networking issue for a few days where that repeatedly occurred in our CI builds. I haven't seen it occur since then for over a month now.

Chili-Man avatar Apr 12 '21 17:04 Chili-Man

I got same error on OSX 10.15.7

▶ helm plugin install --debug https://github.com/databus23/helm-diff
[debug] vcs_installer.go:162: updating https://github.com/databus23/helm-diff
[debug] vcs_installer.go:91: copying /Users/compass/Library/Caches/helm/plugins/https-github.com-databus23-helm-diff to /Users/compass/Library/helm/plugins/helm-diff
plugin_install.go:82: [debug] loading plugin from /Users/compass/Library/helm/plugins/helm-diff
plugin.go:60: [debug] running install hook: /bin/sh -c $HELM_PLUGIN_DIR/install-binary.sh
Downloading
curl: (3) URL using bad/illegal format or missing URL
Failed to install helm-diff
        For support, go to https://github.com/databus23/helm-diff.
Error: plugin install hook for "diff" exited with error
helm.go:81: [debug] plugin install hook for "diff" exited with error
main.runHook
        /private/tmp/helm-20210204-99981-1f8vc0y/cmd/helm/plugin.go:67
main.(*pluginInstallOptions).run
        /private/tmp/helm-20210204-99981-1f8vc0y/cmd/helm/plugin_install.go:88
main.newPluginInstallCmd.func3
        /private/tmp/helm-20210204-99981-1f8vc0y/cmd/helm/plugin_install.go:59
github.com/spf13/cobra.(*Command).execute
        /Users/brew/Library/Caches/Homebrew/go_mod_cache/pkg/mod/github.com/spf13/[email protected]/command.go:850
github.com/spf13/cobra.(*Command).ExecuteC
        /Users/brew/Library/Caches/Homebrew/go_mod_cache/pkg/mod/github.com/spf13/[email protected]/command.go:958
github.com/spf13/cobra.(*Command).Execute
        /Users/brew/Library/Caches/Homebrew/go_mod_cache/pkg/mod/github.com/spf13/[email protected]/command.go:895
main.main
        /private/tmp/helm-20210204-99981-1f8vc0y/cmd/helm/helm.go:80
runtime.main
        /usr/local/Cellar/go/1.15.7_1/libexec/src/runtime/proc.go:204
runtime.goexit
        /usr/local/Cellar/go/1.15.7_1/libexec/src/runtime/asm_amd64.s:1374

xcompass avatar May 08 '21 07:05 xcompass

I ran into this issue today:

$ helm plugin install https://github.com/databus23/helm-diff
awk: cmd. line:1: warning: regexp escape sequence `\"' is not a known regexp operator
Downloading 
curl: (3) URL using bad/illegal format or missing URL

Failed to install helm-diff
	For support, go to https://github.com/databus23/helm-diff.
Error: plugin install hook for "diff" exited with error

Looking through install-binary.sh, the problem seems to be coming from the getDownloadUrl function, more specifically:

DOWNLOAD_URL=$(curl -s $url | grep $OS | awk '/\"browser_download_url\":/{gsub( /[,\"]/,"", $2); print $2}')

That awk command is what's failing, but it's weirdly inconsistent. It works fine on my local machine but inside a VM it's failing. Even more confusing is both the VM and my local are the running the same version of awk and Ubuntu.

$ lsb_release -d
Description:	Ubuntu 20.04.2 LTS

$ awk --version
GNU Awk 5.0.1, API: 2.0 (GNU MPFR 4.0.2, GNU MP 6.2.0)

I installed GNU Awk 4.2.1 in the VM and it fixed the issue.

I don't have a fix but thought I'd share what I learned looking into it. For now I'm just going to specify the version as that works fine since it doesn't need to use that awk command at all.

bradym avatar May 12 '21 22:05 bradym

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 13 '21 23:08 stale[bot]

i had the same issue, and i resolved it by downgrading helm-diff to 3.1.2. (Mac OS)

MarijaPopova avatar Sep 07 '21 13:09 MarijaPopova

For the record, as of Nov 2021, when I used helm --debug plugin install https://github.com/databus23/helm-diff to install the plugin it failed:

❯ helm --debug plugin install https://github.com/databus23/helm-diff
[debug] vcs_installer.go:162: updating https://github.com/databus23/helm-diff
[debug] vcs_installer.go:91: copying /Users/ArisChow/Library/Caches/helm/plugins/https-github.com-databus23-helm-diff to /Users/ArisChow/Library/helm/plugins/helm-diff
plugin_install.go:82: [debug] loading plugin from /Users/ArisChow/Library/helm/plugins/helm-diff
plugin.go:60: [debug] running install hook: /bin/sh -c $HELM_PLUGIN_DIR/install-binary.sh
Downloading
curl: (3) URL using bad/illegal format or missing URL
Failed to install helm-diff
	For support, go to https://github.com/databus23/helm-diff.
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/[email protected]/command.go:856
github.com/spf13/cobra.(*Command).ExecuteC
	github.com/spf13/[email protected]/command.go:974
github.com/spf13/cobra.(*Command).Execute
	github.com/spf13/[email protected]/command.go:902
main.main
	helm.sh/helm/v3/cmd/helm/helm.go:87
runtime.main
	runtime/proc.go:255
runtime.goexit
	runtime/asm_amd64.s:1581

I successfully installed the latest version (3.1.3) by running commands below:

# delete the fail-to-install plugin
❯ helm plugin uninstall diff
Uninstalled plugin: diff

# and specify the latest version for reinstalling it  
❯ 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 /Users/ArisChow/Library/Caches/helm/plugins/https-github.com-databus23-helm-diff to /Users/ArisChow/Library/helm/plugins/helm-diff
plugin_install.go:82: [debug] loading plugin from /Users/ArisChow/Library/helm/plugins/helm-diff
plugin.go:60: [debug] running install hook: /bin/sh -c $HELM_PLUGIN_DIR/install-binary.sh
Downloading https://github.com/databus23/helm-diff/releases/download/v3.1.3/helm-diff-macos.tgz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   625  100   625    0     0    928      0 --:--:-- --:--:-- --:--:--   934
100 14.7M  100 14.7M    0     0  3697k      0  0:00:04  0:00:04 --:--:-- 5807k
Preparing to install into /Users/ArisChow/Library/helm/plugins/helm-diff
helm-diff installed into /Users/ArisChow/Library/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

Hope it helps.

arischow avatar Nov 04 '21 06:11 arischow

Thanks everyone for reporting!

What I can see from all the reports is that installing from the latest seems to have been failing badly when you have some GitHub API issue. #285 fixed that so there's more likely a valid URL passed to curl which should prevent curl: (3) URL using bad/illegal format or missing URL errors.

Closing as resolved. Please create another issue you still see this problem! Don't forget to include os/arch info when you're doing so. Thanks.

mumoshu avatar Jan 09 '22 08:01 mumoshu