diff --git a/Dockerfile b/Dockerfile index 5520dec..ee61046 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,11 +4,19 @@ ENV BASE_URL="https://get.helm.sh" ENV HELM_2_FILE="helm-v2.17.0-linux-amd64.tar.gz" ENV HELM_3_FILE="helm-v3.6.3-linux-amd64.tar.gz" +# make sure these variables are the same in index.js as Gitgub can change the user home +ENV HELM_CACHE_HOME="/root/.cache/helm" +ENV HELM_CONFIG_HOME="/root/.config/helm" +ENV HELM_DATA_HOME="/root/.local/share/helm" +ENV HELM_PLUGINS="/root/.local/share/helm/plugins" +ENV HELM_REGISTRY_CONFIG="/root/.config/helm/registry.json" +ENV HELM_REPOSITORY_CACHE="/root/.cache/helm/repository" +ENV HELM_REPOSITORY_CONFIG="/root/.config/helm/repositories.yaml" RUN apk add --no-cache ca-certificates \ --repository http://dl-3.alpinelinux.org/alpine/edge/community/ \ jq curl bash nodejs aws-cli py3-setuptools &&\ - apk add py3-pip && \ + apk add py3-pip git && \ pip3 install awscli RUN \ # Install helm version 2: @@ -22,7 +30,10 @@ RUN \ chmod +x /usr/bin/helm3 && \ rm -rf linux-amd64 && \ # Init version 2 helm: - helm init --client-only + helm init --client-only && \ + # install helm s3 plugin + helm3 plugin install https://github.com/hypnoglow/helm-s3.git + ENV PYTHONPATH "/usr/lib/python3.8/site-packages/" diff --git a/index.js b/index.js index 8e96c01..dad3039 100644 --- a/index.js +++ b/index.js @@ -205,11 +205,18 @@ async function run() { process.env.XDG_DATA_HOME = "/root/.helm/" process.env.XDG_CACHE_HOME = "/root/.helm/" process.env.XDG_CONFIG_HOME = "/root/.helm/" + process.env.HELM_CACHE_HOME="/root/.cache/helm" + process.env.HELM_CONFIG_HOME="/root/.config/helm" + process.env.HELM_DATA_HOME="/root/.local/share/helm" + process.env.HELM_PLUGINS="/root/.local/share/helm/plugins" + process.env.HELM_REGISTRY_CONFIG="/root/.config/helm/registry.json" + process.env.HELM_REPOSITORY_CACHE="/root/.cache/helm/repository" + process.env.HELM_REPOSITORY_CONFIG="/root/.config/helm/repositories.yaml" } else { process.env.HELM_HOME = "/root/.helm/" } - if (dryRun) args.push("--dry-run"); + if (dryRun == "true") args.push("--dry-run"); if (appName) args.push(`--set=app.name=${appName}`); if (version) args.push(`--set=app.version=${version}`); if (chartVersion) args.push(`--version=${chartVersion}`); @@ -252,6 +259,27 @@ async function run() { ignoreReturnCode: true }); } + let output = ""; + let error = ""; + let outputStdline = ""; + + const options = {}; + options.listeners = { + stdout: (data) => { + output += data.toString(); + }, + stderr: (data) => { + error += data.toString(); + }, + stdline: (data) => { + outputStdline += data; + }, + }; + let command = "helm3 plugin list " + core.debug(command) + await exec.exec(command, "", options) + core.debug("output =%s",output) + core.debug("stdline =%s", outputStdline) // Actually execute the deployment here. if (task === "remove") {