forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ci / FIPS] Dynamic agent selection. Add FIPS agents (elastic#183777)
## Summary - Closes elastic/kibana-operations#100 - Utilizes FIPS agent from elastic/ci-agent-images#686 - Adds dynamic agent selection during PR pipeline upload - FIPS agents can be used with `FTR_ENABLE_FIPS_AGENT` env variable or `ci:enable-fips-agent` label - Removes agent image config from individual steps in favor of image config for the whole pipeline. - Steps can still override this config by adding `image`, `imageProject` etc - Adds a conditional assertion to `Check` CI step which validates that FIPS is working properly ### Testing - [Pipeline run using FIPS agents](https://buildkite.com/elastic/kibana-pull-request/builds/215332) - Failures are expected and this possibly ran with flaky tests
- Loading branch information
Showing
40 changed files
with
108 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import { dump } from 'js-yaml'; | ||
import { BuildkiteClient, BuildkiteCommandStep } from './buildkite'; | ||
|
||
type AgentImageConfig = BuildkiteCommandStep['agents']; | ||
|
||
const DEFAULT_AGENT_IMAGE_CONFIG: AgentImageConfig = { | ||
provider: 'gcp', | ||
image: 'family/kibana-ubuntu-2004', | ||
imageProject: 'elastic-images-prod', | ||
}; | ||
|
||
const FIPS_AGENT_IMAGE_CONFIG: AgentImageConfig = { | ||
provider: 'gcp', | ||
image: 'family/kibana-fips-ubuntu-2004', | ||
imageProject: 'elastic-images-qa', | ||
}; | ||
|
||
const GITHUB_PR_LABELS = process.env.GITHUB_PR_LABELS ?? ''; | ||
const FTR_ENABLE_FIPS_AGENT = process.env.FTR_ENABLE_FIPS_AGENT?.toLowerCase() === 'true'; | ||
|
||
// Narrow the return type with overloads | ||
function getAgentImageConfig(): AgentImageConfig; | ||
function getAgentImageConfig(options: { returnYaml: true }): string; | ||
function getAgentImageConfig({ returnYaml = false } = {}): string | AgentImageConfig { | ||
const bk = new BuildkiteClient(); | ||
let config: AgentImageConfig; | ||
|
||
if (FTR_ENABLE_FIPS_AGENT || GITHUB_PR_LABELS.includes('ci:enable-fips-agent')) { | ||
config = FIPS_AGENT_IMAGE_CONFIG; | ||
|
||
bk.setAnnotation( | ||
'agent image config', | ||
'info', | ||
'#### FIPS Agents Enabled<br />\nFIPS mode can produce new test failures. If you did not intend this remove ```KBN_ENABLE_FIPS``` environment variable and/or the ```ci:enable-fips-agent``` Github label.' | ||
); | ||
} else { | ||
config = DEFAULT_AGENT_IMAGE_CONFIG; | ||
} | ||
|
||
if (returnYaml) { | ||
return dump({ agents: config }); | ||
} | ||
|
||
return config; | ||
} | ||
|
||
export { getAgentImageConfig }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.