From 9ce6206e7e023db27e650a2398841c6a3222f1fb Mon Sep 17 00:00:00 2001 From: dkirchan <55240027+dkirchan@users.noreply.github.com> Date: Fri, 4 Oct 2024 19:22:57 +0300 Subject: [PATCH] [Security][Serverless] Removed override when the quality gate runs in QA (#192885) ## Summary An override was used so far when a commit was provided no matter who/what/where the tests were running. With this change. the override will not be used when the quality gate runs in QA. The reason behind this change is that we want to simulate the customer's behavior, so we will be creating a project with whichever version is currently deployed in QA. --------- Co-authored-by: Domenico Andreoli --- .../run_cypress/project_handler/cloud_project_handler.ts | 8 ++++++-- .../run_cypress/project_handler/proxy_project_handler.ts | 8 ++++++-- 2 files changed, 12 insertions(+), 4 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 dd1e2c8762909..5ae476c17580e 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 @@ -40,8 +40,12 @@ export class CloudHandler extends ProjectHandler { body.product_types = productTypes; } - if (process.env.KIBANA_MKI_IMAGE_COMMIT || commit) { - const override = commit ? commit : process.env.KIBANA_MKI_IMAGE_COMMIT; + // The qualityGate variable has been added here to ensure that when the quality gate runs, there will be + // 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; + if (override && !qualityGate) { const kibanaOverrideImage = `${override?.substring(0, 12)}`; this.log.info(`Kibana Image Commit under test: ${process.env.KIBANA_MKI_IMAGE_COMMIT}!`); this.log.info( 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 b438849d85b4c..dfc97e9a422d8 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 @@ -40,8 +40,12 @@ export class ProxyHandler extends ProjectHandler { body.product_types = productTypes; } - if (process.env.KIBANA_MKI_IMAGE_COMMIT || commit) { - const override = commit ? commit : process.env.KIBANA_MKI_IMAGE_COMMIT; + // The qualityGate variable has been added here to ensure that when the quality gate runs, there will be + // 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; + if (override && !qualityGate) { const kibanaOverrideImage = `${override?.substring(0, 12)}`; this.log.info(`Kibana Image Commit under test: ${process.env.KIBANA_MKI_IMAGE_COMMIT}!`); this.log.info(