Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ci / FIPS] Dynamic agent selection. Add FIPS agents #183777

Merged
merged 55 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
ac74d72
use fips agent
Ikuni17 May 24, 2024
16483da
hack node.options
Ikuni17 May 24, 2024
3a737cd
use qa image repo
Ikuni17 May 24, 2024
9c06df1
Merge remote-tracking branch 'upstream/main' into fips-agent-test
Ikuni17 May 29, 2024
45032e4
debug
Ikuni17 May 29, 2024
9c71a44
fix exit status
Ikuni17 May 29, 2024
eed2097
set env var
Ikuni17 May 29, 2024
cfca864
qa image for ftr
Ikuni17 May 29, 2024
7c161ac
remove fips debug
Ikuni17 May 29, 2024
ee8ca0b
single agent config
Ikuni17 May 29, 2024
5874016
remove echo debug
Ikuni17 May 29, 2024
90f763c
add fips verify to checks
Ikuni17 May 29, 2024
fa22987
cleanup
Ikuni17 May 29, 2024
54e07ae
fix script permissions. change order
Ikuni17 May 29, 2024
835713c
fix config path
Ikuni17 May 29, 2024
545cb59
out fips status
Ikuni17 May 30, 2024
2373529
dynamic agent selection
Ikuni17 May 30, 2024
704fded
add annotation
Ikuni17 May 30, 2024
0a4e784
fix export
Ikuni17 May 30, 2024
a0f9f25
fix yml linting
Ikuni17 May 30, 2024
7e98c33
only add env when necessary
Ikuni17 May 30, 2024
831c2fb
fix comment config
Ikuni17 May 30, 2024
86e0520
fix var
Ikuni17 May 30, 2024
6181646
only check for fips if it is enabled
Ikuni17 May 30, 2024
bf820e0
fix import
Ikuni17 May 30, 2024
a558aff
adjust annotation
Ikuni17 May 30, 2024
630158c
fix verification
Ikuni17 May 30, 2024
a829ca1
fix compare
Ikuni17 May 30, 2024
d62746d
trim newline
Ikuni17 May 30, 2024
62feca4
dynamically adjust node.options
Ikuni17 May 30, 2024
1e1b4e6
string
Ikuni17 May 30, 2024
fc88586
ignore node.options changes
Ikuni17 May 30, 2024
ea9b302
ignore node.options on git add
Ikuni17 May 30, 2024
36ae373
check for node.options. cleanup
Ikuni17 May 30, 2024
9f39895
Merge remote-tracking branch 'upstream/main' into fips-agent-test
Ikuni17 May 30, 2024
23275dc
cleanup
Ikuni17 May 30, 2024
1406c2f
adjust fips verification check
Ikuni17 May 30, 2024
7fc2de6
remove all invisible characters
Ikuni17 May 30, 2024
3764367
debug
Ikuni17 May 30, 2024
0006d78
remove ansi char
Ikuni17 May 30, 2024
ea75be1
Merge branch 'main' into fips-agent-test
Ikuni17 May 31, 2024
e544957
Merge remote-tracking branch 'upstream/main' into fips-agent-test
Ikuni17 Jun 3, 2024
8342e13
fix potential bug. add sed comment
Ikuni17 Jun 3, 2024
1441214
Merge branch 'main' into fips-agent-test
Ikuni17 Jun 6, 2024
76e2373
Merge remote-tracking branch 'upstream/main' into fips-agent-test
Ikuni17 Jun 10, 2024
91f1425
Merge remote-tracking branch 'upstream/main' into fips-agent-test
Ikuni17 Jun 10, 2024
c7a9aa0
Merge remote-tracking branch 'upstream/main' into fips-agent-test
Ikuni17 Jun 10, 2024
4b4616f
increase build timeout
Ikuni17 Jun 11, 2024
63f8540
Merge remote-tracking branch 'upstream/main' into fips-agent-test
Ikuni17 Jun 11, 2024
ef391d0
Revert "increase build timeout"
Ikuni17 Jun 11, 2024
8bd94f9
fix node path
Ikuni17 Jun 11, 2024
5a6fa91
rename agent images
Ikuni17 Jun 11, 2024
5e8f1bc
change env variable flow
Ikuni17 Jun 11, 2024
fff6902
Merge remote-tracking branch 'upstream/main' into fips-agent-test
Ikuni17 Jun 11, 2024
3a33141
Merge branch 'main' into fips-agent-test
Ikuni17 Jun 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .buildkite/pipeline-utils/agentImages.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, looks like most of the files are snake case

