diff --git a/lib/interface/cli/commands/hybrid/init.cmd.js b/lib/interface/cli/commands/hybrid/init.cmd.js index 34a20c03f..ed4ea696d 100644 --- a/lib/interface/cli/commands/hybrid/init.cmd.js +++ b/lib/interface/cli/commands/hybrid/init.cmd.js @@ -467,6 +467,27 @@ const initCmd = new Command({ condition: !!dockerRegistry, }); + // update env vars + installationPlan.addStep({ + name: 'update runtime environment with env vars', + func: async () => { + const reName = installationPlan.getContext('runtimeName'); + const re = await sdk.runtimeEnvs.get({ name: reName }); + let currentEnvVars = _.get(re, 'runtimeScheduler.envVars', {}); + const envVarsAsObject = envVars.reduce((acc, current) => { + const parts = current.split('='); + // eslint-disable-next-line prefer-destructuring + acc[parts[0]] = parts[1]; + return acc; + }, {}); + currentEnvVars = _.merge(currentEnvVars, envVarsAsObject); + const body = _.set(re, 'runtimeScheduler.envVars', currentEnvVars); + await sdk.runtimeEnvs.update({ name: reName }, _.merge(re, body)); + console.log(`Runtime environment "${colors.cyan(reName)}" has been updated with env vars`); + }, + condition: !!envVars, + }); + // set runtime as default installationPlan.addStep({ name: 'set new runtime as default', diff --git a/package.json b/package.json index 0e74960ac..0140bf4d4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codefresh", - "version": "0.71.6", + "version": "0.71.7", "description": "Codefresh command line utility", "main": "index.js", "preferGlobal": true,