/eng-concourse-resource-dhall

A Concourse resource for fetching remote Dhall expressions.

Primary LanguageShellApache License 2.0Apache-2.0

Dhall Concourse Resource Type

Docker Repository on Quay

A Concourse resource for fetching remote Dhall expressions.

While this resource will technically work with Dhall expressions that do not include remote imports, such expressions have constant hashes and it rather defeats the purpose of having a Concourse resource to track changes.

Recommended Usage

Because Dhall's performance is highly dependent upon the presence of a warm cache, you are recommended to extend this image with one that already has a warmed cache of the libraries which you use.

In other words, you should build a custom image with, e.g. (note: you cannot use <<< in a Dockerfile, that's the reason for the piped echo call):

FROM quay.io/coralogix/eng-concourse-resource-dhall:v1.39.0

RUN set -ex; \
    echo 'https://raw.githubusercontent.com/dhall-lang/dhall-lang/v16.0.0/Prelude/package.dhall' | dhall >/dev/null ; \
    echo 'https://raw.githubusercontent.com/dhall-lang/dhall-kubernetes/v4.0.0/package.dhall'    | dhall >/dev/null ; \
    echo 'https://raw.githubusercontent.com/coralogix/dhall-kops/v0.6.3/package.dhall'           | dhall >/dev/null

and use that image instead in the source for the resource_types.

Source Configuration

  • expression : Required (string). A Dhall expression that is fed directly to the dhall executable, e.g. { foo = "bar" }
  • ascii : Optional (bool). Wheter to pass the --ascii flag to the dhall executable. Defaults to false.
  • censor : Optional (bool). Whether to pass the --censor flag to the dhall executable. Defaults to false.
  • explain : Optional (bool). Whether to pass the --explain flag to the dhall executable. Defaults to false.
  • environment_variables : Optional (object). Adds the included environment variables when running the dhall executable. See example usage below.

Example Usage

Resource type definition

resource_types:
- name: dhall
  type: registry-image
  source:
    repository: quay.io/coralogix/eng-concourse-resource-dhall
    tag: v1.39.0

Fetching the latest Prelude

resources:
- name: dhall-prelude
  type: dhall
  source:
    expression: https://prelude.dhall-lang.org/package.dhall

Fetching a sensitive configuration from a private GitHub repository

resources:
- name: sensitive-configuration
  type: dhall
  source:
    expression: |
      let Config = { private : Text }
      in https://raw.githubusercontent.com/myorg/myrepo/master/config.dhall
           using
           ( toMap
               { Authorization =
                   "token ${env:GITHUB_TOKEN as Text}"
               }
           ) : Config
    censor: true
    environment_variables:
      GITHUB_TOKEN: "((github-token))"

Behavior

check : Check for a change in the Dhall expression

The Dhall expression is evaluated and its hash is retrieved as this resource's version. There are no parameters.

in : Fetch the Dhall expression

The Dhall expression is evaluated into normal form and output into the resource's directory as normal.dhall. There are no parameters.

out : Not supported

Maintainers

Ari Becker Oded David

License

Apache License 2.0 © Coralogix, Inc.