-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dont. push. me. cause. im. close. to. the. edddggee
- Loading branch information
0 parents
commit 577bd5d
Showing
36 changed files
with
1,475 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
**/*.pyc | ||
**/*.tgz | ||
**/*.tgz.prov | ||
.chartmuseum.log | ||
.cover/ | ||
.helm/ | ||
.idea/ | ||
.robot/ | ||
.venv/ | ||
bin/ | ||
dist/ | ||
releases/ | ||
testbin/ | ||
vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
builds: | ||
- main: ./cmd/helmpush | ||
binary: ./bin/helmpush | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- darwin | ||
- linux | ||
- windows | ||
goarch: | ||
- amd64 | ||
|
||
archive: | ||
format: tar.gz | ||
files: | ||
- LICENSE | ||
- plugin.yaml |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[[constraint]] | ||
name = "github.com/spf13/cobra" | ||
version = "0.0.2" | ||
|
||
[[constraint]] | ||
name = "k8s.io/helm" | ||
version = "2.9.0-rc3" | ||
|
||
[prune] | ||
go-tests = true | ||
unused-packages = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2018 ChartMuseum | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
PLUGIN_NAME := push | ||
|
||
HAS_DEP := $(shell command -v dep;) | ||
HAS_PIP := $(shell command -v pip;) | ||
HAS_VENV := $(shell command -v virtualenv;) | ||
|
||
.PHONY: bootstrap | ||
bootstrap: | ||
ifndef HAS_DEP | ||
@go get -u github.com/golang/dep/cmd/dep | ||
endif | ||
@dep ensure -v -vendor-only | ||
|
||
.PHONY: build | ||
build: build_linux build_mac build_windows | ||
|
||
build_windows: export GOARCH=amd64 | ||
build_windows: | ||
@GOOS=windows go build -v --ldflags="-w -X main.Version=$(VERSION) -X main.Revision=$(REVISION)" \ | ||
-o bin/windows/amd64/helmpush cmd/helmpush/main.go # windows | ||
|
||
link_windows: | ||
@cp bin/windows/amd64/helmpush ./bin/helmpush | ||
|
||
build_linux: export GOARCH=amd64 | ||
build_linux: export CGO_ENABLED=0 | ||
build_linux: | ||
@GOOS=linux go build -v --ldflags="-w -X main.Version=$(VERSION) -X main.Revision=$(REVISION)" \ | ||
-o bin/linux/amd64/helmpush cmd/helmpush/main.go # linux | ||
|
||
link_linux: | ||
@cp bin/linux/amd64/helmpush ./bin/helmpush | ||
|
||
build_mac: export GOARCH=amd64 | ||
build_mac: export CGO_ENABLED=0 | ||
build_mac: | ||
@GOOS=darwin go build -v --ldflags="-w -X main.Version=$(VERSION) -X main.Revision=$(REVISION)" \ | ||
-o bin/darwin/amd64/helmpush cmd/helmpush/main.go # mac osx | ||
@cp bin/darwin/amd64/helmpush ./bin/helmpush # For use w make install | ||
|
||
link_mac: | ||
@cp bin/darwin/amd64/helmpush ./bin/helmpush | ||
|
||
.PHONY: clean | ||
clean: | ||
@git status --ignored --short | grep '^!! ' | sed 's/!! //' | xargs rm -rf | ||
|
||
.PHONY: test | ||
test: setup-test-environment | ||
@./scripts/test.sh | ||
|
||
.PHONY: covhtml | ||
covhtml: | ||
@go tool cover -html=.cover/cover.out | ||
|
||
.PHONY: tree | ||
tree: | ||
@tree -I vendor | ||
|
||
.PHONY: release | ||
release: | ||
@scripts/release.sh $(VERSION) | ||
|
||
.PHONY: install | ||
install: | ||
HELM_PUSH_PLUGIN_NO_INSTALL_HOOK=1 helm plugin install $(shell pwd) | ||
|
||
.PHONY: remove | ||
remove: | ||
helm plugin remove $(PLUGIN_NAME) | ||
|
||
.PHONY: setup-test-environment | ||
setup-test-environment: | ||
ifndef HAS_PIP | ||
@apt-get update && apt-get install -y python-pip | ||
endif | ||
ifndef HAS_VENV | ||
@pip install virtualenv | ||
endif | ||
@./scripts/setup_test_environment.sh | ||
|
||
.PHONY: acceptance | ||
acceptance: setup-test-environment | ||
@./scripts/acceptance.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# helm push plugin | ||
<img align="right" src="https://github.com/kubernetes-helm/chartmuseum/raw/master/logo.png"> | ||
|
||
[![Codefresh build status]( https://g.codefresh.io/api/badges/build?repoOwner=chartmuseum&repoName=helm-push&branch=master&pipelineName=helm-push&accountName=codefresh-inc&type=cf-2)]( https://g.codefresh.io/repositories/chartmuseum/helm-push/builds?filter=trigger:build;branch:master;service:5ad4eed637adc30001207fab~helm-push) | ||
|
||
Helm plugin to push chart package to [ChartMuseum](https://github.com/kubernetes-helm/chartmuseum) | ||
|
||
## Install | ||
Based on the version in `plugin.yaml`, release binary will be downloaded from GitHub: | ||
|
||
``` | ||
$ helm plugin install https://github.com/chartmuseum/helm-push | ||
Downloading and installing helm-push v0.1.0 ... | ||
https://github.com/chartmuseum/helm-push/releases/download/v0.1.0/helm-push_0.1.0_darwin_amd64.tar.gz | ||
Installed plugin: push | ||
``` | ||
|
||
## Usage | ||
You must start by adding a ChartMuseum-backed repo via Helm CLI (if not already added) | ||
``` | ||
$ helm repo add chartmuseum http://localhost:8080 | ||
``` | ||
For all available plugin options, please run | ||
``` | ||
$ helm push --help | ||
``` | ||
|
||
### Pushing a directory | ||
Point to a directory containing a valid `Chart.yaml` and the chart will be packaged and uploaded: | ||
``` | ||
$ cat mychart/Chart.yaml | ||
name: mychart | ||
version: 0.3.2 | ||
``` | ||
``` | ||
$ helm push mychart/ chartmuseum | ||
Pushing mychart-0.3.2.tgz to chartmuseum... | ||
Done. | ||
``` | ||
|
||
### Pushing with a custom version | ||
The `--version` flag can be provided, which will push the package with a custom version. | ||
|
||
Here is an example using the last git commit id as the version: | ||
``` | ||
$ helm push mychart/ --version="$(git log -1 --pretty=format:%h)" chartmuseum | ||
Pushing mychart-5abbbf28.tgz to chartmuseum... | ||
Done. | ||
``` | ||
If you want to enable something like `--version="latest"`, which you intend to push regularly, you will need to run your ChartMuseum server with `ALLOW_OVERWRITE=true`. | ||
|
||
### Push .tgz package | ||
This workflow does not require the use of `helm package`, but pushing .tgzs is still suppported: | ||
``` | ||
$ helm push mychart-0.3.2.tgz chartmuseum | ||
Pushing mychart-0.3.2.tgz to chartmuseum... | ||
Done. | ||
``` | ||
|
||
## Authentication | ||
If you have added your repo with the `--username`/`--password` flags (Helm 2.9+), or have added your repo with the basic auth username/password in the URL (e.g. `https://myuser:[email protected]`), no further setup is required. | ||
|
||
The plugin will use the auth info located in `~/.helm/repository/repositories.yaml` in order to authenticate. | ||
|
||
If you are running ChartMuseum with `AUTH_ANONYMOUS_GET=true`, and have added your repo without authentication, the plugin recognizes the following environment variables for basic auth on push operations: | ||
``` | ||
$ export HELM_REPO_USERNAME="myuser" | ||
$ export HELM_REPO_PASSWORD="mypass" | ||
``` | ||
|
||
With this setup, you can enable people to use your repo for installing charts etc. without allowing them to upload to it. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
*** Settings *** | ||
Documentation Tests to verify that helm-push can be used to | ||
... successfully push a package to chartmuseum server | ||
Library lib/ChartMuseum.py | ||
Library lib/Helm.py | ||
Library lib/HelmPush.py | ||
Suite Setup Suite Setup | ||
Suite Teardown Suite Teardown | ||
|
||
*** Test Cases *** | ||
Chart directory can be pushed to ChartMuseum | ||
push chart directory | ||
HelmPush.return code should be 0 | ||
package exists in chartmuseum storage | ||
ChartMuseum.return code should be 0 | ||
clear chartmuseum storage | ||
|
||
Chart directory can be pushed to ChartMuseum with custom version | ||
push chart directory latest | ||
HelmPush.return code should be 0 | ||
package exists in chartmuseum storage latest | ||
ChartMuseum.return code should be 0 | ||
clear chartmuseum storage | ||
|
||
Chart package can be pushed to ChartMuseum | ||
push chart package | ||
HelmPush.return code should be 0 | ||
package exists in chartmuseum storage | ||
ChartMuseum.return code should be 0 | ||
clear chartmuseum storage | ||
|
||
Chart package can be pushed to ChartMuseum with custom version | ||
push chart package latest | ||
HelmPush.return code should be 0 | ||
package exists in chartmuseum storage latest | ||
ChartMuseum.return code should be 0 | ||
clear chartmuseum storage | ||
|
||
*** Keywords *** | ||
Suite Setup | ||
remove chartmuseum logs | ||
start chartmuseum | ||
Sleep 2 | ||
add chart repo | ||
|
||
Suite Teardown | ||
remove chart repo | ||
stop chartmuseum | ||
print chartmuseum logs |
Oops, something went wrong.
577bd5d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://www.youtube.com/watch?v=8LknX42rx1c