From 514898b419b7ed76a65e4478879c85a3abdc7c0c Mon Sep 17 00:00:00 2001 From: mpraski Date: Tue, 26 Jan 2021 10:23:37 +0100 Subject: [PATCH] Extract process config to main function --- index.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/index.js b/index.js index 30cf8c14..7a4ab4dc 100644 --- a/index.js +++ b/index.js @@ -231,10 +231,6 @@ async function deploy(helm) { `--namespace=${namespace}`, ]; - process.env.XDG_DATA_HOME = "/root/.helm/" - process.env.XDG_CACHE_HOME = "/root/.helm/" - process.env.XDG_CONFIG_HOME = "/root/.helm/" - if (dryRun) args.push("--dry-run"); if (appName) args.push(`--set=app.name=${appName}`); if (version) args.push(`--set=app.version=${version}`); @@ -257,12 +253,6 @@ async function deploy(helm) { args.push("--atomic"); } - // Setup necessary files. - if (process.env.KUBECONFIG_FILE) { - process.env.KUBECONFIG = "./kubeconfig.yml"; - await writeFile(process.env.KUBECONFIG, process.env.KUBECONFIG_FILE); - } - await writeFile("./values.yml", values); core.debug(`env: KUBECONFIG="${process.env.KUBECONFIG}"`); @@ -300,6 +290,16 @@ async function run() { try { await status("pending"); + process.env.XDG_DATA_HOME = "/root/.helm/" + process.env.XDG_CACHE_HOME = "/root/.helm/" + process.env.XDG_CONFIG_HOME = "/root/.helm/" + + // Setup necessary files. + if (process.env.KUBECONFIG_FILE) { + process.env.KUBECONFIG = "./kubeconfig.yml"; + await writeFile(process.env.KUBECONFIG, process.env.KUBECONFIG_FILE); + } + const helm = getInput("helm") || "helm3"; core.debug(`param: helm = "${helm}"`);