From 3becf52d9a1bd3681aaabb95137080bf8d8cb7fc Mon Sep 17 00:00:00 2001 From: Helio Machado <0x2b3bfa0+git@googlemail.com> Date: Sun, 30 Oct 2022 02:56:49 +0200 Subject: [PATCH 1/4] Fix environment variable aliases --- bin/cml.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/cml.js b/bin/cml.js index e207e5e0e..85b813f1d 100755 --- a/bin/cml.js +++ b/bin/cml.js @@ -10,7 +10,7 @@ const yargs = require('yargs'); const CML = require('../src/cml').default; const { jitsuEventPayload, send } = require('../src/analytics'); -const setupOpts = (opts) => { +const aliasLegacyEnvironmentVariables = () => { const legacyEnvironmentVariables = { TB_CREDENTIALS: 'CML_TENSORBOARD_CREDENTIALS', DOCKER_MACHINE: 'CML_RUNNER_DOCKER_MACHINE', @@ -45,7 +45,9 @@ const setupOpts = (opts) => { process.env[key.replace(oldPrefix, newPrefix)] = process.env[key]; } } +} +const setupOpts = (opts) => { const { markdownfile } = opts; opts.markdownFile = markdownfile; opts.cml = new CML(opts); @@ -117,6 +119,7 @@ const handleError = (message, error) => { }; (async () => { + aliasLegacyEnvironmentVariables(); setupLogger({ log: 'debug' }); try { From a34789b56a5b0650971ebe557a4ec57d2b2dc733 Mon Sep 17 00:00:00 2001 From: Helio Machado <0x2b3bfa0+git@googlemail.com> Date: Sun, 30 Oct 2022 02:59:14 +0200 Subject: [PATCH 2/4] Fix linter nitpick --- bin/cml.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cml.js b/bin/cml.js index 85b813f1d..6d50a2a0a 100755 --- a/bin/cml.js +++ b/bin/cml.js @@ -45,7 +45,7 @@ const aliasLegacyEnvironmentVariables = () => { process.env[key.replace(oldPrefix, newPrefix)] = process.env[key]; } } -} +}; const setupOpts = (opts) => { const { markdownfile } = opts; From 53e4fb7f0a53a27ec7a840d841d177a69c23da18 Mon Sep 17 00:00:00 2001 From: Helio Machado <0x2b3bfa0+git@googlemail.com> Date: Sun, 30 Oct 2022 02:06:10 +0100 Subject: [PATCH 3/4] Invert order of operations --- bin/cml.js | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/bin/cml.js b/bin/cml.js index 6d50a2a0a..8ff40a04d 100755 --- a/bin/cml.js +++ b/bin/cml.js @@ -11,23 +11,6 @@ const CML = require('../src/cml').default; const { jitsuEventPayload, send } = require('../src/analytics'); const aliasLegacyEnvironmentVariables = () => { - const legacyEnvironmentVariables = { - TB_CREDENTIALS: 'CML_TENSORBOARD_CREDENTIALS', - DOCKER_MACHINE: 'CML_RUNNER_DOCKER_MACHINE', - RUNNER_IDLE_TIMEOUT: 'CML_RUNNER_IDLE_TIMEOUT', - RUNNER_LABELS: 'CML_RUNNER_LABELS', - RUNNER_SINGLE: 'CML_RUNNER_SINGLE', - RUNNER_REUSE: 'CML_RUNNER_REUSE', - RUNNER_NO_RETRY: 'CML_RUNNER_NO_RETRY', - RUNNER_DRIVER: 'CML_RUNNER_DRIVER', - RUNNER_REPO: 'CML_RUNNER_REPO', - RUNNER_PATH: 'CML_RUNNER_PATH' - }; - - for (const [oldName, newName] of Object.entries(legacyEnvironmentVariables)) { - if (process.env[oldName]) process.env[newName] = process.env[oldName]; - } - const legacyEnvironmentPrefixes = { CML_CI: 'CML_REPO', CML_PUBLISH: 'CML_ASSET', @@ -45,6 +28,23 @@ const aliasLegacyEnvironmentVariables = () => { process.env[key.replace(oldPrefix, newPrefix)] = process.env[key]; } } + + const legacyEnvironmentVariables = { + TB_CREDENTIALS: 'CML_TENSORBOARD_CREDENTIALS', + DOCKER_MACHINE: 'CML_RUNNER_DOCKER_MACHINE', + RUNNER_IDLE_TIMEOUT: 'CML_RUNNER_IDLE_TIMEOUT', + RUNNER_LABELS: 'CML_RUNNER_LABELS', + RUNNER_SINGLE: 'CML_RUNNER_SINGLE', + RUNNER_REUSE: 'CML_RUNNER_REUSE', + RUNNER_NO_RETRY: 'CML_RUNNER_NO_RETRY', + RUNNER_DRIVER: 'CML_RUNNER_DRIVER', + RUNNER_REPO: 'CML_RUNNER_REPO', + RUNNER_PATH: 'CML_RUNNER_PATH' + }; + + for (const [oldName, newName] of Object.entries(legacyEnvironmentVariables)) { + if (process.env[oldName]) process.env[newName] = process.env[oldName]; + } }; const setupOpts = (opts) => { From 91cc8d6fc769e3086c928c35c7e34f86786970c9 Mon Sep 17 00:00:00 2001 From: DavidGOrtega Date: Sun, 30 Oct 2022 08:58:54 +0100 Subject: [PATCH 4/4] remove .. --- bin/cml.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/cml.js b/bin/cml.js index 8ff40a04d..4dae11193 100755 --- a/bin/cml.js +++ b/bin/cml.js @@ -28,7 +28,7 @@ const aliasLegacyEnvironmentVariables = () => { process.env[key.replace(oldPrefix, newPrefix)] = process.env[key]; } } - + const legacyEnvironmentVariables = { TB_CREDENTIALS: 'CML_TENSORBOARD_CREDENTIALS', DOCKER_MACHINE: 'CML_RUNNER_DOCKER_MACHINE',