mixtool is a helper for easily working with jsonnet mixins.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
cmd/mixtool Rename BuildConfig to BuildOptions Sep 17, 2018
pkg/mixer Rename BuildConfig to BuildOptions Sep 17, 2018
scripts Generate examples for all commands and add examples in README.md Sep 14, 2018
vendor Commit vendor/ to allow for quicker go getting Sep 14, 2018
.gitignore Commit vendor/ to allow for quicker go getting Sep 14, 2018
.header Initial commit Sep 14, 2018
Gopkg.lock Commit vendor/ to allow for quicker go getting Sep 14, 2018
Gopkg.toml Commit vendor/ to allow for quicker go getting Sep 14, 2018
LICENSE
Makefile Initial commit Sep 14, 2018
README.md Make lint command consistent with J flag Sep 14, 2018
VERSION

README.md

mixtool

NOTE: This project is alpha stage. Flags, configuration, behavior and design may change significantly in following releases.

The mixtool is a helper for easily working with jsonnet mixins.

Install

go get -u github.com/metalmatze/mixtool/cmd/mixtool

Usage

All command line flags:

NAME:
   mixtool - Improves your jsonnet mixins workflow

USAGE:
   mixtool [global options] command [command options] [arguments...]

VERSION:
   v0.1.0-pre

DESCRIPTION:
   mixtool helps with generating, building and linting jsonnet mixins

COMMANDS:
     build     Build manifests from jsonnet input
     generate  Generate jsonnet mixin files
     lint      Lint jsonnet files
     help, h   Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h     show help
   --version, -v  print the version

Build

NAME:
   mixtool build - Build manifests from jsonnet input

USAGE:
   mixtool build [command options] [arguments...]

OPTIONS:
   --jpath value, -J value        
   --multi value, -m value        
   --output-file value, -o value  
   --yaml, -y                     
   

Build Examples

# The simplest example. It will use ./vendor if available and print YAML.
$ mixtool build prometheus.jsonnet
# These next lines are equivalent and both write to file.
$ mixtool build prometheus.jsonnet > prometheus.yaml
$ mixtool build --output-file prometheus.yaml prometheus.jsonnet
# Change the folder for imports.
$ mixtoo build --jpath /some/path/vendor prometheus.jsonnet
# Instead of writing YAML this will simply output JSON.
$ mixtool build --yaml=false prometheus.jsonnet > prometheus.json
# Write the output to multiple files in a give directory.
$ mixtool build --multi prometheus/ prometheus.jsonnet

Generate

NAME:
   mixtool generate - Generate files for Prometheus alerts & rules and Grafana dashboards as jsonnet mixin

USAGE:
   mixtool generate command [command options] [arguments...]

COMMANDS:
     grafana-dashboard  Generate a new file for a Grafana dashboard
     prometheus-alerts  Generate a new file for Prometheus alerts
     prometheus-rules   Generate a new file for Prometheus rules

OPTIONS:
   --help, -h  show help
   

Generate Examples

$ mixtool generate grafana-dashboard > my-dashboard.jsonnet
$ mixtool generate prometheus-alerts > my-alerts.jsonnet
$ mixtool generate prometheus-rules > my-rules.jsonnet

Lint

NAME:
   mixtool lint - Lint jsonnet files

USAGE:
   mixtool lint [command options] [arguments...]

DESCRIPTION:
   Lint jsonnet files for correct structure of JSON objects

OPTIONS:
   --grafana                Lint Grafana dashboards against Grafana's schema
   --prometheus             Lint Prometheus alerts and rules and their given expressions
   --jpath value, -J value  Add folders to be used as vendor folders
   

Lint Examples

# This will lint the file for Prometheus alerts & rules and Grafana dashboards.
$ mixtool lint prometheus.jsonnet
# Don't lint Grafana dashboards.
$ mixtool lint --grafana=false prometheus.jsonnet
# Don't lint Prometheus alerts & rules.
$ mixtool lint --prometheus=false prometheus.jsonnet
# Lint multiple files sequentially.
$ mixtool lint prometheus.jsonnet grafana.jsonnet