From ba58c77ae0471c1f154bd36645e61d9657222565 Mon Sep 17 00:00:00 2001 From: stack72 Date: Tue, 12 Jan 2021 19:16:24 +0000 Subject: [PATCH] Adding support for pipenv environments --- Dockerfile | 3 +++ entrypoint.sh | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/Dockerfile b/Dockerfile index 2748ef30..6db419c9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,6 +18,9 @@ LABEL "homepage"="https://pulumi.com/docs/reference/cd-github-actions/" RUN apt-get update -y && \ apt-get install -y jq +# Install pipenv incase the user is using that over virtualenv +RUN pip install pipenv + # Copy the entrypoint script. COPY ./entrypoint.sh /usr/bin/pulumi-action diff --git a/entrypoint.sh b/entrypoint.sh index bea31a24..1c6e384f 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -130,12 +130,21 @@ if [ -e requirements.txt ]; then $PULUMI_VENV/bin/python -m pip install --upgrade pip setuptools wheel $PULUMI_VENV/bin/python -m pip install -r requirements.txt fi +elif [ -e Pipfile.lock ]; then + pipenv install + PULUMI_PREFIX="pipenv run" fi # Now just pass along all arguments to the Pulumi CLI, sending the output to a file for # later use. Note that we exit immediately on failure (under set -e), so we `tee` stdout, but # allow errors to be surfaced in the Actions log. +# If there is a PULUMI_PREFIX then we can just prepend it to the pulumi command PULUMI_COMMAND="pulumi $*" +if [ ! -z "$PULUMI_PREFIX" ] +then + PULUMI_COMMAND="$PULUMI_PREFIX pulumi $*" +fi + OUTPUT_FILE=$(mktemp) echo "#### :tropical_drink: \`$PULUMI_COMMAND\`" bash -c "$PULUMI_COMMAND" | tee $OUTPUT_FILE