From 60915420114fe35db940df268660503c93adae52 Mon Sep 17 00:00:00 2001 From: dkirchan <55240027+dkirchan@users.noreply.github.com> Date: Fri, 18 Oct 2024 15:16:10 +0300 Subject: [PATCH] [Security Solution][Quality Gate Monitoring] Fixed override for monitoring pipeline (#196841) ## Summary Instead of just quality gate for security, a monitoring pipeline has been introduced which acts like quality gate but is overriding the kibana image with the latest [dev-devenv version](https://github.com/elastic/serverless-gitops/blob/79862d97b1b1d3a97c0d8e2091ea06b9aed43f0c/services/kibana/versions.yaml#L4). This change addresses the changes needed for this new pipeline taking under consideration the environmental variable `KIBANA_MKI_QUALITY_GATE_MONITORING` which if present, it defines that we do run the set of tests for quality gate but with an override. --- .../project_handler/cloud_project_handler.ts | 10 ++++++++-- .../project_handler/proxy_project_handler.ts | 10 ++++++++-- 2 files changed, 16 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 2d8c97da44896..fb6b0ac0f5e9b 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 @@ -41,9 +41,15 @@ export class CloudHandler extends ProjectHandler { } // 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. + // no kibana image override unless it is running for the daily monitoring. + // The tests will be executed against the commit which is already promoted to QA. + const monitoringQualityGate = + process.env.KIBANA_MKI_QUALITY_GATE_MONITORING && + process.env.KIBANA_MKI_QUALITY_GATE_MONITORING === '1'; const qualityGate = - process.env.KIBANA_MKI_QUALITY_GATE && process.env.KIBANA_MKI_QUALITY_GATE === '1'; + process.env.KIBANA_MKI_QUALITY_GATE && + process.env.KIBANA_MKI_QUALITY_GATE === '1' && + !monitoringQualityGate; const override = commit && commit !== '' ? commit : process.env.KIBANA_MKI_IMAGE_COMMIT; if (override && !qualityGate) { const kibanaOverrideImage = `${override?.substring(0, 12)}`; 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 adf8f6209a80f..100764b0504bc 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 @@ -41,9 +41,15 @@ export class ProxyHandler extends ProjectHandler { } // 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. + // no kibana image override unless it is running for the daily monitoring. + // The tests will be executed against the commit which is already promoted to QA. + const monitoringQualityGate = + process.env.KIBANA_MKI_QUALITY_GATE_MONITORING && + process.env.KIBANA_MKI_QUALITY_GATE_MONITORING === '1'; const qualityGate = - process.env.KIBANA_MKI_QUALITY_GATE && process.env.KIBANA_MKI_QUALITY_GATE === '1'; + process.env.KIBANA_MKI_QUALITY_GATE && + process.env.KIBANA_MKI_QUALITY_GATE === '1' && + !monitoringQualityGate; const override = commit && commit !== '' ? commit : process.env.KIBANA_MKI_IMAGE_COMMIT; if (override && !qualityGate) { const kibanaOverrideImage = `${override?.substring(0, 12)}`;