Skip to content

Commit

Permalink
Merge pull request #5 from C123R/feat/multiChartsV2
Browse files Browse the repository at this point in the history
feat: adding support to push multiple chart from specific directory
  • Loading branch information
C123R authored Apr 13, 2020
2 parents 4b79cab + 74b8786 commit 60024db
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 37 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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
22 changes: 22 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 }}
30 changes: 0 additions & 30 deletions .travis.yml

This file was deleted.

31 changes: 27 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.1.0
v0.1.1
23 changes: 21 additions & 2 deletions cmd/helm-blob/push.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package cmd

import (
"os"
"path/filepath"

"github.com/C123R/helm-blob/pkg/repo"
"github.com/spf13/cobra"
)
Expand All @@ -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
},
Expand Down

0 comments on commit 60024db

Please sign in to comment.