From 1cc689ba66d2cafade1d2ba598ec8e52d1073bde Mon Sep 17 00:00:00 2001 From: Alex Williams Date: Mon, 29 Mar 2021 16:16:12 +0100 Subject: [PATCH] Add support for KAPITAN_IMAGE environment variable --- README.md | 6 +++++- hooks/kapitan-compile.sh | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5123b3e..4facabf 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,11 @@ A collection of pre-commit hooks for [https://github.com/pre-commit/pre-commit]( ## Hooks -- **kapitan-compile**: Compiles [Kapitan](https://kapitan.dev) templates +### `kapitan-compile` + +Compiles [Kapitan](https://kapitan.dev) templates. Supports the `KAPITAN_IMAGE` +environment variable which should be the docker image to use. Defaults to: +`deepmind/kapitan:v0.29.5`. ## Development dependencies diff --git a/hooks/kapitan-compile.sh b/hooks/kapitan-compile.sh index 603667a..853fd5f 100755 --- a/hooks/kapitan-compile.sh +++ b/hooks/kapitan-compile.sh @@ -1,6 +1,8 @@ #!/bin/sh -set -eu +set -eux + +KAPITAN_IMAGE="${KAPITAN_IMAGE:-deepmind/kapitan:v0.29.5}" # shellcheck disable=SC2068 -docker run -t --rm -v "${PWD}":/src:delegated deepmind/kapitan:0.27.2 compile $@ +docker run -t --rm -v "${PWD}":/src:delegated "${KAPITAN_IMAGE}" compile "$@"