Skip to content

Commit 72d3151

Browse files
Fix ECH and Serverless test workflows (#3086)
* update serverless wf * fix str * fix lint issues * update test suite * add retry mechanism for aws provider * update provider config * revert bump version change
1 parent 55e6a23 commit 72d3151

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

.github/workflows/weekly-serverless.yml

+11-1
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,22 @@ jobs:
1111
runs-on: ubuntu-latest
1212
outputs:
1313
deployment_name: ${{ steps.set_deployment_name.outputs.date-name }}
14+
stack_version: ${{ steps.set_deployment_name.outputs.stack-version }}
1415
steps:
16+
- name: Check out the repo
17+
uses: actions/checkout@v4
18+
19+
- name: Hermit Environment
20+
uses: ./.github/actions/hermit
21+
1522
- name: Set deployment name
1623
id: set_deployment_name
24+
env:
25+
STACK_VERSION: ${{ env.ELK_VERSION }}
1726
run: |
1827
date_name=$(echo "prd-env-$(date +'%d%b%H%M')" | tr '[:upper:]' '[:lower:]')
1928
echo "date-name=$date_name" >> $GITHUB_OUTPUT
29+
echo "stack-version=$STACK_VERSION" >> $GITHUB_OUTPUT
2030
2131
deploy:
2232
needs: naming
@@ -30,7 +40,7 @@ jobs:
3040
deployment_name: ${{ needs.naming.outputs.deployment_name }}
3141
# For now, the region is not used because it's overridden in the tf, but it's here for future compatibility.
3242
ess-region: "aws-us-east-1"
33-
elk-stack-version: 9.0.0-SNAPSHOT
43+
elk-stack-version: ${{ needs.naming.outputs.stack_version }}
3444
serverless_mode: true
3545
run-sanity-tests: true
3646
expiration_days: 0

deploy/test-environments/cis/main.tf

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
provider "aws" {
2-
region = var.region
2+
region = var.region
3+
max_retries = 30
34
}
45

56
locals {

tests/integration/tests/test_sanity_checks.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
COMPONENTS_BACKOFF = 10
3131

3232
AGENT_VERSION = elasticsearch.agent_version
33+
if AGENT_VERSION.endswith("SNAPSHOT"):
34+
AGENT_VERSION = AGENT_VERSION.split("-")[0]
3335

3436
# Check if AGENT_VERSION is provided
3537
if not AGENT_VERSION:
@@ -181,7 +183,6 @@ def test_cspm_aws_findings(
181183
query_list = build_query_list(
182184
benchmark_id="cis_aws",
183185
match_type=match_type,
184-
version=AGENT_VERSION,
185186
agent=agent,
186187
)
187188
query, sort = cspm_client.build_es_must_match_query(must_query_list=query_list, time_range="now-24h")
@@ -244,7 +245,6 @@ def test_cspm_gcp_findings(
244245
query_list = build_query_list(
245246
benchmark_id="cis_gcp",
246247
match_type=match_type,
247-
version=AGENT_VERSION,
248248
agent=agent,
249249
)
250250
query, sort = cspm_client.build_es_must_match_query(must_query_list=query_list, time_range="now-24h")
@@ -279,7 +279,6 @@ def test_cspm_azure_findings(
279279
for agent in azure_agents:
280280
query_list = build_query_list(
281281
benchmark_id="cis_azure",
282-
version=AGENT_VERSION,
283282
match_type=match_type,
284283
agent=agent,
285284
)

tests/integrations_setup/configuration_fleet.py

+5
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"Key=project,Value=test-environments"
3030
)
3131

32+
DOCKER_ARTIFACTORY_AGENT = "docker.elastic.co/elastic-agent/elastic-agent"
3233

3334
elk_config = Munch()
3435
elk_config.user = os.getenv("ES_USER", "NA")
@@ -40,6 +41,10 @@
4041

4142
kspm_config = Munch()
4243
kspm_config.docker_image_override = os.getenv("DOCKER_IMAGE_OVERRIDE", "")
44+
if not kspm_config.docker_image_override and elk_config.stack_version.endswith("SNAPSHOT"):
45+
kspm_config.docker_image_override = f"{DOCKER_ARTIFACTORY_AGENT}:{elk_config.stack_version}"
46+
if elk_config.agent_version:
47+
kspm_config.docker_image_override = f"{DOCKER_ARTIFACTORY_AGENT}:{elk_config.agent_version}"
4348

4449
aws_config = Munch()
4550
aws_config.access_key_id = os.getenv("AWS_ACCESS_KEY_ID", "NA")

0 commit comments

Comments
 (0)