Skip to content
This repository has been archived by the owner on Oct 27, 2023. It is now read-only.

Commit

Permalink
fix: fixed path bug for windows version (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
belitre authored Mar 11, 2020
1 parent b068a81 commit 69df252
Show file tree
Hide file tree
Showing 9 changed files with 524 additions and 67 deletions.
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Helm push artifactory plugin

__WARNING: THIS VERSION IS FOR HELM 3, FOR HELM 2 PLEASE USE VERSION [v0.4.0](https://github.com/belitre/helm-push-artifactory-plugin/releases/tag/v0.4.0)__
__WARNING: THIS VERSION IS FOR HELM 3, FOR HELM 2 PLEASE USE VERSION [v0.4.1](https://github.com/belitre/helm-push-artifactory-plugin/releases/tag/v0.4.1)__

A Helm plugin to push helm charts to artifactory:

Expand All @@ -10,16 +10,18 @@ A Helm plugin to push helm charts to artifactory:

## Install

__IMPORTANT: by default `helm plugin install` will install the version from the master branch, and that version is for Helm v2, if you are using Helm v3 please add `--version 1.0.1` (or the version you want to use) to your `helm plugin install` command. Also please always use the flag `--version` in your CI/CD system to avoid surprises when new changes are merged to master!__

To install the version for Helm 3 you need to specify the version when installing using helm cli:

```
$ helm plugin install https://github.com/belitre/helm-push-artifactory-plugin --version v1.0.0
Downloading and installing helm-push-artifactory v1.0.0 ...
https://github.com/belitre/helm-push-artifactory-plugin/releases/download/v1.0.0/helm-push-artifactory_v1.0.0_darwin_amd64.tar.gz
$ helm plugin install https://github.com/belitre/helm-push-artifactory-plugin --version v1.0.1
Downloading and installing helm-push-artifactory v1.0.1 ...
https://github.com/belitre/helm-push-artifactory-plugin/releases/download/v1.0.1/helm-push-artifactory_v1.0.1_darwin_amd64.tar.gz
Installed plugin: push-artifactory
```

You can also download on one of the compressed files from [here](https://github.com/belitre/helm-push-artifactory-plugin/releases/tag/v1.0.0) and just extract it in your `$HELM_HOME/plugins/`
You can also download on one of the compressed files from [here](https://github.com/belitre/helm-push-artifactory-plugin/releases/tag/v1.0.1) and just extract it in your `$HELM_HOME/plugins/`

__Important for windows users: I really don't know how to make the `helm plugin install` command work on Windows :D so please just download the zip and extract it on your `$HELM_HOME/plugins/ folder :)__

Expand Down
6 changes: 3 additions & 3 deletions cmd/push/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (

"github.com/stretchr/testify/assert"

"helm.sh/helm/pkg/cli"
"helm.sh/helm/pkg/getter"
"helm.sh/helm/pkg/repo"
"helm.sh/helm/v3/pkg/cli"
"helm.sh/helm/v3/pkg/getter"
"helm.sh/helm/v3/pkg/repo"
)

var (
Expand Down
25 changes: 7 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
module github.com/belitre/helm-push-artifactory-plugin

go 1.13
go 1.14

require (
github.com/Masterminds/semver v1.5.0 // indirect
github.com/chartmuseum/helm-push v0.7.1
github.com/cyphar/filepath-securejoin v0.2.2 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/golang/protobuf v1.3.2 // indirect
github.com/jfrog/jfrog-client-go v0.5.2
github.com/pkg/errors v0.8.0
github.com/spf13/cobra v0.0.5
github.com/stretchr/testify v1.4.0
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.1.0 // indirect
gopkg.in/yaml.v2 v2.2.2
helm.sh/helm v3.0.0-beta.3+incompatible
k8s.io/api v0.0.0-20190927115716-5d581ce610b0 // indirect
k8s.io/client-go v11.0.0+incompatible // indirect
github.com/jfrog/jfrog-client-go v0.8.1
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v0.0.6
github.com/stretchr/testify v1.5.1
helm.sh/helm/v3 v3.1.1
k8s.io/apimachinery v0.17.3 // indirect
)
518 changes: 486 additions & 32 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/artifactory/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (c *client) UploadChartPackage(chartName, chartPackagePath string) (*http.R
return nil, err
}

u.Path = path.Join(u.Path, c.opts.path, chartName, path.Base(chartPackagePath))
u.Path = path.Join(u.Path, c.opts.path, chartName, filepath.Base(chartPackagePath))
req, err := buildRequest(u.String(), f)
if err != nil {
return nil, err
Expand Down
8 changes: 4 additions & 4 deletions pkg/helm/chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package helm
import (
"fmt"

"helm.sh/helm/pkg/chart"
"helm.sh/helm/pkg/chart/loader"
"helm.sh/helm/pkg/chartutil"
"helm.sh/helm/pkg/strvals"
"helm.sh/helm/v3/pkg/chart"
"helm.sh/helm/v3/pkg/chart/loader"
"helm.sh/helm/v3/pkg/chartutil"
"helm.sh/helm/v3/pkg/strvals"
)

type (
Expand Down
4 changes: 2 additions & 2 deletions pkg/repo/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"fmt"
"os"

"helm.sh/helm/pkg/helmpath"
"helm.sh/helm/pkg/repo"
"helm.sh/helm/v3/pkg/helmpath"
"helm.sh/helm/v3/pkg/repo"
)

type (
Expand Down
4 changes: 2 additions & 2 deletions plugin.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: "push-artifactory"
version: "1.0.0"
version: "1.0.1"
usage: "Please see https://github.com/belitre/helm-push-artifactory-plugin for usage"
description: "Push helm charts to artifactory"
ignoreFlags: false
useTunnel: false
command: "$HELM_PLUGIN_DIR/bin/helm-push-artifactory"
hooks:
install: "cd $HELM_PLUGIN_DIR; scripts/install_plugin.sh"
update: "cd $HELM_PLUGIN_DIR; scripts/install_plugin.sh"
update: "cd $HELM_PLUGIN_DIR; scripts/install_plugin.sh"
12 changes: 12 additions & 0 deletions scripts/install_plugin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ if [ -n "${HELM_PUSH_PLUGIN_NO_INSTALL_HOOK}" ]; then
exit 0
fi

supported_helm_version="v3"

helm_version="$(helm version | grep "Version" | cut -d '"' -f 2 | cut -d '.' -f 1)"

if [ "$helm_version" != "$supported_helm_version" ]; then
echo "Error, this version of helm-push-artifactory-plugin is only for Helm $supported_helm_version"
echo "Please check https://github.com/belitre/helm-push-artifactory-plugin to find the correct version"
exit 1
fi

echo "Installing plugin for Helm $supported_helm_version..."

version="$(cat plugin.yaml | grep "version" | cut -d '"' -f 2)"
echo "Downloading and installing helm-push-artifactory v${version} ..."

Expand Down

0 comments on commit 69df252

Please sign in to comment.