From cbbd6ff6e9eb25ce092a5241e80b96b260b8b75c Mon Sep 17 00:00:00 2001 From: yoshi-1224 Date: Thu, 12 Sep 2019 08:56:25 +0900 Subject: [PATCH] Update build.sh, remove COPY tests from Dockerfile.ci --- Dockerfile.ci | 1 - kapitan/inputs/helm/build.sh | 32 ++++++++++++++++++-------------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/Dockerfile.ci b/Dockerfile.ci index e9ebef377..a32e08f93 100644 --- a/Dockerfile.ci +++ b/Dockerfile.ci @@ -54,5 +54,4 @@ RUN curl -L -o /usr/local/bin/kbld ${KBLD_URL} && chmod +x /usr/local/bin/kbld COPY --from=go-env /go/bin/promtool /usr/local/bin/ -COPY tests/test_resources /examples CMD ["/bin/bash"] diff --git a/kapitan/inputs/helm/build.sh b/kapitan/inputs/helm/build.sh index c0e746fe4..c2848ec1c 100755 --- a/kapitan/inputs/helm/build.sh +++ b/kapitan/inputs/helm/build.sh @@ -1,27 +1,31 @@ #!/usr/bin/env bash -if ! command -v go >/dev/null 2>&1; then - echo 'go is required to build the helm template binding' - exit 1 -fi - cd $(dirname "$0") pwd -so_name=libtemplate.so -go build -buildmode=c-shared -o $so_name template.go -if [ -e $so_name ] -then +so_name="libtemplate.so" + +# Compile the binding if a Go runtime exists +if [[ -z $(which go) ]]; then + echo "[WARN] go is not available on this system -- skipping Helm binding build!" +else + go build -buildmode=c-shared -o $so_name template.go +fi + +# Validate that the compiled binding exists +if [[ -e $so_name ]]; then echo "$so_name built successfully" else - echo "error building $so_name. Exiting" + echo "[ERROR] $so_name does not exist!" exit 1 fi -if ! command -v python3 >/dev/null 2>&1; then - echo 'python3 is not available on this system. Skipping cffi build' - exit 0 +# Compile the Python ffi binding if Python is available +if [[ -z $(which python3) ]]; then + echo "[WARN] python3 is not available on this system -- skipping cffi build!" else - echo 'Building the Python binding using cffi' + echo "Building the Python binding using cffi" python3 cffi_build.py fi + +exit 0