Giter Site home page Giter Site logo

mbenabda / helm-local-chart-version Goto Github PK

View Code? Open in Web Editor NEW
23.0 4.0 13.0 71 KB

Bump Helm Chart version on local filesystem (inspired by https://github.com/shaneramey/helm-local-bump)

License: The Unlicense

Makefile 6.37% Shell 19.20% Go 74.43%
helm-plugin helm-charts automation ci helm

helm-local-chart-version's People

Contributors

derekbassett avatar hack3d avatar lestr avatar mbenabda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

helm-local-chart-version's Issues

Will not build currently with Go 1.10.

Tried to install this component using both the install instructions and the manual build using Go 1.10 and is not able to build. Get the following error message:

glide install --strip-vendor
[INFO]	Downloading dependencies. Please wait...
[INFO]	--> Found desired version locally github.com/BurntSushi/toml b26d9c308763d68093482582cea63d69be07a0f0!
[INFO]	--> Found desired version locally github.com/ghodss/yaml 0ca9ea5df5451ffdf184b4428c902747c2c11cd7!
[INFO]	--> Found desired version locally github.com/gobwas/glob 5ccd90ef52e1e632236f7326478d4faa74f99438!
[INFO]	--> Found desired version locally github.com/golang/protobuf 4bd1920723d7b7c925de087aa32e2187708897f7!
[INFO]	--> Found desired version locally github.com/inconshreveable/mousetrap 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75!
[INFO]	--> Found desired version locally github.com/Masterminds/semver 517734cc7d6470c0d07130e40fd40bdeb9bcd3fd!
[INFO]	--> Found desired version locally github.com/spf13/cobra 7b2c5ac9fc04fc5efafb60700713d4fa609b777b!
[INFO]	--> Found desired version locally github.com/spf13/pflag ee5fd03fd6acfd43e44aea0b4135958546ed8e73!
[INFO]	--> Found desired version locally gopkg.in/yaml.v2 d670f9405373e636a5a2765eea47fac0c9bc91a4!
[INFO]	--> Found desired version locally k8s.io/apimachinery cced8e64b6ca92a8b6afcbfea3353ca016694a45!
[INFO]	--> Found desired version locally k8s.io/helm 6af75a8fd72e2aa18a2b278cfe5c7a1c5feca7f2!
[INFO]	Setting references.
[INFO]	--> Setting version for github.com/spf13/pflag to ee5fd03fd6acfd43e44aea0b4135958546ed8e73.
[INFO]	--> Setting version for github.com/golang/protobuf to 4bd1920723d7b7c925de087aa32e2187708897f7.
[INFO]	--> Setting version for github.com/gobwas/glob to 5ccd90ef52e1e632236f7326478d4faa74f99438.
[INFO]	--> Setting version for github.com/ghodss/yaml to 0ca9ea5df5451ffdf184b4428c902747c2c11cd7.
[INFO]	--> Setting version for github.com/Masterminds/semver to 517734cc7d6470c0d07130e40fd40bdeb9bcd3fd.
[INFO]	--> Setting version for github.com/inconshreveable/mousetrap to 76626ae9c91c4f2a10f34cad8ce83ea42c93bb75.
[INFO]	--> Setting version for github.com/BurntSushi/toml to b26d9c308763d68093482582cea63d69be07a0f0.
[INFO]	--> Setting version for github.com/spf13/cobra to 7b2c5ac9fc04fc5efafb60700713d4fa609b777b.
[INFO]	--> Setting version for k8s.io/helm to 6af75a8fd72e2aa18a2b278cfe5c7a1c5feca7f2.
[INFO]	--> Setting version for k8s.io/apimachinery to cced8e64b6ca92a8b6afcbfea3353ca016694a45.
[INFO]	--> Setting version for gopkg.in/yaml.v2 to d670f9405373e636a5a2765eea47fac0c9bc91a4.
[INFO]	Exporting resolved dependencies...
[INFO]	--> Exporting github.com/BurntSushi/toml
[INFO]	--> Exporting github.com/ghodss/yaml
[INFO]	--> Exporting github.com/inconshreveable/mousetrap
[INFO]	--> Exporting github.com/golang/protobuf
[INFO]	--> Exporting github.com/spf13/cobra
[INFO]	--> Exporting github.com/Masterminds/semver
[INFO]	--> Exporting github.com/gobwas/glob
[INFO]	--> Exporting github.com/spf13/pflag
[INFO]	--> Exporting k8s.io/apimachinery
[INFO]	--> Exporting k8s.io/helm
[INFO]	--> Exporting gopkg.in/yaml.v2
[INFO]	Replacing existing vendor dependencies
[INFO]	Removing nested vendor and Godeps/_workspace directories...
[INFO]	Removing: /Users/dbasse202/go/src/github.com/mbenabda/helm-local-chart-version/vendor/k8s.io/apimachinery/vendor
go test github.com/mbenabda/helm-local-chart-version github.com/mbenabda/helm-local-chart-version/pkg/chartfile github.com/mbenabda/helm-local-chart-version/pkg/version
vendor/github.com/spf13/cobra/doc/man_docs.go:26:2: cannot find package "github.com/cpuguy83/go-md2man/md2man" in any of:
	/Users/dbasse202/go/src/github.com/mbenabda/helm-local-chart-version/vendor/github.com/cpuguy83/go-md2man/md2man (vendor tree)
	/usr/local/Cellar/go/1.10/libexec/src/github.com/cpuguy83/go-md2man/md2man (from $GOROOT)
	/Users/dbasse202/go/src/github.com/cpuguy83/go-md2man/md2man (from $GOPATH)

The problem appears to be that spf13/cobra introduced a dependency on github.com/cpuguy83/go-md2man

Something about running go test causes the file to be compiled and required, where as a go build does not.

helm install fails

�[0mPreparing to install into
�[91mmkdir: missing operand
Try 'mkdir --help' for more information.
�[0mFailed to install helm-local-chart-version
For support, go to https://github.com/mbenabda/helm-local-chart-version.
The command '/bin/sh -c helm plugin install https://github.com/mbenabda/helm-local-chart-version && sh $(helm home)/plugins/helm-local-chart-version/install-binary.sh && helm plugin install https://github.com/chartmuseum/helm-push && chmod 777 -R /usr/local/helm' returned a non-zero code: 1

The plugin overwrites the existing Chart file

It seems like the plugin overwrites the existing Chart.yml file to look like:

apiVersion: <version>
description: <description>
name: <name>
version: <semver>

It would be more useful for me if it updated my existing Chart file in-place.

Plugin Installs but installation fails

Installing in an alpine container I'm getting the error:

No prebuilt binary for linux-amd64.
Failed to install helm-local-chart-version
\tFor support, go to https://github.com/mbenabda/helm-local-chart-version.
Error: plugin install hook for "local-chart-version" exited with error

Which causes the container build to fail. When I exec into the container and run the same command: helm plugin install https://github.com/mbenabda/helm-local-chart-ve rsion --debug it still fails but I can see the folder is listed there:

lrwxrwxrwx    1 root     root          84 Aug  2 14:30 helm-local-chart-version -> /home/jenkins/.helm/cache/plugins/https-github.com-mbenabda-helm-local-chart-version

Support for arm64

After fixing #18 I'm unable to download https://github.com/mbenabda/helm-local-chart-version/releases/download/v0.0.7/helm-local-chart-version-0.0.7-darwin-arm64.tar.gz because it doesn't exist.

Any plan to add support for arm64?

Bumping version clears all previous yaml comments

Hi,

I'm using this plugin to bump a chart version, and event though it works as intended, it removes all comments that I have in the chart. Is there any way to prevent this?

Original file:

apiVersion: v2
name: testchart
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 1.16.0

Modified file after plugin is executed:

apiVersion: v2
appVersion: 1.16.0
description: A Helm chart for Kubernetes
name: testchart
type: application
version: 0.1.1

Thank you!

[Helm 3] Plugin installation failed.

The installation of the plugin with helm 3.0.1 failed.
Terminal output:
`* Trying 140.82.118.5...

  • Connected to api.github.com (140.82.118.5) port 443 (#0)
  • found 149 certificates in /etc/ssl/certs/ca-certificates.crt
  • found 605 certificates in /etc/ssl/certs
  • ALPN, offering http/1.1
  • SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
  • server certificate verification OK
  • server certificate status verification SKIPPED
  • common name: *.github.com (matched)
  • server certificate expiration date OK
  • server certificate activation date OK
  • certificate public key: RSA
  • certificate version: #3
  • subject: C=US,ST=California,L=San Francisco,O=GitHub, Inc.,CN=*.github.com
  • start date: Mon, 08 Jul 2019 00:00:00 GMT
  • expire date: Thu, 16 Jul 2020 12:00:00 GMT
  • issuer: C=US,O=DigiCert Inc,OU=www.digicert.com,CN=DigiCert SHA2 High Assurance Server CA
  • compression: NULL
  • ALPN, server accepted to use http/1.1

GET /repos/mbenabda/helm-local-chart-version/releases/latest HTTP/1.1
Host: api.github.com
User-Agent: curl/7.47.0
Accept: /

< HTTP/1.1 200 OK
< Date: Mon, 10 Feb 2020 10:36:00 GMT
< Content-Type: application/json; charset=utf-8
< Content-Length: 7836
< Server: GitHub.com
< Status: 200 OK
< X-RateLimit-Limit: 60
< X-RateLimit-Remaining: 57
< X-RateLimit-Reset: 1581334087
< Cache-Control: public, max-age=60, s-maxage=60
< Vary: Accept
< ETag: "86eeb89debc5c7d4f662563e00ce651d"
< Last-Modified: Sun, 10 Feb 2019 01:06:40 GMT
< X-GitHub-Media-Type: github.v3; format=json
< Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type
< Access-Control-Allow-Origin: *
< Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
< X-Frame-Options: deny
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
< Content-Security-Policy: default-src 'none'
< Vary: Accept-Encoding, Accept
< Vary: Accept-Encoding
< X-GitHub-Request-Id: F0C4:2C0B6:6A028BA:7F50B00:5E413210
<
{ [286 bytes data]

Common actions for Helm:

  • helm search: search for charts
  • helm pull: download a chart to your local directory to view
  • helm install: upload the chart to Kubernetes
  • helm list: list releases of charts

Environment variables:

+------------------+-----------------------------------------------------------------------------+
| Name | Description |
+------------------+-----------------------------------------------------------------------------+
| $XDG_CACHE_HOME | set an alternative location for storing cached files. |
| $XDG_CONFIG_HOME | set an alternative location for storing Helm configuration. |
| $XDG_DATA_HOME | set an alternative location for storing Helm data. |
| $HELM_DRIVER | set the backend storage driver. Values are: configmap, secret, memory |
| $HELM_NO_PLUGINS | disable plugins. Set HELM_NO_PLUGINS=1 to disable plugins. |
| $KUBECONFIG | set an alternative Kubernetes configuration file (default "~/.kube/config") |
+------------------+-----------------------------------------------------------------------------+

Helm stores configuration based on the XDG base directory specification, so

  • cached files are stored in $XDG_CACHE_HOME/helm
  • configuration is stored in $XDG_CONFIG_HOME/helm
  • data is stored in $XDG_DATA_HOME/helm

By default, the default directories depend on the Operating System. The defaults are listed below:

+------------------+---------------------------+--------------------------------+-------------------------+
| Operating System | Cache Path | Configuration Path | Data Path |
+------------------+---------------------------+--------------------------------+-------------------------+
| Linux | $HOME/.cache/helm | $HOME/.config/helm | $HOME/.local/share/helm |
| macOS | $HOME/Library/Caches/helm | $HOME/Library/Preferences/helm | $HOME/Library/helm |
| Windows | %TEMP%\helm | %APPDATA%\helm | %APPDATA%\helm |
+------------------+---------------------------+--------------------------------+-------------------------+

Usage:
helm [command]

Available Commands:
completion Generate autocompletions script for the specified shell (bash or zsh)
create create a new chart with the given name
dependency manage a chart's dependencies
env Helm client environment information
get download extended information of a named release
help Help about any command
history fetch release history
install install a chart
kubeval Validate Helm charts
lint examines a chart for possible issues
list list releases
local-chart-version local-chart-version [subcommand] LOCAL_CHART_DIRECTORY [flags]
package package a chart directory into a chart archive
plugin install, list, or uninstall Helm plugins
pull download a chart from a repository and (optionally) unpack it in local directory
repo add, list, remove, update, and index chart repositories
rollback roll back a release to a previous revision
search search for a keyword in charts
secrets Secrets encryption in Helm for Git storing
show show information of a chart
status displays the status of the named release
template locally render templates
test run tests for a release
uninstall uninstall a release
upgrade upgrade a release
verify verify that a chart at the given path has been signed and is valid
version print the client version information

Flags:
--add-dir-header If true, adds the file directory to the header
--alsologtostderr log to standard error as well as files
--debug enable verbose output
-h, --help help for helm
--kube-context string name of the kubeconfig context to use
--kubeconfig string path to the kubeconfig file
--log-backtrace-at traceLocation when logging hits line file:N, emit a stack trace (default :0)
--log-dir string If non-empty, write log files in this directory
--log-file string If non-empty, use this log file
--log-file-max-size uint Defines the maximum size a log file can grow to. Unit is megabytes. If the value is 0, the maximum file size is unlimited. (default 1800)
--logtostderr log to standard error instead of files (default true)
-n, --namespace string namespace scope for this request (default "default")
--registry-config string path to the registry config file (default "/home/rlekies/.config/helm/registry.json")
--repository-cache string path to the file containing cached repository indexes (default "/home/rlekies/.cache/helm/repository")
--repository-config string path to the file containing repository names and URLs (default "/home/rlekies/.config/helm/repositories.yaml")
--skip-headers If true, avoid header prefixes in the log messages
--skip-log-headers If true, avoid headers when opening log files
--stderrthreshold severity logs at or above this threshold go to stderr (default 2)
-v, --v Level number for the log level verbosity
--vmodule moduleSpec comma-separated list of pattern=N settings for file-filtered logging

Use "helm [command] --help" for more information about a command./plugins/helm-local-chart-version
mkdir: Unbekannte Option »--add-dir-header«
„mkdir --help“ liefert weitere Informationen.
Failed to install helm-local-chart-version
For support, go to https://github.com/mbenabda/helm-local-chart-version.
Error: plugin install hook for "local-chart-version" exited with error
`

Plugin Installation Fails install-binary.sh: not found

Problem:
When running the plugin installation on my CI/CD Ubuntu container, the installation fails with the this error:

[debug] cloning https://github.com/mbenabda/helm-local-chart-version to /root/.helm/cache/plugins/https-github.com-mbenabda-helm-local-chart-version

[debug] symlinking /root/.helm/cache/plugins/https-github.com-mbenabda-helm-local-chart-version to /root/.helm/plugins/helm-local-chart-version

[debug] loading plugin from /root/.helm/plugins/helm-local-chart-version

[debug] running install hook: &{/bin/sh [sh -c $HELM_PLUGIN_DIR/install-binary.sh] []  <nil> <nil> <nil> [] %!s(*syscall.SysProcAttr=<nil>) %!s(*os.Process=<nil>) <nil> <nil> <nil> %!s(bool=false) [] [] [] [] %!s(chan error=<nil>) %!s(chan struct {}=<nil>)}
sh: /root/.helm/plugins/helm-local-chart-version/install-binary.sh: not found

Error: plugin install hook for "local-chart-version" exited with error

Linux version:

uname -a  
Linux f3c801dfde85 4.15.0-1035-aws #37-Ubuntu SMP Mon Mar 18 16:15:14 UTC 2019 x86_64 Linux

On my local machine (Mac), it works.

Workaround
When changing the first line of the install-binary.sh from #!/bin/bash to #!/bin/sh the [sh -c $HELM_PLUGIN_DIR/install-binary.sh] works.

I think that has something to do with changing between different bashs.

Plugin installation failed when runs inside of git repository

helm plugin install https://github.com/mbenabda/helm-local-chart-version --version "v0.0.7" failed when I run it inside of git repository with tags.

Steps for reproducing:

  1. create a directory and init empty git repository, create a tag
❯ mkdir /tmp/some-directory
❯ cd /tmp/some-directory
❯ git init
Initialized empty Git repository in /private/tmp/some-directory/.git/
❯ touch x && git add x && git commit -m "init"
[main (root-commit) 9b3ca3c] init
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 x
❯ git tag v666
  1. try to install plugin from some-directory
❯ pwd
/tmp/some-directory
❯ helm plugin install https://github.com/mbenabda/helm-local-chart-version --version "v0.0.7" --debug
[debug] vcs_installer.go:162: updating https://github.com/mbenabda/helm-local-chart-version
[debug] vcs_installer.go:152: setting version to "v0.0.7"
[debug] vcs_installer.go:91: copying /Users/ldrbal/Library/Caches/helm/plugins/https-github.com-mbenabda-helm-local-chart-version to /Users/ldrbal/Library/helm/plugins/helm-local-chart-version
plugin_install.go:82: [debug] loading plugin from /Users/ldrbal/Library/helm/plugins/helm-local-chart-version
plugin.go:60: [debug] running install hook: /bin/sh -c $HELM_PLUGIN_DIR/install-binary.sh
Downloading https://github.com/mbenabda/helm-local-chart-version/releases/download/v666/helm-local-chart-version-666-darwin-arm64.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100     9  100     9    0     0     27      0 --:--:-- --:--:-- --:--:--    27
Preparing to install into /Users/ldrbal/Library/helm/plugins/helm-local-chart-version
tar: Error opening archive: Unrecognized archive format
Failed to install helm-local-chart-version
For support, go to https://github.com/mbenabda/helm-local-chart-version.
Error: plugin install hook for "local-chart-version" exited with error
helm.go:84: [debug] plugin install hook for "local-chart-version" 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:916
github.com/spf13/cobra.(*Command).ExecuteC
	github.com/spf13/[email protected]/command.go:1044
github.com/spf13/cobra.(*Command).Execute
	github.com/spf13/[email protected]/command.go:968
main.main
	helm.sh/helm/v3/cmd/helm/helm.go:83
runtime.main
	runtime/proc.go:250
runtime.goexit
	runtime/asm_arm64.s:1172

The issue is Downloading https://github.com/mbenabda/helm-local-chart-version/releases/download/v666/helm-local-chart-version-666-darwin-arm64.tar.gz where v666 is from the local tag.

The issue is getting the version to download the binaries.

I think the line should look like this:

diff --git a/install-binary.sh b/install-binary.sh
index 6a6a6d9..e9d9d17 100755
--- a/install-binary.sh
+++ b/install-binary.sh
@@ -47,7 +47,7 @@ getDownloadURL() {
     exit 1
   fi

-  local version=$(git describe --tags --exact-match 2>/dev/null | sed s/^v//)
+  local version=$(git -C "$HELM_PLUGIN_DIR" describe --tags --exact-match 2>/dev/null | sed s/^v//)
   if [ -n "$version" ]; then
     DOWNLOAD_URL="https://github.com/${PROJECT_GH}/releases/download/v${version}/${PROJECT_NAME}-${version}-${OS}-${ARCH}.tar.gz"
   else

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.