Skip to content

Commit

Permalink
[8.x] [Security Solution][Quality Gate Monitoring] Fixed override for…
Browse files Browse the repository at this point in the history
… monitoring pipeline (#196841) (#196861)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Security Solution][Quality Gate Monitoring] Fixed override for
monitoring pipeline
(#196841)](#196841)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT
[{"author":{"name":"dkirchan","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-18T12:16:10Z","message":"[Security
Solution][Quality Gate Monitoring] Fixed override for monitoring
pipeline (#196841)\n\n## Summary\r\n\r\nInstead of just quality gate for
security, a monitoring pipeline has\r\nbeen introduced which acts like
quality gate but is overriding the\r\nkibana image with the latest
[dev-devenv\r\nversion](https://github.com/elastic/serverless-gitops/blob/79862d97b1b1d3a97c0d8e2091ea06b9aed43f0c/services/kibana/versions.yaml#L4).\r\n\r\nThis
change addresses the changes needed for this new pipeline
taking\r\nunder consideration the environmental
variable\r\n`KIBANA_MKI_QUALITY_GATE_MONITORING` which if present, it
defines that\r\nwe do run the set of tests for quality gate but with an
override.","sha":"60915420114fe35db940df268660503c93adae52","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:
SecuritySolution","backport:prev-minor","v8.16.0","v8.17.0"],"title":"[Security
Solution][Quality Gate Monitoring] Fixed override for monitoring
pipeline","number":196841,"url":"https://github.com/elastic/kibana/pull/196841","mergeCommit":{"message":"[Security
Solution][Quality Gate Monitoring] Fixed override for monitoring
pipeline (#196841)\n\n## Summary\r\n\r\nInstead of just quality gate for
security, a monitoring pipeline has\r\nbeen introduced which acts like
quality gate but is overriding the\r\nkibana image with the latest
[dev-devenv\r\nversion](https://github.com/elastic/serverless-gitops/blob/79862d97b1b1d3a97c0d8e2091ea06b9aed43f0c/services/kibana/versions.yaml#L4).\r\n\r\nThis
change addresses the changes needed for this new pipeline
taking\r\nunder consideration the environmental
variable\r\n`KIBANA_MKI_QUALITY_GATE_MONITORING` which if present, it
defines that\r\nwe do run the set of tests for quality gate but with an
override.","sha":"60915420114fe35db940df268660503c93adae52"}},"sourceBranch":"main","suggestedTargetBranches":["8.16","8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/196841","number":196841,"mergeCommit":{"message":"[Security
Solution][Quality Gate Monitoring] Fixed override for monitoring
pipeline (#196841)\n\n## Summary\r\n\r\nInstead of just quality gate for
security, a monitoring pipeline has\r\nbeen introduced which acts like
quality gate but is overriding the\r\nkibana image with the latest
[dev-devenv\r\nversion](https://github.com/elastic/serverless-gitops/blob/79862d97b1b1d3a97c0d8e2091ea06b9aed43f0c/services/kibana/versions.yaml#L4).\r\n\r\nThis
change addresses the changes needed for this new pipeline
taking\r\nunder consideration the environmental
variable\r\n`KIBANA_MKI_QUALITY_GATE_MONITORING` which if present, it
defines that\r\nwe do run the set of tests for quality gate but with an
override.","sha":"60915420114fe35db940df268660503c93adae52"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: dkirchan <[email protected]>
  • Loading branch information
kibanamachine and dkirchan authored Oct 18, 2024
1 parent 0641343 commit f36c984
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)}`;
Expand Down

0 comments on commit f36c984

Please sign in to comment.