Copy link
Contributor Author

@Ikuni17 Ikuni17 Jun 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* 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',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once elastic/ci-agent-images#686 is merged this can be updated to prod

};

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',
'warning',
'#### FIPS Agents Enabled<br />\nFIPS mode can produce new test failures. If you did not intend this remove ```FTR_ENABLE_FIPS_AGENT``` 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 };
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { BuildkiteClient, BuildkiteStep } from '../buildkite';
import { CiStatsClient, TestGroupRunOrderResponse } from './client';

import DISABLED_JEST_CONFIGS from '../../disabled_jest_configs.json';
import { getAgentImageConfig } from '#pipeline-utils';

type RunGroup = TestGroupRunOrderResponse['types'][0];

Expand All @@ -25,9 +26,7 @@ const getAgentRule = (queueName: string = 'n2-4-spot') => {
if (process.env?.BUILDKITE_AGENT_META_DATA_QUEUE === 'gobld') {
const [kind, cores, spot] = queueName.split('-');
return {
provider: 'gcp',
image: 'family/kibana-ubuntu-2004',
imageProject: 'elastic-images-prod',
...getAgentImageConfig(),
machineType: `${kind}-standard-${cores}`,
preemptible: spot === 'spot',
};
Expand Down
1 change: 1 addition & 0 deletions .buildkite/pipeline-utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Side Public License, v 1.
*/

export * from './agentImages';
export * from './buildkite';
export * as CiStats from './ci-stats';
export * from './github';
Expand Down
3 changes: 0 additions & 3 deletions .buildkite/pipelines/pull_request/apm_cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ steps:
- command: .buildkite/scripts/steps/functional/apm_cypress.sh
label: 'APM Cypress Tests'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-4
preemptible: true
depends_on:
Expand Down
30 changes: 0 additions & 30 deletions .buildkite/pipelines/pull_request/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,13 @@ steps:
label: Pre-Build
timeout_in_minutes: 10
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-2

- wait

- command: .buildkite/scripts/steps/build_kibana.sh
label: Build Kibana Distribution and Plugins
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-16
preemptible: true
key: build
Expand All @@ -29,9 +23,6 @@ steps:
- command: .buildkite/scripts/steps/quick_checks.sh
label: 'Quick Checks'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-2
preemptible: true
key: quick_checks
Expand All @@ -46,9 +37,6 @@ steps:
- command: .buildkite/scripts/steps/ci_stats_ready.sh
label: Mark CI Stats as ready
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-2
timeout_in_minutes: 10
depends_on:
Expand All @@ -62,9 +50,6 @@ steps:
- command: .buildkite/scripts/steps/test/pick_test_group_run_order.sh
label: 'Pick Test Group Run Order'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-2
timeout_in_minutes: 10
env:
Expand All @@ -79,9 +64,6 @@ steps:
- command: .buildkite/scripts/steps/lint.sh
label: 'Linting'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-8
preemptible: true
key: linting
Expand All @@ -94,9 +76,6 @@ steps:
- command: .buildkite/scripts/steps/check_types.sh
label: 'Check Types'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-4
preemptible: true
key: check_types
Expand All @@ -109,9 +88,6 @@ steps:
- command: .buildkite/scripts/steps/lint_with_types.sh
label: 'Linting (with types)'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-16
preemptible: true
key: linting_with_types
Expand All @@ -125,9 +101,6 @@ steps:
label: 'Checks'
key: checks
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-2
preemptible: true
timeout_in_minutes: 60
Expand All @@ -139,9 +112,6 @@ steps:
- command: .buildkite/scripts/steps/api_docs/build_api_docs.sh
label: 'Build API Docs'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-4
preemptible: true
key: build_api_docs
Expand Down
3 changes: 0 additions & 3 deletions .buildkite/pipelines/pull_request/build_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ steps:
- command: .buildkite/scripts/steps/artifacts/docker_image.sh
label: 'Build Project Image'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-16
preemptible: true
timeout_in_minutes: 60
Expand Down
3 changes: 0 additions & 3 deletions .buildkite/pipelines/pull_request/check_next_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ steps:
- command: .buildkite/scripts/steps/next_docs/build_and_validate_docs.sh
label: 'Build and Validate Next Docs'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-4
preemptible: true
timeout_in_minutes: 30
Expand Down
3 changes: 0 additions & 3 deletions .buildkite/pipelines/pull_request/deploy_cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ steps:
- command: .buildkite/scripts/steps/cloud/build_and_deploy.sh
label: 'Build and Deploy to Cloud'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-2
preemptible: true
depends_on:
Expand Down
6 changes: 0 additions & 6 deletions .buildkite/pipelines/pull_request/deploy_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ steps:
label: 'Build Project Image'
key: build_project_image
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-16
preemptible: true
timeout_in_minutes: 60
Expand All @@ -16,9 +13,6 @@ steps:
- command: .buildkite/scripts/steps/serverless/deploy.sh
label: 'Deploy Project'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-4
preemptible: true
timeout_in_minutes: 10
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ steps:
- command: .buildkite/scripts/steps/functional/exploratory_view_plugin.sh
label: 'Exploratory View @elastic/synthetics Tests'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-4
preemptible: true
depends_on:
Expand Down
3 changes: 0 additions & 3 deletions .buildkite/pipelines/pull_request/fips.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ steps:
- command: .buildkite/scripts/steps/fips/build.sh
label: 'Build FIPS Image'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-2
preemptible: true
depends_on:
Expand Down
3 changes: 0 additions & 3 deletions .buildkite/pipelines/pull_request/fleet_cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ steps:
- command: .buildkite/scripts/steps/functional/fleet_cypress.sh
label: 'Fleet Cypress Tests'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-4
preemptible: true
depends_on:
Expand Down
3 changes: 0 additions & 3 deletions .buildkite/pipelines/pull_request/kbn_handlebars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ steps:
- command: .buildkite/scripts/steps/test/kbn_handlebars.sh
label: 'Check @kbn/handlebars for upstream differences'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-2
preemptible: true
depends_on:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ steps:
- command: .buildkite/scripts/steps/functional/observability_onboarding_cypress.sh
label: 'Observability onboarding Cypress Tests'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-4
preemptible: true
depends_on:
Expand Down
3 changes: 0 additions & 3 deletions .buildkite/pipelines/pull_request/post_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,4 @@ steps:
- command: .buildkite/scripts/lifecycle/post_build.sh
label: Post-Build
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-2
3 changes: 0 additions & 3 deletions .buildkite/pipelines/pull_request/profiling_cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ steps:
- command: .buildkite/scripts/steps/functional/profiling_cypress.sh
label: 'Profiling Cypress Tests'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-4
preemptible: true
depends_on:
Expand Down
3 changes: 0 additions & 3 deletions .buildkite/pipelines/pull_request/response_ops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ steps:
- command: .buildkite/scripts/steps/functional/response_ops.sh
label: 'Rules, Alerts and Exceptions ResponseOps Cypress Tests on Security Solution'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-4
preemptible: true
depends_on:
Expand Down
3 changes: 0 additions & 3 deletions .buildkite/pipelines/pull_request/response_ops_cases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ steps:
- command: .buildkite/scripts/steps/functional/response_ops_cases.sh
label: 'Cases Cypress Tests on Security Solution'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-4
preemptible: true
depends_on:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ steps:
- command: .buildkite/scripts/steps/functional/security_serverless_ai_assistant.sh
label: 'Serverless AI Assistant - Security Solution Cypress Tests'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-4
preemptible: true
depends_on:
Expand All @@ -20,9 +17,6 @@ steps:
- command: .buildkite/scripts/steps/functional/security_solution_ai_assistant.sh
label: 'AI Assistant - Security Solution Cypress Tests'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-4
preemptible: true
depends_on:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ steps:
- command: .buildkite/scripts/steps/functional/defend_workflows_burn.sh
label: '[Soft fail] Defend Workflows Cypress Tests, burning changed specs'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
enableNestedVirtualization: true
localSsds: 1
localSsdInterface: nvme
Expand All @@ -21,9 +18,6 @@ steps:
- command: .buildkite/scripts/steps/functional/defend_workflows_serverless_burn.sh
label: '[Soft fail] Defend Workflows Cypress Tests on Serverless, burning changed specs'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
enableNestedVirtualization: true
localSsds: 1
localSsdInterface: nvme
Expand All @@ -40,9 +34,6 @@ steps:
- command: .buildkite/scripts/steps/functional/security_solution_burn.sh
label: '[Soft fail] Security Solution Cypress tests, burning changed specs'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-4
preemptible: true
depends_on:
Expand All @@ -57,9 +48,6 @@ steps:
- command: .buildkite/scripts/steps/functional/osquery_cypress_burn.sh
label: '[Soft fail] Osquery Cypress Tests, burning changed specs'
agents:
image: family/kibana-ubuntu-2004
imageProject: elastic-images-prod
provider: gcp
machineType: n2-standard-4
preemptible: true
depends_on:
Expand Down
Loading