From cbe5d9a8fb57bf808d69c3ca35c0fefca7ef54e2 Mon Sep 17 00:00:00 2001 From: dkirchan <55240027+dkirchan@users.noreply.github.com> Date: Wed, 16 Oct 2024 23:47:27 +0300 Subject: [PATCH] [Security Solution][Serverless Quality Gate] Restoring overrides functionality (#196536) ## Summary Due to a bug introduced in a previous PR, the `override` value was never using the `process.env.KIBANA_MKI_IMAGE_COMMIT` environment variable. The reason is that in the command line arguments argparse, commit value had the default of `''` so the commit was never null or undefined. ``` .option('commit', { alias: 'c', type: 'string', default: '', }) ``` Restored the check to see if the string is also empty. --- .../run_cypress/project_handler/cloud_project_handler.ts | 2 +- .../run_cypress/project_handler/proxy_project_handler.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/security_solution/scripts/run_cypress/project_handler/cloud_project_handler.ts b/x-pack/plugins/security_solution/scripts/run_cypress/project_handler/cloud_project_handler.ts index 2d41b9605b2750..2d8c97da44896d 100644 --- a/x-pack/plugins/security_solution/scripts/run_cypress/project_handler/cloud_project_handler.ts +++ b/x-pack/plugins/security_solution/scripts/run_cypress/project_handler/cloud_project_handler.ts @@ -44,7 +44,7 @@ export class CloudHandler extends ProjectHandler { // no kibana image override. The tests will be executed against the commit which is already promoted to QA. const qualityGate = process.env.KIBANA_MKI_QUALITY_GATE && process.env.KIBANA_MKI_QUALITY_GATE === '1'; - const override = commit ?? process.env.KIBANA_MKI_IMAGE_COMMIT; + const override = commit && commit !== '' ? commit : process.env.KIBANA_MKI_IMAGE_COMMIT; if (override && !qualityGate) { const kibanaOverrideImage = `${override?.substring(0, 12)}`; this.log.info(`Kibana Image Commit under test: ${process.env.KIBANA_MKI_IMAGE_COMMIT}!`); diff --git a/x-pack/plugins/security_solution/scripts/run_cypress/project_handler/proxy_project_handler.ts b/x-pack/plugins/security_solution/scripts/run_cypress/project_handler/proxy_project_handler.ts index ec7794389233f7..adf8f6209a80f2 100644 --- a/x-pack/plugins/security_solution/scripts/run_cypress/project_handler/proxy_project_handler.ts +++ b/x-pack/plugins/security_solution/scripts/run_cypress/project_handler/proxy_project_handler.ts @@ -44,7 +44,7 @@ export class ProxyHandler extends ProjectHandler { // no kibana image override. The tests will be executed against the commit which is already promoted to QA. const qualityGate = process.env.KIBANA_MKI_QUALITY_GATE && process.env.KIBANA_MKI_QUALITY_GATE === '1'; - const override = commit ?? process.env.KIBANA_MKI_IMAGE_COMMIT; + const override = commit && commit !== '' ? commit : process.env.KIBANA_MKI_IMAGE_COMMIT; if (override && !qualityGate) { const kibanaOverrideImage = `${override?.substring(0, 12)}`; this.log.info(`Kibana Image Commit under test: ${process.env.KIBANA_MKI_IMAGE_COMMIT}!`);