A jsonnet package manager.
Find a file
2019-03-12 19:00:08 +00:00
cmd/jb Add a newline at the end of jsonnetfile 2018-09-07 10:59:39 +02:00
pkg Check for existing jsonnetfile.json before init 2018-08-08 10:35:20 +02:00
scripts Initial commit 2018-04-24 16:01:37 +01:00
spec Add correct lockfile handling 2018-07-25 13:57:37 +02:00
vendor Vendor dependencies with dep and commit vendor/ 2018-04-28 16:12:36 +02:00
.gitignore Initial commit 2018-04-24 16:01:37 +01:00
.header Initial commit 2018-04-24 16:01:37 +01:00
CHANGELOG.md Initial commit 2018-04-24 16:01:37 +01:00
Dockerfile Initial commit 2018-04-24 16:01:37 +01:00
Gopkg.lock Vendor dependencies with dep and commit vendor/ 2018-04-28 16:12:36 +02:00
Gopkg.toml Vendor dependencies with dep and commit vendor/ 2018-04-28 16:12:36 +02:00
LICENSE Initial commit 2018-04-24 16:01:37 +01:00
Makefile Check for existing jsonnetfile.json before init 2018-08-08 10:35:20 +02:00
README.md Add usage examples to README.md 2019-03-12 19:00:08 +00:00
VERSION Initial commit 2018-04-24 16:01:37 +01:00

jsonnet-bundler

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

The jsonnet-bundler is a package manager for Jsonnet.

Install

go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb

Features

  • Fetches transitive dependencies
  • Can vendor subtrees, as opposed to whole repositories

Current Limitations

  • Always clones entire dependent repositories, even when updating
  • If two dependencies depend on the same package (diamond problem), they must require the same version

Example Usage

Initialize your project:

mkdir myproject
cd myproject
jb init

The existence of the jsonnetfile.json file means your directory is now a jsonnet-bundler package.

To depend on another package (another Github repository):

jb install https://github.com/anguslees/kustomize-libsonnet

Now write myconfig.jsonnet, which can import a file from that package.

local kustomize = import 'vendor/kustomize-libsonnet/kustomize.libsonnet';

local my_resource = {
  metadata: {
    name: 'my-resource',
  },
};

kustomize.namePrefix('staging-')(my_resource)

Depend on a package that is in a subtree of a Github repo (this package also happens to bring in a transitive dependency):

jb install https://github.com/coreos/prometheus-operator/jsonnet/prometheus-operator

Note that if you are copy pasting from the Github website's address bar, remove the tree/master from the path.

If pushed to Github, your project can now be referenced from other packages in the same way.

All command line flags

$ jb -h
usage: jb [<flags>] <command> [<args> ...]

A jsonnet package manager

Flags:
  -h, --help  Show context-sensitive help (also try --help-long and --help-man).
      --jsonnetpkg-home="vendor"  
              The directory used to cache packages in.

Commands:
  help [<command>...]
    Show help.

  init
    Initialize a new empty jsonnetfile

  install [<packages>...]
    Install all dependencies or install specific ones

  update
    Update all dependencies.