From 32f181a0e75f9d33ebd0ea867d385068126beabf Mon Sep 17 00:00:00 2001 From: Andrii Shaforostov Date: Mon, 12 Aug 2024 17:35:07 +0300 Subject: [PATCH] feat: default runtime environment for run command (#862) --- lib/interface/cli/commands/pipeline/run.cf.js | 9 +++++++++ lib/logic/entities/RuntimeEnvironments.js | 2 +- package.json | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/interface/cli/commands/pipeline/run.cf.js b/lib/interface/cli/commands/pipeline/run.cf.js index d7d8592c0..e51e71913 100644 --- a/lib/interface/cli/commands/pipeline/run.cf.js +++ b/lib/interface/cli/commands/pipeline/run.cf.js @@ -30,6 +30,15 @@ class RunExternalCommand extends RunBaseCommand { pipelineName, options, }); + try { + if (options && options.runtimeName) { + await sdk.runtimeEnvs.get({ name: options.runtimeName, extend: false }); + } + } catch (error) { + if (error.statusCode === 404) { + console.warn(`Runtime environment ${options.runtimeName} not found. Default runtime will be used.`); + } + } this.workflowId = await sdk.pipelines[interfaceMethod]({ name: pipelineName }, _buildBody(options)); if (this.executionRequests.length === 1) { if (this.argv.returnWorkflowId) { diff --git a/lib/logic/entities/RuntimeEnvironments.js b/lib/logic/entities/RuntimeEnvironments.js index df38f3c4a..5ddccca49 100644 --- a/lib/logic/entities/RuntimeEnvironments.js +++ b/lib/logic/entities/RuntimeEnvironments.js @@ -22,7 +22,7 @@ class RuntimeEnvironments extends Entity { return new RuntimeEnvironments(_.pick(response, [ 'version', 'metadata', 'environmentCertPath', 'runtimeScheduler', 'dockerDaemonScheduler', 'history', 'extends', 'description', 'isPublic', - 'isDefault', 'accountId', 'plan', 'accounts', 'nonComplete', 'appProxy', + 'isDefault', 'accountId', 'plan', 'accounts', 'nonComplete', 'appProxy', 'tags', ])); } } diff --git a/package.json b/package.json index 1576291c7..f81846e64 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "codefresh", - "version": "0.87.5", + "version": "0.87.6", "description": "Codefresh command line utility", "main": "index.js", "preferGlobal": true, @@ -115,4 +115,4 @@ "./test-setup.js" ] } -} \ No newline at end of file +}