From 0116a1fc25daba6649b86af91432007d16743be4 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 10:26:26 -0300 Subject: [PATCH 01/38] Installs helm-s3 plugin --- Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5520dec2..de04e279 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ ENV HELM_3_FILE="helm-v3.6.3-linux-amd64.tar.gz" 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 +22,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/" From 0feab198d3beec069cf337b9b589bc51a0bb7603 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 14:14:55 -0300 Subject: [PATCH 02/38] Passes credentials to exec action --- index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 8e96c01d..52ce613c 100644 --- a/index.js +++ b/index.js @@ -259,7 +259,13 @@ async function run() { ignoreReturnCode: true }); } else { - await exec.exec(helm, args); + await exec.exec(helm, args, { + env: { + AWS_ACCESS_KEY_ID: process.env.aws_access_key_id, + AWS_SECRET_ACCESS_KEY: process.env.aws_secret_access_key, + AWS_DEFAULT_REGION: process.env.aws_region + }, + }); } await status(task === "remove" ? "inactive" : "success"); From d5d4e61188e6e994235f7cbb587e746b4ddf153c Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 14:22:50 -0300 Subject: [PATCH 03/38] Uppercase env variables --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 52ce613c..491f69c4 100644 --- a/index.js +++ b/index.js @@ -261,9 +261,9 @@ async function run() { } else { await exec.exec(helm, args, { env: { - AWS_ACCESS_KEY_ID: process.env.aws_access_key_id, - AWS_SECRET_ACCESS_KEY: process.env.aws_secret_access_key, - AWS_DEFAULT_REGION: process.env.aws_region + AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID, + AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY, + AWS_DEFAULT_REGION: process.env.AWS_DEFAULT_REGION }, }); } From 51a78d7a8c719fc0f59239baedeb6a39b775f9e4 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 14:41:59 -0300 Subject: [PATCH 04/38] Passes env to exec.exec --- index.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/index.js b/index.js index 491f69c4..0cc090cc 100644 --- a/index.js +++ b/index.js @@ -261,9 +261,7 @@ async function run() { } else { await exec.exec(helm, args, { env: { - AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID, - AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY, - AWS_DEFAULT_REGION: process.env.AWS_DEFAULT_REGION + ...process.env }, }); } From 49739f37fba5d254b3378bb95f47ca4c4f4d25c3 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 14:49:45 -0300 Subject: [PATCH 05/38] Adds debug --- index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/index.js b/index.js index 0cc090cc..a969d81a 100644 --- a/index.js +++ b/index.js @@ -253,6 +253,7 @@ async function run() { }); } + core.debug(...process.env); // Actually execute the deployment here. if (task === "remove") { await exec.exec(helm, deleteCmd(helm, namespace, release), { From 2ebab0014948f50932144d88709ddd74e8440cd0 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 15:24:17 -0300 Subject: [PATCH 06/38] Inserts env vars in exec --- index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index a969d81a..b9eee07c 100644 --- a/index.js +++ b/index.js @@ -252,7 +252,15 @@ async function run() { ignoreReturnCode: true }); } - + core.debug("process env:"); + await exec.exec(helm, ["repo", "update"], { + env: { + AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID , + AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY , + AWS_DEFAULT_REGION: us-east-1 + }, + }); + core.debug(process.env.AWS_ACCESS_KEY_ID); core.debug(...process.env); // Actually execute the deployment here. if (task === "remove") { From 237efab1ea5bef76b7e3b067dd5987fcff084953 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 15:30:10 -0300 Subject: [PATCH 07/38] Fixes quote typo --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index b9eee07c..639e8b34 100644 --- a/index.js +++ b/index.js @@ -257,7 +257,7 @@ async function run() { env: { AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID , AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY , - AWS_DEFAULT_REGION: us-east-1 + AWS_DEFAULT_REGION: "us-east-1" }, }); core.debug(process.env.AWS_ACCESS_KEY_ID); From 640b954db7211d2374574e34d1645f4e3115512d Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 15:31:15 -0300 Subject: [PATCH 08/38] Fixes quote typo --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 639e8b34..b407a6ad 100644 --- a/index.js +++ b/index.js @@ -260,8 +260,8 @@ async function run() { AWS_DEFAULT_REGION: "us-east-1" }, }); - core.debug(process.env.AWS_ACCESS_KEY_ID); - core.debug(...process.env); + core.debug(process.env.AWS_ACCESS_KEY_ID); + // Actually execute the deployment here. if (task === "remove") { await exec.exec(helm, deleteCmd(helm, namespace, release), { From 569b2a485e51fb206268497b20705a5cae301233 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 15:36:24 -0300 Subject: [PATCH 09/38] Removes repo add command --- index.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/index.js b/index.js index b407a6ad..75348490 100644 --- a/index.js +++ b/index.js @@ -253,13 +253,6 @@ async function run() { }); } core.debug("process env:"); - await exec.exec(helm, ["repo", "update"], { - env: { - AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID , - AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY , - AWS_DEFAULT_REGION: "us-east-1" - }, - }); core.debug(process.env.AWS_ACCESS_KEY_ID); // Actually execute the deployment here. From 30fe33ac5c29e628c90b6a1788f2161a987894b8 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 15:42:17 -0300 Subject: [PATCH 10/38] Inserts env vars in exec --- index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 75348490..1396d626 100644 --- a/index.js +++ b/index.js @@ -263,7 +263,9 @@ async function run() { } else { await exec.exec(helm, args, { env: { - ...process.env + AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID , + AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY , + AWS_DEFAULT_REGION: "us-east-1" }, }); } From 10a412ce8ac4566c0a087a889a082aa1824f62d1 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 16:16:56 -0300 Subject: [PATCH 11/38] Adds KUBECONFIG file to env --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 1396d626..83238ffb 100644 --- a/index.js +++ b/index.js @@ -265,7 +265,8 @@ async function run() { env: { AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID , AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY , - AWS_DEFAULT_REGION: "us-east-1" + AWS_DEFAULT_REGION: "us-east-1", + KUBECONFIG: "./kubeconfig.yml" }, }); } From 888d7654e4e05b9df3d8202a80a526e76798dc44 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 16:20:19 -0300 Subject: [PATCH 12/38] Adds process.env to helm exec --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 83238ffb..f8707a6b 100644 --- a/index.js +++ b/index.js @@ -266,7 +266,7 @@ async function run() { AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID , AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY , AWS_DEFAULT_REGION: "us-east-1", - KUBECONFIG: "./kubeconfig.yml" + ...process.env }, }); } From 0d621419548344d282ef593b5d9aff3600f0ce5e Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 16:22:16 -0300 Subject: [PATCH 13/38] Adds process.env to helm exec --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index f8707a6b..b23fe411 100644 --- a/index.js +++ b/index.js @@ -263,10 +263,10 @@ async function run() { } else { await exec.exec(helm, args, { env: { + ...process.env, AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID , AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY , AWS_DEFAULT_REGION: "us-east-1", - ...process.env }, }); } From 591bbc049ba1df0e4dd9732bb7b3dd3a6202599b Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 16:27:02 -0300 Subject: [PATCH 14/38] Adds repo add in script --- index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index b23fe411..7e56ef71 100644 --- a/index.js +++ b/index.js @@ -254,7 +254,14 @@ async function run() { } core.debug("process env:"); core.debug(process.env.AWS_ACCESS_KEY_ID); - + await exec.exec(helm, ["repo", "add", "staging", "s3://nebula-helm-charts/charts/staging" ] , { + env: { + ...process.env, + AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID , + AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY , + AWS_DEFAULT_REGION: "us-east-1", + }, + }) // Actually execute the deployment here. if (task === "remove") { await exec.exec(helm, deleteCmd(helm, namespace, release), { From a94113a7791db553752b29987612ea4fee190307 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 16:33:00 -0300 Subject: [PATCH 15/38] Adds plugin install into js --- index.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 7e56ef71..b1e444bf 100644 --- a/index.js +++ b/index.js @@ -252,7 +252,19 @@ async function run() { ignoreReturnCode: true }); } - core.debug("process env:"); + core.debug("plugin list:"); + + core.debug(await exec.exec(helm, ["plugin", "list" ] )) + + // helm plugin install https://github.com/hypnoglow/helm-s3.git + await exec.exec(helm, ["plugin", "install", "https://github.com/hypnoglow/helm-s3.git" ] , { + env: { + ...process.env, + AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID , + AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY , + AWS_DEFAULT_REGION: "us-east-1", + }, + }) core.debug(process.env.AWS_ACCESS_KEY_ID); await exec.exec(helm, ["repo", "add", "staging", "s3://nebula-helm-charts/charts/staging" ] , { env: { From bced65219ace2c27a0f4b9a585a128890f604d51 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 16:42:25 -0300 Subject: [PATCH 16/38] Updates helm version --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index de04e279..f590c6a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM alpine:3.14.0 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" +ENV HELM_3_FILE="helm-v3.14.0-linux-amd64.tar.gz" RUN apk add --no-cache ca-certificates \ --repository http://dl-3.alpinelinux.org/alpine/edge/community/ \ From 841a1f21f76e6bd1062b4fb5a329fd89ed9635fa Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 16:47:24 -0300 Subject: [PATCH 17/38] Debugs --- index.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index b1e444bf..851393e0 100644 --- a/index.js +++ b/index.js @@ -254,10 +254,9 @@ async function run() { } core.debug("plugin list:"); - core.debug(await exec.exec(helm, ["plugin", "list" ] )) - - // helm plugin install https://github.com/hypnoglow/helm-s3.git - await exec.exec(helm, ["plugin", "install", "https://github.com/hypnoglow/helm-s3.git" ] , { + core.debug(await exec.exec(helm, ["plugin", "list" ] ).stdout.trim()) + core.debug(process.env.AWS_ACCESS_KEY_ID); + await exec.exec(helm, ["repo", "add", "staging", "s3://nebula-helm-charts/charts/staging" ] , { env: { ...process.env, AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID , @@ -265,8 +264,7 @@ async function run() { AWS_DEFAULT_REGION: "us-east-1", }, }) - core.debug(process.env.AWS_ACCESS_KEY_ID); - await exec.exec(helm, ["repo", "add", "staging", "s3://nebula-helm-charts/charts/staging" ] , { + await exec.exec(helm, ["repo", "update"] , { env: { ...process.env, AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID , From 308ca729f657cd799d5a7d1978dfe796f95b1281 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 16:49:45 -0300 Subject: [PATCH 18/38] Debugs --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 851393e0..bafb0bd6 100644 --- a/index.js +++ b/index.js @@ -254,7 +254,7 @@ async function run() { } core.debug("plugin list:"); - core.debug(await exec.exec(helm, ["plugin", "list" ] ).stdout.trim()) + core.debug(await exec.exec(helm, ["plugin", "list" ] ).stdout) core.debug(process.env.AWS_ACCESS_KEY_ID); await exec.exec(helm, ["repo", "add", "staging", "s3://nebula-helm-charts/charts/staging" ] , { env: { From 6c2695aa3f388e526944f95dbaf9ef3244d9c5c6 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 16:55:49 -0300 Subject: [PATCH 19/38] Debugs --- Dockerfile | 2 +- index.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index f590c6a8..1e2ecb52 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,7 +24,7 @@ RUN \ # Init version 2 helm: helm init --client-only && \ # install helm s3 plugin - helm3 plugin install https://github.com/hypnoglow/helm-s3.git + #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 bafb0bd6..28b7cf3f 100644 --- a/index.js +++ b/index.js @@ -252,11 +252,10 @@ async function run() { ignoreReturnCode: true }); } - core.debug("plugin list:"); + core.debug("plugin list"); - core.debug(await exec.exec(helm, ["plugin", "list" ] ).stdout) - core.debug(process.env.AWS_ACCESS_KEY_ID); - await exec.exec(helm, ["repo", "add", "staging", "s3://nebula-helm-charts/charts/staging" ] , { + // helm plugin install https://github.com/hypnoglow/helm-s3.git + await exec.exec(helm, ["plugin", "install", "https://github.com/hypnoglow/helm-s3.git" ] , { env: { ...process.env, AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID , @@ -264,7 +263,8 @@ async function run() { AWS_DEFAULT_REGION: "us-east-1", }, }) - await exec.exec(helm, ["repo", "update"] , { + core.debug(process.env.AWS_ACCESS_KEY_ID); + await exec.exec(helm, ["repo", "add", "staging", "s3://nebula-helm-charts/charts/staging" ] , { env: { ...process.env, AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID , From f7093fb2815063a9aa6db5bd2121542457207256 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 16:57:39 -0300 Subject: [PATCH 20/38] Debugs --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1e2ecb52..01e829ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,7 +22,8 @@ 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 From e930922e95b8b4bba1c246091f521071155bf740 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 17:12:46 -0300 Subject: [PATCH 21/38] Debugs --- Dockerfile | 7 +++---- index.js | 11 ----------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/Dockerfile b/Dockerfile index 01e829ea..de04e279 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,7 +3,7 @@ FROM alpine:3.14.0 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.14.0-linux-amd64.tar.gz" +ENV HELM_3_FILE="helm-v3.6.3-linux-amd64.tar.gz" RUN apk add --no-cache ca-certificates \ --repository http://dl-3.alpinelinux.org/alpine/edge/community/ \ @@ -22,10 +22,9 @@ 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 + 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 28b7cf3f..f7265265 100644 --- a/index.js +++ b/index.js @@ -252,18 +252,7 @@ async function run() { ignoreReturnCode: true }); } - core.debug("plugin list"); - // helm plugin install https://github.com/hypnoglow/helm-s3.git - await exec.exec(helm, ["plugin", "install", "https://github.com/hypnoglow/helm-s3.git" ] , { - env: { - ...process.env, - AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID , - AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY , - AWS_DEFAULT_REGION: "us-east-1", - }, - }) - core.debug(process.env.AWS_ACCESS_KEY_ID); await exec.exec(helm, ["repo", "add", "staging", "s3://nebula-helm-charts/charts/staging" ] , { env: { ...process.env, From 1685c740bd331403564d51d9c7bfdb6b4763a042 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 17:15:57 -0300 Subject: [PATCH 22/38] Removed helm 2 --- Dockerfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index de04e279..1dda22ae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM alpine:3.14.0 ENV BASE_URL="https://get.helm.sh" -ENV HELM_2_FILE="helm-v2.17.0-linux-amd64.tar.gz" +#ENV HELM_2_FILE="helm-v2.17.0-linux-amd64.tar.gz" ENV HELM_3_FILE="helm-v3.6.3-linux-amd64.tar.gz" RUN apk add --no-cache ca-certificates \ @@ -12,17 +12,17 @@ RUN apk add --no-cache ca-certificates \ pip3 install awscli RUN \ # Install helm version 2: - curl -L ${BASE_URL}/${HELM_2_FILE} |tar xvz && \ - mv linux-amd64/helm /usr/bin/helm && \ - chmod +x /usr/bin/helm && \ - rm -rf linux-amd64 && \ + # curl -L ${BASE_URL}/${HELM_2_FILE} |tar xvz && \ + # mv linux-amd64/helm /usr/bin/helm && \ + # chmod +x /usr/bin/helm && \ + # rm -rf linux-amd64 && \ # Install helm version 3: curl -L ${BASE_URL}/${HELM_3_FILE} |tar xvz && \ mv linux-amd64/helm /usr/bin/helm3 && \ chmod +x /usr/bin/helm3 && \ rm -rf linux-amd64 && \ # Init version 2 helm: - helm init --client-only && \ + helm3 init --client-only && \ # install helm s3 plugin helm3 plugin install https://github.com/hypnoglow/helm-s3.git From 997d16b9762674e7da2346f9b0c91a282daf8d21 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 17:19:38 -0300 Subject: [PATCH 23/38] Removed helm 2 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1dda22ae..f384f59e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,7 +22,7 @@ RUN \ chmod +x /usr/bin/helm3 && \ rm -rf linux-amd64 && \ # Init version 2 helm: - helm3 init --client-only && \ + #helm3 init --client-only && \ # install helm s3 plugin helm3 plugin install https://github.com/hypnoglow/helm-s3.git From 05b9f44d8222fe429264f17924f509ce72abeb84 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 17:23:24 -0300 Subject: [PATCH 24/38] Debugs --- index.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index f7265265..20907770 100644 --- a/index.js +++ b/index.js @@ -201,13 +201,13 @@ async function run() { ]; // Per https://helm.sh/docs/faq/#xdg-base-directory-support - if (helm === "helm3") { - process.env.XDG_DATA_HOME = "/root/.helm/" - process.env.XDG_CACHE_HOME = "/root/.helm/" - process.env.XDG_CONFIG_HOME = "/root/.helm/" - } else { - process.env.HELM_HOME = "/root/.helm/" - } + // if (helm === "helm3") { + // process.env.XDG_DATA_HOME = "/root/.helm/" + // process.env.XDG_CACHE_HOME = "/root/.helm/" + // process.env.XDG_CONFIG_HOME = "/root/.helm/" + // } else { + // process.env.HELM_HOME = "/root/.helm/" + // } if (dryRun) args.push("--dry-run"); if (appName) args.push(`--set=app.name=${appName}`); @@ -256,7 +256,7 @@ async function run() { await exec.exec(helm, ["repo", "add", "staging", "s3://nebula-helm-charts/charts/staging" ] , { env: { ...process.env, - AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID , + AWS_ACCESS_KEY_ID: "WRONG" , AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY , AWS_DEFAULT_REGION: "us-east-1", }, From 43916b46a8766e4932772e6686c3179a0ffc27bc Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 17:25:00 -0300 Subject: [PATCH 25/38] Debugs --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 20907770..19dad322 100644 --- a/index.js +++ b/index.js @@ -253,7 +253,7 @@ async function run() { }); } - await exec.exec(helm, ["repo", "add", "staging", "s3://nebula-helm-charts/charts/staging" ] , { + await exec.exec(helm, ["repo", "add", "staging", "http://nebula-helm-charts/charts/staging" ] , { env: { ...process.env, AWS_ACCESS_KEY_ID: "WRONG" , From 32044938024a65b00f5f03369397783c51ed74b5 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 17:34:02 -0300 Subject: [PATCH 26/38] Debugs --- index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/index.js b/index.js index 19dad322..b08b589a 100644 --- a/index.js +++ b/index.js @@ -253,6 +253,24 @@ async function run() { }); } + 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) + await exec.exec(helm, ["repo", "add", "staging", "http://nebula-helm-charts/charts/staging" ] , { env: { ...process.env, From 79ea75304c69ec173b5c63f8f9076b586ea0b5d8 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 17:36:00 -0300 Subject: [PATCH 27/38] Debugs --- index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.js b/index.js index b08b589a..49fca320 100644 --- a/index.js +++ b/index.js @@ -252,6 +252,9 @@ async function run() { ignoreReturnCode: true }); } + let output = ""; + let error = ""; + let outputStdline = ""; const options = {}; options.listeners = { From c1810c74935c1845f2274cd1bf36bb14d2771812 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 17:39:37 -0300 Subject: [PATCH 28/38] Debugs --- index.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 49fca320..10242998 100644 --- a/index.js +++ b/index.js @@ -274,7 +274,16 @@ async function run() { core.debug("output =%s",output) core.debug("stdline =%s", outputStdline) - await exec.exec(helm, ["repo", "add", "staging", "http://nebula-helm-charts/charts/staging" ] , { + command = "helm3 plugin install https://github.com/hypnoglow/helm-s3.git" + output = ""; + error = ""; + outputStdline = ""; + core.debug(command) + await exec.exec(command, "", options) + core.debug("output =%s",output) + core.debug("stdline =%s", outputStdline) + + await exec.exec(helm, ["repo", "add", "staging", "s3://nebula-helm-charts/charts/staging" ] , { env: { ...process.env, AWS_ACCESS_KEY_ID: "WRONG" , From 731b1a9a866e06e30fa046865672744e477cf48f Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 17:41:58 -0300 Subject: [PATCH 29/38] Debugs --- index.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 10242998..b39edee8 100644 --- a/index.js +++ b/index.js @@ -284,12 +284,12 @@ async function run() { core.debug("stdline =%s", outputStdline) await exec.exec(helm, ["repo", "add", "staging", "s3://nebula-helm-charts/charts/staging" ] , { - env: { - ...process.env, - AWS_ACCESS_KEY_ID: "WRONG" , - AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY , - AWS_DEFAULT_REGION: "us-east-1", - }, + // env: { + // ...process.env, + // AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID, + // AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY , + // AWS_DEFAULT_REGION: "us-east-1", + // }, }) // Actually execute the deployment here. if (task === "remove") { From 35eecaaa936053638288f7efedaa38df498a1df0 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 17:50:44 -0300 Subject: [PATCH 30/38] Removing env vars from js --- Dockerfile | 12 ++++++------ index.js | 18 ++---------------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/Dockerfile b/Dockerfile index f384f59e..de04e279 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM alpine:3.14.0 ENV BASE_URL="https://get.helm.sh" -#ENV HELM_2_FILE="helm-v2.17.0-linux-amd64.tar.gz" +ENV HELM_2_FILE="helm-v2.17.0-linux-amd64.tar.gz" ENV HELM_3_FILE="helm-v3.6.3-linux-amd64.tar.gz" RUN apk add --no-cache ca-certificates \ @@ -12,17 +12,17 @@ RUN apk add --no-cache ca-certificates \ pip3 install awscli RUN \ # Install helm version 2: - # curl -L ${BASE_URL}/${HELM_2_FILE} |tar xvz && \ - # mv linux-amd64/helm /usr/bin/helm && \ - # chmod +x /usr/bin/helm && \ - # rm -rf linux-amd64 && \ + curl -L ${BASE_URL}/${HELM_2_FILE} |tar xvz && \ + mv linux-amd64/helm /usr/bin/helm && \ + chmod +x /usr/bin/helm && \ + rm -rf linux-amd64 && \ # Install helm version 3: curl -L ${BASE_URL}/${HELM_3_FILE} |tar xvz && \ mv linux-amd64/helm /usr/bin/helm3 && \ chmod +x /usr/bin/helm3 && \ rm -rf linux-amd64 && \ # Init version 2 helm: - #helm3 init --client-only && \ + helm init --client-only && \ # install helm s3 plugin helm3 plugin install https://github.com/hypnoglow/helm-s3.git diff --git a/index.js b/index.js index b39edee8..e387a028 100644 --- a/index.js +++ b/index.js @@ -283,28 +283,14 @@ async function run() { core.debug("output =%s",output) core.debug("stdline =%s", outputStdline) - await exec.exec(helm, ["repo", "add", "staging", "s3://nebula-helm-charts/charts/staging" ] , { - // env: { - // ...process.env, - // AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID, - // AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY , - // AWS_DEFAULT_REGION: "us-east-1", - // }, - }) + //await exec.exec(helm, ["repo", "add", "staging", "s3://nebula-helm-charts/charts/staging" ] ) // Actually execute the deployment here. if (task === "remove") { await exec.exec(helm, deleteCmd(helm, namespace, release), { ignoreReturnCode: true }); } else { - await exec.exec(helm, args, { - env: { - ...process.env, - AWS_ACCESS_KEY_ID: process.env.AWS_ACCESS_KEY_ID , - AWS_SECRET_ACCESS_KEY: process.env.AWS_SECRET_ACCESS_KEY , - AWS_DEFAULT_REGION: "us-east-1", - }, - }); + await exec.exec(helm, args); } await status(task === "remove" ? "inactive" : "success"); From b3795431fa85ee10b5c52741ff4d237b26f12b17 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 18:09:53 -0300 Subject: [PATCH 31/38] Listing helm env vars --- index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/index.js b/index.js index e387a028..12331b18 100644 --- a/index.js +++ b/index.js @@ -268,7 +268,7 @@ async function run() { outputStdline += data; }, }; - let command = "helm3 plugin list " + let command = "helm3 env " core.debug(command) await exec.exec(command, "", options) core.debug("output =%s",output) @@ -283,7 +283,6 @@ async function run() { core.debug("output =%s",output) core.debug("stdline =%s", outputStdline) - //await exec.exec(helm, ["repo", "add", "staging", "s3://nebula-helm-charts/charts/staging" ] ) // Actually execute the deployment here. if (task === "remove") { await exec.exec(helm, deleteCmd(helm, namespace, release), { From 848d49886eadfa899f4bbd31d86d2ee7a439e6b5 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 18:28:42 -0300 Subject: [PATCH 32/38] Adding ENV vars to match github user that runs nodejs --- Dockerfile | 7 +++++++ index.js | 23 +++++++---------------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/Dockerfile b/Dockerfile index de04e279..f08b549b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,13 @@ 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" +ENV HELM_CACHE_HOME="/github/home/.cache/helm" +ENV HELM_CONFIG_HOME="/github/home/.config/helm" +ENV HELM_DATA_HOME="/github/home/.local/share/helm" +ENV HELM_PLUGINS="/github/home/.local/share/helm/plugins" +ENV HELM_REGISTRY_CONFIG="/github/home/.config/helm/registry.json" +ENV HELM_REPOSITORY_CACHE="/github/home/.cache/helm/repository" +ENV HELM_REPOSITORY_CONFIG="/github/home/.config/helm/repositories.yaml" RUN apk add --no-cache ca-certificates \ --repository http://dl-3.alpinelinux.org/alpine/edge/community/ \ diff --git a/index.js b/index.js index 12331b18..c10479b8 100644 --- a/index.js +++ b/index.js @@ -201,13 +201,13 @@ async function run() { ]; // Per https://helm.sh/docs/faq/#xdg-base-directory-support - // if (helm === "helm3") { - // process.env.XDG_DATA_HOME = "/root/.helm/" - // process.env.XDG_CACHE_HOME = "/root/.helm/" - // process.env.XDG_CONFIG_HOME = "/root/.helm/" - // } else { - // process.env.HELM_HOME = "/root/.helm/" - // } + if (helm === "helm3") { + process.env.XDG_DATA_HOME = "/root/.helm/" + process.env.XDG_CACHE_HOME = "/root/.helm/" + process.env.XDG_CONFIG_HOME = "/root/.helm/" + } else { + process.env.HELM_HOME = "/root/.helm/" + } if (dryRun) args.push("--dry-run"); if (appName) args.push(`--set=app.name=${appName}`); @@ -274,15 +274,6 @@ async function run() { core.debug("output =%s",output) core.debug("stdline =%s", outputStdline) - command = "helm3 plugin install https://github.com/hypnoglow/helm-s3.git" - output = ""; - error = ""; - outputStdline = ""; - 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") { await exec.exec(helm, deleteCmd(helm, namespace, release), { From 4340e05c2faa612b01932b7f36a897cc311f6631 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 18:31:03 -0300 Subject: [PATCH 33/38] Adding ENV vars to match github user that runs nodejs --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index c10479b8..704b674b 100644 --- a/index.js +++ b/index.js @@ -268,7 +268,7 @@ async function run() { outputStdline += data; }, }; - let command = "helm3 env " + let command = "helm3 plugin list " core.debug(command) await exec.exec(command, "", options) core.debug("output =%s",output) From 919a4464bf1c9da4990505af971302b247d6a457 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 18:33:49 -0300 Subject: [PATCH 34/38] Adding ENV VARS in index.js that matches DockerFile's --- Dockerfile | 8 +------- index.js | 7 +++++++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index f08b549b..f01be6e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,13 +4,7 @@ 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" -ENV HELM_CACHE_HOME="/github/home/.cache/helm" -ENV HELM_CONFIG_HOME="/github/home/.config/helm" -ENV HELM_DATA_HOME="/github/home/.local/share/helm" -ENV HELM_PLUGINS="/github/home/.local/share/helm/plugins" -ENV HELM_REGISTRY_CONFIG="/github/home/.config/helm/registry.json" -ENV HELM_REPOSITORY_CACHE="/github/home/.cache/helm/repository" -ENV HELM_REPOSITORY_CONFIG="/github/home/.config/helm/repositories.yaml" + RUN apk add --no-cache ca-certificates \ --repository http://dl-3.alpinelinux.org/alpine/edge/community/ \ diff --git a/index.js b/index.js index 704b674b..07e3e80d 100644 --- a/index.js +++ b/index.js @@ -205,6 +205,13 @@ 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/" } From 647a51626eb678e00334b509c90533350525a4b0 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Wed, 24 Jan 2024 18:37:23 -0300 Subject: [PATCH 35/38] Adding ENV VARS in Dockerfile to ensure their parity --- Dockerfile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f01be6e9..ee610462 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,14 @@ 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/ \ From 3999e4c06921e319028e7a62700aa947a51eafb1 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Mon, 5 Feb 2024 12:35:12 -0300 Subject: [PATCH 36/38] Fixes dryrun logic --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 07e3e80d..e921a574 100644 --- a/index.js +++ b/index.js @@ -216,7 +216,7 @@ async function run() { 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}`); From 694de9c5a8008e5c025ad35b244d8eb7a46891f7 Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Mon, 5 Feb 2024 13:01:07 -0300 Subject: [PATCH 37/38] rollback --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index e921a574..07e3e80d 100644 --- a/index.js +++ b/index.js @@ -216,7 +216,7 @@ async function run() { process.env.HELM_HOME = "/root/.helm/" } - if (dryRun === true) args.push("--dry-run"); + if (dryRun) 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}`); From a8d4bf81bc8854bd51950398dde43ab00418127a Mon Sep 17 00:00:00 2001 From: Luciano Issoe Date: Mon, 5 Feb 2024 13:07:34 -0300 Subject: [PATCH 38/38] Tests new dryrun logic --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 07e3e80d..dad3039c 100644 --- a/index.js +++ b/index.js @@ -216,7 +216,7 @@ async function run() { 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}`);