diff --git a/bin/cml.js b/bin/cml.js index e207e5e0e..4dae11193 100755 --- a/bin/cml.js +++ b/bin/cml.js @@ -10,24 +10,7 @@ const yargs = require('yargs'); const CML = require('../src/cml').default; const { jitsuEventPayload, send } = require('../src/analytics'); -const setupOpts = (opts) => { - 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 aliasLegacyEnvironmentVariables = () => { const legacyEnvironmentPrefixes = { CML_CI: 'CML_REPO', CML_PUBLISH: 'CML_ASSET', @@ -46,6 +29,25 @@ const setupOpts = (opts) => { } } + 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) => { 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 {