diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c80f72c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,25 @@ +name: ci +on: + push: + branches: + - master + - helmV2 + pull_request: + branches: + - master + - helmV2 +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@master + - name: Setup Go + uses: actions/setup-go@v1 + with: + go-version: 1.13 + - name: GoReleaser + uses: goreleaser/goreleaser-action@v1 + with: + version: latest + args: release --snapshot --rm-dist diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f6cac9d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,22 @@ +name: release +on: + push: + tags: + - "v*.*.*" +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@master + - name: Setup Go + uses: actions/setup-go@v1 + with: + go-version: 1.13 + - name: GoReleaser + uses: goreleaser/goreleaser-action@v1 + with: + version: latest + args: release --rm-dist + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9265f7d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -language: go -go: - - "1.13" - -env: - - GO111MODULE=on - -before_install: - - sudo apt-get update - - sudo apt-get install -y libpcap-dev gcc - -install: - - go mod download - -after_success: - # Set up git user name and tag this commit - - git config --global user.email "travis@travis-ci.org" - - git config --global user.name "Travis CI" - - export TRAVIS_TAG=${TRAVIS_TAG:-$(cat VERSION)} - - git tag -a $TRAVIS_TAG $(git log --format=%h -1) -m "Generated tag from Travis CI based on VERSION file" - - test -n "$TRAVIS_TAG" && curl -s https://raw.githubusercontent.com/goreleaser/get/master/latest | bash - -deploy: - - provider: script - github_token: $GITHUB_TOKEN - skip_cleanup: true - script: curl -sL https://git.io/goreleaser | bash - -notifications: - email: false diff --git a/README.md b/README.md index 305bcb0..6a84a32 100644 --- a/README.md +++ b/README.md @@ -11,19 +11,34 @@ This plugin uses Go Cloud's [Blob](https://gocloud.dev/howto/blob/) package. ## Installation ```sh -helm plugin install https://github.com/C123R/helm-blob +helm plugin install https://github.com/C123R/helm-blob.git +``` + +To install specific version of: + +```sh +helm plugin install https://github.com/C123R/helm-blob.git --version 0.2.0 +``` + +### If you are still using Helm Below Version 3: + +```sh +helm plugin install https://github.com/C123R/helm-blob.git --version 0.1.1 ``` ## Usage +**Note:** This plugin will not provide new blob storage, You must first create blob storage container/bucket that will be used as a remote chart repository. + - ### Initialize a new chart repository ```sh helm blob init azblob://helmrepo - ``` - Note: This command will not create new blob storage, moreover - it will just add empty index.yaml file. + OR + + helm blob init gs://helmrepo/charts + ``` - ### Add your repository to Helm @@ -37,6 +52,14 @@ helm plugin install https://github.com/C123R/helm-blob helm blob push mychart.tar.gz azurehelm ``` + You can also push multiple charts from specific directory: + + ```sh + helm blob push helm-charts/ gcsblob azurehelm + ``` + + This will publish all charts under helm-charts directory. + - ### Updating Helm cache (Required after pushing new chart) ```sh diff --git a/VERSION b/VERSION index 9ff151c..a1c2c6a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v0.1.0 \ No newline at end of file +v0.1.1 \ No newline at end of file diff --git a/cmd/helm-blob/push.go b/cmd/helm-blob/push.go index 2928d82..a67b5cb 100644 --- a/cmd/helm-blob/push.go +++ b/cmd/helm-blob/push.go @@ -1,6 +1,9 @@ package cmd import ( + "os" + "path/filepath" + "github.com/C123R/helm-blob/pkg/repo" "github.com/spf13/cobra" ) @@ -18,13 +21,29 @@ with remote index file. `, Example: `helm blob push sample-chart.tgz sample-repository`, RunE: func(cmd *cobra.Command, args []string) error { - chart, repositoryName := args[0], args[1] + var charts []string + chartpath, repositoryName := args[0], args[1] r, err := repo.NewRepoByName(repositoryName) if err != nil { return err } - if err = r.Push(chart, force); err != nil { + f, err := os.Stat(chartpath) + switch { + case err != nil: return err + case f.IsDir(): + charts, err = filepath.Glob(filepath.Join(chartpath, "*.tgz")) + if err != nil { + return err + } + default: + charts = append(charts, chartpath) + } + + for _, chart := range charts { + if err = r.Push(chart, force); err != nil { + return err + } } return nil },