From e2dc86a1e05b82615b4adc9dd9ffcdd2bfde21da 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. (cherry picked from commit cbe5d9a8fb57bf808d69c3ca35c0fefca7ef54e2) --- .../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 5ae476c17580e..00880c054d956 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 dfc97e9a422d8..8cc27919377e7 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}!`);