Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@michaellihs
Last active May 24, 2019 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaellihs/09ed1a4c527a54c1a5f010b95579b6ee to your computer and use it in GitHub Desktop.
Save michaellihs/09ed1a4c527a54c1a5f010b95579b6ee to your computer and use it in GitHub Desktop.
jsonnet

jsonnet

CLI usage

  • Output result in YAML

    jsonnet ci/pipeline.jsonnet
  • Using external file as parameters

    jsonnet --ext-code-file "config=ci/config/de1/settings.libsonnet" ci/pipeline.jsonnet

    where ci/config/de1/settings.libsonnet is the 'parameter file' and ci/pipeline.jsonnet is what needs to be parametrized.

    Within the parametrized .jsonnet:

    local config = std.extVar('config');
    
    {
      vcenter_password: config.vcenter_password
    }
    

User jsonnet in Docker Image

FROM robotgraves/flycli AS builder

RUN apt-get install -y build-essential git

WORKDIR /opt

RUN git clone https://github.com/google/jsonnet.git jsonnet
RUN cd jsonnet && make


FROM robotgraves/flycli

COPY --from=builder /opt/jsonnet/jsonnet /usr/local/bin

Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment