diff --git a/.gitignore b/.gitignore index a3b1a14..e812bef 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,9 @@ *~ .idea +# Built binaries +chartify +chartreposerver + # testdata testdata/kustomize_with_helm_charts/charts/ diff --git a/Makefile b/Makefile index 105a0c5..f2fe57b 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,26 @@ +.PHONY: all +all: build + +.PHONY: build +build: build-chartify build-chartreposerver + +.PHONY: build-chartify +build-chartify: + go build -o chartify ./cmd/chartify + +.PHONY: build-chartreposerver +build-chartreposerver: + go build -o chartreposerver ./cmd/chartreposerver + +.PHONY: install +install: + go install ./cmd/chartify + go install ./cmd/chartreposerver + +.PHONY: clean +clean: + rm -f chartify chartreposerver + .PHONY: test test: go test ./... diff --git a/README.md b/README.md index 3deafac..81e7329 100644 --- a/README.md +++ b/README.md @@ -6,14 +6,118 @@ `chartify` is intended to be run immediately before running `helm upgrade --install`. For example, instead of forking a helm chart, you should be able to prepend a `chartify` step into your deployment job in your CD pipeline. `chartify` isn't intended to create a fork of a chart. The output of `chartify` is a helm chart that is pre-rendered with all the helm values provided to `chartify`. +## Prerequisites + +- Go 1.24.0 or later +- Helm 3.x (required for chart operations) + +## Building and Installation + +### Building from Source + +To build the binaries locally: + +```bash +# Build both chartify and chartreposerver binaries +make build + +# Or build them individually +make build-chartify +make build-chartreposerver + +# Clean up built binaries +make clean +``` + +### Installing + +To install the binaries to your `$GOPATH/bin`: + +```bash +make install +``` + +Or install directly with Go: + +```bash +go install github.com/helmfile/chartify/cmd/chartify@latest +go install github.com/helmfile/chartify/cmd/chartreposerver@latest +``` + ## CLI Beyond it's usage with helmfile, it also provides a basic CLI application that can be run independently. +### chartify + The simplest usage of the command is: -``` +```bash $ chartify $RELEASE $CHART -o $OUTPUT_DIR ``` -See `chartify -h` or `go run ./cmd/chartify -h` for more information. +#### Examples + +Convert a local chart: +```bash +$ ./chartify myrelease ./my-chart -o ./output +``` + +Convert with additional dependencies: +```bash +$ ./chartify myrelease ./my-chart -o ./output -d "redis=redis:6.0.0" +``` + +Include CRDs in the output: +```bash +$ ./chartify myrelease ./my-chart -o ./output --include-crds +``` + +Apply a strategic merge patch: +```bash +$ ./chartify myrelease ./my-chart -o ./output --strategic-merge-patch ./patch.yaml +``` + +#### Full Usage + +See `chartify -h` or `go run ./cmd/chartify -h` for more information: + +``` +Usage of chartify: + -d value + one or more "alias=chart:version" to add adhoc chart dependencies + -f string + The path to the input file or stdout(-) (default "-") + -include-crds + Whether to render CRDs contained in the chart and include the results into the output + -o string + The path to the output directory (required) + -strategic-merge-patch string + Path to a kustomize strategic merge patch file +``` + +### chartreposerver + +A simple chart repository server for development and testing: + +```bash +$ ./chartreposerver /path/to/charts/directory +``` + +The server will start on port 18080 and serve charts from the specified directory. + +## Development + +### Running Tests + +```bash +# Run all tests +make test + +# Run tests with verbose output and retain temp directories +make test/verbose +``` + +### Linting + +This project uses golangci-lint. The configuration is in `.golangci.yaml`.