Skip to content

Commit 3b13a07

Browse files
ycombinatorKaan Yalti
authored andcommitted
[CI][FIPS] Reconfigure pipeline to use Staging GovCloud/FRH ESS environment (elastic#9198)
* Get Staging FRH/GovCloud API key from Vault * Point Elastic Cloud API endpoint for TF provider to Staging FRH/GovCloud environment * Updating Vault path for API key * [Test commit] No-op change to trigger FIPS tests * Set ESS region to Staging GovCloud region * Check if variable is set before using it * Use default value * Parameterize deployment template ID * Debugging terraform * Forgot to pass deployment template ID * Use TF_VAR_* instead of adding new env vars * Fix deployment template ID * Set ES and Kibana Docker image URLs * Removing unrelated changes * Set -fips suffix on default docker images * Remove commented out lines * Bring back ESS_REGION env var * Define default ESS_REGION so it's not unbound * Restoring file from main * Try to set STACK_BUILD_ID to "" * [Testing] Hardcoding stack build ID * Only use STACK_VERSION when FIPS=true * Revert "[Testing] Hardcoding stack build ID" This reverts commit fb275fb. * Remove unnecessary line
1 parent 3a0efec commit 3b13a07

File tree

4 files changed

+32
-11
lines changed

4 files changed

+32
-11
lines changed

.buildkite/bk.integration-fips.pipeline.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ env:
1111
# This section is used to define the plugins that will be used in the pipeline.
1212
# See https://buildkite.com/docs/pipelines/integrations/plugins/using#using-yaml-anchors-with-plugins
1313
common:
14-
- vault_ec_key_prod: &vault_ec_key_prod
14+
- vault_ec_key_staging_frh_gov: &vault_ec_key_staging_frh_gov
1515
elastic/vault-secrets#v0.1.0:
16-
path: "kv/ci-shared/platform-ingest/platform-ingest-ec-prod"
16+
path: "kv/ci-shared/platform-ingest/platform-ingest-ec-staging-gov"
1717
field: "apiKey"
1818
env_var: "EC_API_KEY"
1919

@@ -23,7 +23,11 @@ steps:
2323
env:
2424
ASDF_TERRAFORM_VERSION: 1.9.2
2525
FIPS: "true"
26+
EC_ENDPOINT: "https://api.staging.elastic-gov.com"
27+
ESS_REGION: "us-gov-east-1"
28+
TF_VAR_deployment_template_id: "aws-general-purpose"
2629
TF_VAR_integration_server_docker_image: "docker.elastic.co/beats-ci/elastic-agent-cloud-fips:git-${BUILDKITE_COMMIT:0:12}"
30+
TF_VAR_docker_images_name_suffix: "-fips"
2731
command: |
2832
source .buildkite/scripts/steps/ess_start.sh
2933
artifact_paths:
@@ -33,7 +37,7 @@ steps:
3337
image: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:0.5"
3438
useCustomGlobalHooks: true
3539
plugins:
36-
- *vault_ec_key_prod
40+
- *vault_ec_key_staging_frh_gov
3741

3842
- group: "fips:Stateful:Ubuntu"
3943
key: integration-tests-ubuntu-fips
@@ -61,7 +65,7 @@ steps:
6165
image: "${IMAGE_UBUNTU_X86_64_FIPS}"
6266
instanceType: "m5.2xlarge"
6367
plugins:
64-
- *vault_ec_key_prod
68+
- *vault_ec_key_staging_frh_gov
6569
matrix:
6670
setup:
6771
sudo:
@@ -91,7 +95,7 @@ steps:
9195
image: "${IMAGE_UBUNTU_ARM64_FIPS}"
9296
instanceType: "m6g.2xlarge"
9397
plugins:
94-
- *vault_ec_key_prod
98+
- *vault_ec_key_staging_frh_gov
9599
matrix:
96100
setup:
97101
sudo:
@@ -118,7 +122,7 @@ steps:
118122
image: "${IMAGE_UBUNTU_X86_64_FIPS}"
119123
instanceType: "m5.2xlarge"
120124
plugins:
121-
- *vault_ec_key_prod
125+
- *vault_ec_key_staging_frh_gov
122126

123127
- label: ESS FIPS stack cleanup
124128
depends_on:
@@ -132,7 +136,7 @@ steps:
132136
image: "docker.elastic.co/ci-agent-images/platform-ingest/buildkite-agent-beats-ci-with-hooks:0.5"
133137
useCustomGlobalHooks: true
134138
plugins:
135-
- *vault_ec_key_prod
139+
- *vault_ec_key_staging_frh_gov
136140

137141
- label: Aggregate test reports
138142
depends_on:

.buildkite/scripts/steps/ess_start.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@ source .buildkite/scripts/steps/fleet.sh
66

77
STACK_VERSION="$(jq -r '.version' .package-version)"
88
STACK_BUILD_ID="$(jq -r '.stack_build_id' .package-version)"
9+
if [[ "${FIPS:-false}" == "true" ]]; then
10+
# FRH testing environment does not have same stack build IDs as CFT environment so
11+
# we just go with the STACK_VERSION.
12+
STACK_BUILD_ID=""
13+
fi
14+
ESS_REGION="${ESS_REGION:-gcp-us-west2}"
915

10-
ess_up "$STACK_VERSION" "$STACK_BUILD_ID"
16+
ess_up "$STACK_VERSION" "$STACK_BUILD_ID" "$ESS_REGION"
1117

1218
preinstall_fleet_packages
1319

.buildkite/scripts/steps/integration_tests_tf.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ fi
2525
# This file is managed by an automation (mage integration:UpdateAgentPackageVersion) that check if the snapshot is ready.
2626
STACK_VERSION="$(jq -r '.version' .package-version)"
2727
STACK_BUILD_ID="$(jq -r '.stack_build_id' .package-version)"
28+
if [[ "${FIPS:-false}" == "true" ]]; then
29+
# FRH testing environment does not have same stack build IDs as CFT environment so
30+
# we just go with the STACK_VERSION.
31+
STACK_BUILD_ID=""
32+
fi
2833

2934
echo "~~~ Building test binaries"
3035
mage build:testBinaries

test_infra/ess/deployment.tf

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ variable "kibana_docker_image" {
5858
description = "Docker image override for kibana"
5959
}
6060

61+
variable "docker_images_name_suffix" {
62+
type = string
63+
default = ""
64+
description = "Suffix to append to the docker images names"
65+
}
66+
6167
resource "random_uuid" "deployment_suffix" {
6268
}
6369

@@ -80,9 +86,9 @@ locals {
8086
yamldecode(file("${path.module}/../../pkg/testing/ess/create_deployment_csp_configuration.yaml")))
8187

8288
images_version = coalesce(var.stack_build_id, var.stack_version)
83-
integration_server_docker_image = coalesce(var.integration_server_docker_image, local.ess_properties.docker.integration_server_image, "docker.elastic.co/cloud-release/elastic-agent-cloud:${local.images_version}")
84-
elasticsearch_docker_image = coalesce(var.elasticsearch_docker_image, local.ess_properties.docker.elasticsearch_image, "docker.elastic.co/cloud-release/elasticsearch-cloud-ess:${local.images_version}")
85-
kibana_docker_image = coalesce(var.kibana_docker_image, local.ess_properties.docker.kibana_image, "docker.elastic.co/cloud-release/kibana-cloud:${local.images_version}")
89+
integration_server_docker_image = coalesce(var.integration_server_docker_image, local.ess_properties.docker.integration_server_image, "docker.elastic.co/cloud-release/elastic-agent-cloud${var.docker_images_name_suffix}:${local.images_version}")
90+
elasticsearch_docker_image = coalesce(var.elasticsearch_docker_image, local.ess_properties.docker.elasticsearch_image, "docker.elastic.co/cloud-release/elasticsearch-cloud-ess${var.docker_images_name_suffix}:${local.images_version}")
91+
kibana_docker_image = coalesce(var.kibana_docker_image, local.ess_properties.docker.kibana_image, "docker.elastic.co/cloud-release/kibana-cloud${var.docker_images_name_suffix}:${local.images_version}")
8692
}
8793

8894
# If we have defined a stack version, validate that this version exists on that region and return it.

0 commit comments

Comments
 (0)