Skip to content

Commit e3a80a2

Browse files
jsorianomrodm
andauthored
Update default stack version to 8.6.1 (#1118)
Add also some options to try to reduce flakiness in elastic-package stack up: * Retry limits have been replaced with start periods. * Fleet-server and elastic-agent healthcheck retries have been increased. * When docker-compose up fails and elastic-agent container is the only container failing, retry once, this may happen if it tries to enroll while fleet-server is being restarted or reconfigured. Co-authored-by: Mario Rodriguez Molins <mario.rodriguez@elastic.co>
1 parent 85cde15 commit e3a80a2

File tree

7 files changed

+40
-13
lines changed

7 files changed

+40
-13
lines changed

internal/install/stack_version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ package install
66

77
const (
88
// DefaultStackVersion is the default version of the stack
9-
DefaultStackVersion = "8.5.1"
9+
DefaultStackVersion = "8.6.1"
1010
)

internal/profile/_static/docker-compose-stack.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ services:
44
image: "${ELASTICSEARCH_IMAGE_REF}"
55
healthcheck:
66
test: "curl -s --cacert /usr/share/elasticsearch/config/certs/ca-cert.pem -f -u elastic:changeme https://127.0.0.1:9200/_cat/health | cut -f4 -d' ' | grep -E '(green|yellow)'"
7-
retries: 300
8-
interval: 1s
7+
start_period: 300s
8+
interval: 5s
99
environment:
1010
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
1111
- "ELASTIC_PASSWORD=changeme"
@@ -32,8 +32,8 @@ services:
3232
condition: service_healthy
3333
healthcheck:
3434
test: "sh /usr/share/kibana/healthcheck.sh"
35-
retries: 600
36-
interval: 1s
35+
start_period: 600s
36+
interval: 5s
3737
env_file:
3838
- "../certs/ca.env"
3939
environment:
@@ -60,8 +60,8 @@ services:
6060
PROFILE: "${PROFILE_NAME}"
6161
healthcheck:
6262
test: ["CMD", "curl", "--cacert", "/etc/ssl/package-registry/ca-cert.pem", "-f", "https://localhost:8080"]
63-
retries: 300
64-
interval: 1s
63+
start_period: 300s
64+
interval: 5s
6565
environment:
6666
- "EPR_LOG_LEVEL=debug"
6767
- "EPR_ADDRESS=0.0.0.0:8080"
@@ -89,7 +89,7 @@ services:
8989
condition: service_healthy
9090
healthcheck:
9191
test: "curl --cacert /etc/ssl/elastic-agent/ca-cert.pem -f https://localhost:8220/api/status | grep -i healthy 2>&1 >/dev/null"
92-
retries: 60
92+
start_period: 60s
9393
interval: 5s
9494
hostname: docker-fleet-server
9595
environment:
@@ -124,8 +124,10 @@ services:
124124
condition: service_healthy
125125
healthcheck:
126126
test: "elastic-agent status"
127+
timeout: 2s
128+
start_period: 360s
127129
retries: 180
128-
interval: 1s
130+
interval: 5s
129131
hostname: docker-fleet-agent
130132
env_file: "./elastic-agent.${STACK_VERSION_VARIANT}.env"
131133
volumes:

internal/stack/boot.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,41 @@ func BootUp(options Options) error {
6060

6161
err = dockerComposeUp(options)
6262
if err != nil {
63+
// At least starting on 8.6.0, fleet-server may be reconfigured or
64+
// restarted after being healthy. If elastic-agent tries to enroll at
65+
// this moment, it fails inmediately, stopping and making `docker-compose up`
66+
// to fail too.
67+
// As a workaround, try to give another chance to docker-compose if only
68+
// elastic-agent failed.
69+
if onlyElasticAgentFailed() {
70+
fmt.Println("Elastic Agent failed to start, trying again.")
71+
err = dockerComposeUp(options)
72+
}
6373
return errors.Wrap(err, "running docker-compose failed")
6474
}
6575

6676
return nil
6777
}
6878

79+
func onlyElasticAgentFailed() bool {
80+
status, err := Status()
81+
if err != nil {
82+
fmt.Printf("Failed to check status of the stack after failure: %v\n", err)
83+
return false
84+
}
85+
86+
for _, service := range status {
87+
if strings.Contains(service.Name, "elastic-agent") {
88+
continue
89+
}
90+
if !strings.HasPrefix(service.Status, "running") {
91+
return false
92+
}
93+
}
94+
95+
return true
96+
}
97+
6998
// TearDown function takes down the testing stack.
7099
func TearDown(options Options) error {
71100
err := dockerComposeDown(options)

test/packages/benchmarks/pipeline_benchmark/manifest.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ title: Pipeline benchmarks
77
version: 999.999.999
88
description: Test for pipeline test runner
99
categories: ["network"]
10-
release: experimental
1110
license: basic
1211
type: integration
1312
conditions:

test/packages/benchmarks/use_pipeline_tests/manifest.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ title: Use pipeline tests for the benchmark
77
version: 999.999.999
88
description: Test for pipeline test runner
99
categories: ["network"]
10-
release: experimental
1110
license: basic
1211
type: integration
1312
conditions:

test/packages/other/multiinput/manifest.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ title: Multi-input test
77
version: 999.999.999
88
description: Test for multiple input tests
99
categories: ["network"]
10-
release: experimental
1110
license: basic
1211
type: integration
1312
conditions:

test/packages/other/pipeline_tests/manifest.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ title: Pipeline tests
77
version: 999.999.999
88
description: Test for pipeline test runner
99
categories: ["network"]
10-
release: experimental
1110
license: basic
1211
type: integration
1312
conditions:

0 commit comments

Comments
 (0)