#cli-tool #jsonnet #nomad #configuration-language #job #hashi-corp #specs

app nomadcfg

A CLI tool for defining HashiCorp Nomad job specs in jsonnet

6 releases

0.0.6 Aug 12, 2023
0.0.5 Jun 7, 2023
0.0.3 May 30, 2023

#993 in Command line utilities

Download history 1/week @ 2024-02-08 80/week @ 2024-02-15 3/week @ 2024-02-22 1/week @ 2024-02-29

85 downloads per month

Apache-2.0

105KB
3.5K SLoC

nomadcfg

A CLI tool for defining HashiCorp Nomad job specs in jsonnet. Unofficial. Not related to HashiCorp.

Very experimental! The code is still PoC quality. Don't use yet.

About

The official Nomad CLI tool nomad is able to ingest job specifications in JSON instead of HCL, which allows other configuration languages to produce such job specs. nomadcfg is an attempt to use jsonnet for this. It's similar to kubecfg for Kubernetes.

Installation

cargo install --locked nomadcfg
cargo install --git https://github.com/cloneable/nomadcfg

Usage

myjob.jsonnet:

local job(name, namespace='default') = {
  type: 'service',
  id: self.name,
  name: name,
  namespace: namespace,
  // ...
};

{
  job: job('myjob', 'biz') {
    // job definition
  }

  // helper definitions (ignored by nomadcfg)
}
nomadcfg print myjob.jsonnet
{
  "Job": {
    "ID": "myjob",
    "Name": "myjob",
    "Namespace": "biz",
    "Type": "service"
  }
}

Dependencies

~9–23MB
~352K SLoC