From 7911ff70d9bfd157544892d5f8b748b122b09b21 Mon Sep 17 00:00:00 2001 From: mtojek Date: Tue, 26 Oct 2021 12:05:15 +0200 Subject: [PATCH 01/13] Test boot up of different stack versions --- .ci/Jenkinsfile | 4 +++- Makefile | 12 ++++++++++-- scripts/test-stack-command.sh | 12 +++++++++--- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 22e2a9b6f1..20fc7128ca 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -91,7 +91,9 @@ pipeline { dir("${BASE_DIR}") { script { parallel([ - 'stack-command': generateTestCommandStage(command: 'test-stack-command', artifacts: ['build/elastic-stack-dump/stack/logs/*.log', 'build/elastic-stack-dump/stack/logs/fleet-server-internal/*']), + 'stack-command-715x': generateTestCommandStage(command: 'test-stack-command-715x', artifacts: ['build/elastic-stack-dump/stack/*/logs/*.log', 'build/elastic-stack-dump/stack/*/logs/fleet-server-internal/*']), + 'stack-command-716x': generateTestCommandStage(command: 'test-stack-command-716x', artifacts: ['build/elastic-stack-dump/stack/*/logs/*.log', 'build/elastic-stack-dump/stack/*/logs/fleet-server-internal/*']), + 'stack-command-8x': generateTestCommandStage(command: 'test-stack-command-8x', artifacts: ['build/elastic-stack-dump/stack/*/logs/*.log', 'build/elastic-stack-dump/stack/*/logs/fleet-server-internal/*']), 'check-packages': generateTestCommandStage(command: 'test-check-packages', artifacts: ['build/test-results/*.xml', 'build/kubectl-dump.txt', 'build/elastic-stack-dump/check/logs/*.log', 'build/elastic-stack-dump/check/logs/fleet-server-internal/*'], junitArtifacts: true, publishCoverage: true), 'build-zip': generateTestCommandStage(command: 'test-build-zip', artifacts: ['build/elastic-stack-dump/build-zip/logs/*.log']), 'profiles-command': generateTestCommandStage(command: 'test-profiles-command'), diff --git a/Makefile b/Makefile index f86268ab07..d657cd9b77 100644 --- a/Makefile +++ b/Makefile @@ -38,8 +38,16 @@ test-go-ci: $(MAKE) test-go | go run github.com/tebeka/go2xunit > "$(PWD)/build/test-results/TEST-unit.xml" go run github.com/boumenot/gocover-cobertura < $(CODE_COVERAGE_REPORT_NAME_UNIT).out > $(CODE_COVERAGE_REPORT_NAME_UNIT).xml -test-stack-command: - ./scripts/test-stack-command.sh +test-stack-command-715x: + ./scripts/test-stack-command.sh 7.15.1 + +test-stack-command-716x: + ./scripts/test-stack-command.sh 7.16.0-SNAPSHOT + +test-stack-command-8x: + ./scripts/test-stack-command.sh 8.0.0-SNAPSHOT + +test-stack-command: test-stack-command-715x test-stack-command-716x test-stack-command-8x test-check-packages: ./scripts/test-check-packages.sh diff --git a/scripts/test-stack-command.sh b/scripts/test-stack-command.sh index 32e2b88b8b..7afb0ccf05 100755 --- a/scripts/test-stack-command.sh +++ b/scripts/test-stack-command.sh @@ -2,11 +2,17 @@ set -euxo pipefail +VERSION=${1} + +if [ "${VERSION}" == "" ]; then + echo "stack version required" && exit 1 +fi + cleanup() { r=$? # Dump stack logs - elastic-package stack dump -v --output build/elastic-stack-dump/stack + elastic-package stack dump -v --output build/elastic-stack-dump/stack/${VERSION} # Take down the stack elastic-package stack down -v @@ -25,10 +31,10 @@ cleanup() { trap cleanup EXIT # Update the stack -elastic-package stack update -v +elastic-package stack update --version ${VERSION} -v # Boot up the stack -elastic-package stack up -d -v +elastic-package stack up -d --version ${VERSION} -v # Verify it's accessible eval "$(elastic-package stack shellinit)" From 20a0176368c4039e0376e8455391712ffd7b0bb7 Mon Sep 17 00:00:00 2001 From: mtojek Date: Tue, 26 Oct 2021 12:48:06 +0200 Subject: [PATCH 02/13] Reword: default lts 8x --- .ci/Jenkinsfile | 4 ++-- Makefile | 6 +++--- scripts/test-stack-command.sh | 15 ++++++++------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 20fc7128ca..c159a3b44e 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -91,8 +91,8 @@ pipeline { dir("${BASE_DIR}") { script { parallel([ - 'stack-command-715x': generateTestCommandStage(command: 'test-stack-command-715x', artifacts: ['build/elastic-stack-dump/stack/*/logs/*.log', 'build/elastic-stack-dump/stack/*/logs/fleet-server-internal/*']), - 'stack-command-716x': generateTestCommandStage(command: 'test-stack-command-716x', artifacts: ['build/elastic-stack-dump/stack/*/logs/*.log', 'build/elastic-stack-dump/stack/*/logs/fleet-server-internal/*']), + 'stack-command-default': generateTestCommandStage(command: 'test-stack-command-default', artifacts: ['build/elastic-stack-dump/stack/*/logs/*.log', 'build/elastic-stack-dump/stack/*/logs/fleet-server-internal/*']), + 'stack-command-lts': generateTestCommandStage(command: 'test-stack-command-lts', artifacts: ['build/elastic-stack-dump/stack/*/logs/*.log', 'build/elastic-stack-dump/stack/*/logs/fleet-server-internal/*']), 'stack-command-8x': generateTestCommandStage(command: 'test-stack-command-8x', artifacts: ['build/elastic-stack-dump/stack/*/logs/*.log', 'build/elastic-stack-dump/stack/*/logs/fleet-server-internal/*']), 'check-packages': generateTestCommandStage(command: 'test-check-packages', artifacts: ['build/test-results/*.xml', 'build/kubectl-dump.txt', 'build/elastic-stack-dump/check/logs/*.log', 'build/elastic-stack-dump/check/logs/fleet-server-internal/*'], junitArtifacts: true, publishCoverage: true), 'build-zip': generateTestCommandStage(command: 'test-build-zip', artifacts: ['build/elastic-stack-dump/build-zip/logs/*.log']), diff --git a/Makefile b/Makefile index d657cd9b77..1914a9b29b 100644 --- a/Makefile +++ b/Makefile @@ -38,10 +38,10 @@ test-go-ci: $(MAKE) test-go | go run github.com/tebeka/go2xunit > "$(PWD)/build/test-results/TEST-unit.xml" go run github.com/boumenot/gocover-cobertura < $(CODE_COVERAGE_REPORT_NAME_UNIT).out > $(CODE_COVERAGE_REPORT_NAME_UNIT).xml -test-stack-command-715x: - ./scripts/test-stack-command.sh 7.15.1 +test-stack-command-default: + ./scripts/test-stack-command.sh -test-stack-command-716x: +test-stack-command-lts: ./scripts/test-stack-command.sh 7.16.0-SNAPSHOT test-stack-command-8x: diff --git a/scripts/test-stack-command.sh b/scripts/test-stack-command.sh index 7afb0ccf05..c09f2bf958 100755 --- a/scripts/test-stack-command.sh +++ b/scripts/test-stack-command.sh @@ -2,11 +2,7 @@ set -euxo pipefail -VERSION=${1} - -if [ "${VERSION}" == "" ]; then - echo "stack version required" && exit 1 -fi +VERSION=${1:-default} cleanup() { r=$? @@ -30,11 +26,16 @@ cleanup() { trap cleanup EXIT +ARG_VERSION="" +if [ "${VERSION}" != "default" ]; then + ARG_VERSION="--version ${VERSION}" +fi + # Update the stack -elastic-package stack update --version ${VERSION} -v +elastic-package stack update -v ${ARG_VERSION} # Boot up the stack -elastic-package stack up -d --version ${VERSION} -v +elastic-package stack up -d -v ${ARG_VERSION} # Verify it's accessible eval "$(elastic-package stack shellinit)" From 31cd0a9e01d04d37b6697f93528c075ab306d0b4 Mon Sep 17 00:00:00 2001 From: mtojek Date: Tue, 26 Oct 2021 14:05:34 +0200 Subject: [PATCH 03/13] Use STACK_VERSION_VARIANT --- .../profile/_static/docker-compose-stack.yml | 4 +- internal/profile/_static/kibana_config_8x.yml | 15 ++++++ ...a_config.yml => kibana_config_default.yml} | 0 internal/profile/static.go | 2 +- internal/stack/compose.go | 46 +++++++++++++++++-- internal/stack/variants.go | 25 ++++++++++ 6 files changed, 85 insertions(+), 7 deletions(-) create mode 100644 internal/profile/_static/kibana_config_8x.yml rename internal/profile/_static/{kibana_config.yml => kibana_config_default.yml} (100%) create mode 100644 internal/stack/variants.go diff --git a/internal/profile/_static/docker-compose-stack.yml b/internal/profile/_static/docker-compose-stack.yml index e742f9c1f6..8a02ab27e9 100644 --- a/internal/profile/_static/docker-compose-stack.yml +++ b/internal/profile/_static/docker-compose-stack.yml @@ -43,8 +43,8 @@ services: retries: 600 interval: 1s volumes: - - ./kibana.config.yml:/usr/share/kibana/config/kibana.yml - - ../../../stack/healthcheck.sh:/usr/share/kibana/healthcheck.sh + - "./kibana.config.${STACK_VERSION_VARIANT}.yml:/usr/share/kibana/config/kibana.yml" + - "../../../stack/healthcheck.sh:/usr/share/kibana/healthcheck.sh" ports: - "127.0.0.1:5601:5601" diff --git a/internal/profile/_static/kibana_config_8x.yml b/internal/profile/_static/kibana_config_8x.yml new file mode 100644 index 0000000000..8af5fbf052 --- /dev/null +++ b/internal/profile/_static/kibana_config_8x.yml @@ -0,0 +1,15 @@ +server.name: kibana +server.host: "0.0.0.0" + +elasticsearch.hosts: [ "http://elasticsearch:9200" ] +elasticsearch.username: elastic +elasticsearch.password: changeme + +xpack.monitoring.ui.container.elasticsearch.enabled: true + +xpack.fleet.registryUrl: "http://package-registry:8080" +xpack.fleet.agents.enabled: true +xpack.fleet.agents.elasticsearch.host: "http://elasticsearch:9200" +xpack.fleet.agents.fleet_server.hosts: ["http://fleet-server:8220"] + +xpack.encryptedSavedObjects.encryptionKey: "12345678901234567890123456789012" diff --git a/internal/profile/_static/kibana_config.yml b/internal/profile/_static/kibana_config_default.yml similarity index 100% rename from internal/profile/_static/kibana_config.yml rename to internal/profile/_static/kibana_config_default.yml diff --git a/internal/profile/static.go b/internal/profile/static.go index 7bc218a8a3..f2ad081230 100644 --- a/internal/profile/static.go +++ b/internal/profile/static.go @@ -28,7 +28,7 @@ func newSnapshotFile(_ string, profilePath string) (*simpleFile, error) { // KibanaConfigFile is the main kibana config file const KibanaConfigFile configFile = "kibana.config.yml" -//go:embed _static/kibana_config.yml +//go:embed _static/kibana_config_default.yml var kibanaConfigYml string // newKibanaConfig returns a Managed Config diff --git a/internal/stack/compose.go b/internal/stack/compose.go index 64ec44d340..10cab705a6 100644 --- a/internal/stack/compose.go +++ b/internal/stack/compose.go @@ -14,6 +14,28 @@ import ( "github.com/elastic/elastic-package/internal/profile" ) +type envBuilder struct { + vars []string +} + +func newEnvBuilder() *envBuilder { + return new(envBuilder) +} + +func (eb *envBuilder) withEnvs(envs []string) *envBuilder { + eb.vars = append(eb.vars, envs...) + return eb +} + +func (eb *envBuilder) withEnv(env string) *envBuilder { + eb.vars = append(eb.vars, env) + return eb +} + +func (eb *envBuilder) build() []string { + return eb.vars +} + func dockerComposeBuild(options Options) error { c, err := compose.NewProject(DockerComposeProjectName, options.Profile.FetchPath(profile.SnapshotFile)) if err != nil { @@ -26,7 +48,11 @@ func dockerComposeBuild(options Options) error { } opts := compose.CommandOptions{ - Env: append(appConfig.StackImageRefs(options.StackVersion).AsEnv(), options.Profile.ComposeEnvVars()...), + Env: newEnvBuilder(). + withEnvs(appConfig.StackImageRefs(options.StackVersion).AsEnv()). + withEnv(selectStackVersion(options.StackVersion)). + withEnvs(options.Profile.ComposeEnvVars()). + build(), Services: withIsReadyServices(withDependentServices(options.Services)), } @@ -48,7 +74,11 @@ func dockerComposePull(options Options) error { } opts := compose.CommandOptions{ - Env: append(appConfig.StackImageRefs(options.StackVersion).AsEnv(), options.Profile.ComposeEnvVars()...), + Env: newEnvBuilder(). + withEnvs(appConfig.StackImageRefs(options.StackVersion).AsEnv()). + withEnv(selectStackVersion(options.StackVersion)). + withEnvs(options.Profile.ComposeEnvVars()). + build(), Services: withIsReadyServices(withDependentServices(options.Services)), } @@ -75,7 +105,11 @@ func dockerComposeUp(options Options) error { } opts := compose.CommandOptions{ - Env: append(appConfig.StackImageRefs(options.StackVersion).AsEnv(), options.Profile.ComposeEnvVars()...), + Env: newEnvBuilder(). + withEnvs(appConfig.StackImageRefs(options.StackVersion).AsEnv()). + withEnv(selectStackVersion(options.StackVersion)). + withEnvs(options.Profile.ComposeEnvVars()). + build(), ExtraArgs: args, Services: withIsReadyServices(withDependentServices(options.Services)), } @@ -98,7 +132,11 @@ func dockerComposeDown(options Options) error { } downOptions := compose.CommandOptions{ - Env: append(appConfig.StackImageRefs(options.StackVersion).AsEnv(), options.Profile.ComposeEnvVars()...), + Env: newEnvBuilder(). + withEnvs(appConfig.StackImageRefs(options.StackVersion).AsEnv()). + withEnv(selectStackVersion(options.StackVersion)). + withEnvs(options.Profile.ComposeEnvVars()). + build(), // Remove associated volumes. ExtraArgs: []string{"--volumes", "--remove-orphans"}, } diff --git a/internal/stack/variants.go b/internal/stack/variants.go new file mode 100644 index 0000000000..a069b30531 --- /dev/null +++ b/internal/stack/variants.go @@ -0,0 +1,25 @@ +// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one +// or more contributor license agreements. Licensed under the Elastic License; +// you may not use this file except in compliance with the Elastic License. + +package stack + +import ( + "fmt" + "strings" +) + +// stackVariantAsEnv function returns a stack variant based on the given stack version. +// We identified two variants: +// * default, covers all of 7.x branches +// * 8x, supports different configuration options in Kibana +func stackVariantAsEnv(version string) string { + return fmt.Sprintf("STACK_VERSION_VARIANT=%s", selectStackVersion(version)) +} + +func selectStackVersion(version string) string { + if strings.HasPrefix(version, "8.") { + return "8x" + } + return "default" +} From 0748b414ab7882d0752cb61bb37bb9a7b876b2db Mon Sep 17 00:00:00 2001 From: mtojek Date: Tue, 26 Oct 2021 14:11:18 +0200 Subject: [PATCH 04/13] Fix: Kibana --- internal/profile/profile.go | 3 ++- internal/profile/static.go | 29 +++++++++++++++++++++-------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/internal/profile/profile.go b/internal/profile/profile.go index 5eb16751e5..bfabc22d54 100644 --- a/internal/profile/profile.go +++ b/internal/profile/profile.go @@ -36,7 +36,8 @@ type configFile string // managedProfileFiles is the list of all files managed in a profile // If you create a new file that's managed by a profile, it needs to go in this list var managedProfileFiles = map[configFile]NewConfig{ - KibanaConfigFile: newKibanaConfig, + KibanaConfigDefaultFile: newKibanaConfigDefault, + KibanaConfig8xFile: newKibanaConfig8x, PackageRegistryDockerfileFile: newPackageRegistryDockerfile, PackageRegistryConfigFile: newPackageRegistryConfig, SnapshotFile: newSnapshotFile, diff --git a/internal/profile/static.go b/internal/profile/static.go index f2ad081230..3a7020c7e3 100644 --- a/internal/profile/static.go +++ b/internal/profile/static.go @@ -25,18 +25,31 @@ func newSnapshotFile(_ string, profilePath string) (*simpleFile, error) { }, nil } -// KibanaConfigFile is the main kibana config file -const KibanaConfigFile configFile = "kibana.config.yml" +// KibanaConfigDefaultFile is the default kibana config file +const KibanaConfigDefaultFile configFile = "kibana.config.default.yml" //go:embed _static/kibana_config_default.yml -var kibanaConfigYml string +var kibanaConfigDefaultYml string -// newKibanaConfig returns a Managed Config -func newKibanaConfig(_ string, profilePath string) (*simpleFile, error) { +func newKibanaConfigDefault(_ string, profilePath string) (*simpleFile, error) { return &simpleFile{ - name: string(KibanaConfigFile), - path: filepath.Join(profilePath, profileStackPath, string(KibanaConfigFile)), - body: kibanaConfigYml, + name: string(KibanaConfigDefaultFile), + path: filepath.Join(profilePath, profileStackPath, string(KibanaConfigDefaultFile)), + body: kibanaConfigDefaultYml, + }, nil +} + +// KibanaConfig8xFile is the Kibana config file for 8.x stack family +const KibanaConfig8xFile configFile = "kibana.config.8x.yml" + +//go:embed _static/kibana_config_8x.yml +var kibanaConfig8xYml string + +func newKibanaConfig8x(_ string, profilePath string) (*simpleFile, error) { + return &simpleFile{ + name: string(KibanaConfig8xFile), + path: filepath.Join(profilePath, profileStackPath, string(KibanaConfig8xFile)), + body: kibanaConfig8xYml, }, nil } From 4f7f72dc367f0368013553d71a808fdc0047444b Mon Sep 17 00:00:00 2001 From: mtojek Date: Tue, 26 Oct 2021 14:12:20 +0200 Subject: [PATCH 05/13] Fix --- internal/profile/files.go | 6 +++--- internal/profile/profile.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/profile/files.go b/internal/profile/files.go index 0bd5d1c1b9..18c0f19ccb 100644 --- a/internal/profile/files.go +++ b/internal/profile/files.go @@ -23,11 +23,11 @@ type simpleFile struct { const profileStackPath = "stack" -// configfilesDiffer checks to see if a local configItem differs from the one it knows. -func (cfg simpleFile) configfilesDiffer() (bool, error) { +// configFilesDiffer checks to see if a local configItem differs from the one it knows. +func (cfg simpleFile) configFilesDiffer() (bool, error) { changes, err := os.ReadFile(cfg.path) if err != nil { - return false, errors.Wrapf(err, "error reading %s", KibanaConfigFile) + return false, errors.Wrapf(err, "error reading %s", cfg.path) } if string(changes) != cfg.body { return true, nil diff --git a/internal/profile/profile.go b/internal/profile/profile.go index bfabc22d54..3b8a4c7931 100644 --- a/internal/profile/profile.go +++ b/internal/profile/profile.go @@ -241,7 +241,7 @@ func (profile Profile) localFilesChanged() (bool, error) { if cfgName == PackageProfileMetaFile { continue } - changes, err := cfgFile.configfilesDiffer() + changes, err := cfgFile.configFilesDiffer() if err != nil { return false, errors.Wrap(err, "error checking config file") } From 1d5e7fd0c954a0f91b82f1b9f0fd10e2156a93b6 Mon Sep 17 00:00:00 2001 From: mtojek Date: Tue, 26 Oct 2021 14:13:55 +0200 Subject: [PATCH 06/13] Fix: default --- internal/install/install.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/install/install.go b/internal/install/install.go index fe64337b22..a6d29406d9 100644 --- a/internal/install/install.go +++ b/internal/install/install.go @@ -104,7 +104,7 @@ func migrateIfNeeded(elasticPackagePath *locations.LocationManager) error { oldFiles := []string{ filepath.Join(elasticPackagePath.StackDir(), string(profile.SnapshotFile)), filepath.Join(elasticPackagePath.StackDir(), string(profile.PackageRegistryDockerfileFile)), - filepath.Join(elasticPackagePath.StackDir(), string(profile.KibanaConfigFile)), + filepath.Join(elasticPackagePath.StackDir(), string(profile.KibanaConfigDefaultFile)), filepath.Join(elasticPackagePath.StackDir(), string(profile.PackageRegistryConfigFile)), } From 34a44bdc7aa3b2b48d69ebe13139df8e6e05fa6c Mon Sep 17 00:00:00 2001 From: mtojek Date: Tue, 26 Oct 2021 14:21:57 +0200 Subject: [PATCH 07/13] Fix --- internal/stack/shellinit.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/stack/shellinit.go b/internal/stack/shellinit.go index 926e896e22..029976ae20 100644 --- a/internal/stack/shellinit.go +++ b/internal/stack/shellinit.go @@ -39,7 +39,8 @@ type kibanaConfiguration struct { // ShellInit method exposes environment variables that can be used for testing purposes. func ShellInit(elasticStackProfile *profile.Profile) (string, error) { // Read Elasticsearch username and password from Kibana configuration file. - body, err := os.ReadFile(elasticStackProfile.FetchPath(profile.KibanaConfigFile)) + // FIXME read credentials from correct Kibana config file, not default + body, err := os.ReadFile(elasticStackProfile.FetchPath(profile.KibanaConfigDefaultFile)) if err != nil { return "", errors.Wrap(err, "error reading Kibana config file") } From 99af25704b6d5ad5d2acafe4bb763f020e15392f Mon Sep 17 00:00:00 2001 From: mtojek Date: Tue, 26 Oct 2021 14:34:16 +0200 Subject: [PATCH 08/13] Another fix --- internal/profile/files.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/profile/files.go b/internal/profile/files.go index 18c0f19ccb..9a4dc445d9 100644 --- a/internal/profile/files.go +++ b/internal/profile/files.go @@ -26,6 +26,9 @@ const profileStackPath = "stack" // configFilesDiffer checks to see if a local configItem differs from the one it knows. func (cfg simpleFile) configFilesDiffer() (bool, error) { changes, err := os.ReadFile(cfg.path) + if err != nil && errors.Is(err, os.ErrNotExist) { + return false, nil + } if err != nil { return false, errors.Wrapf(err, "error reading %s", cfg.path) } From 8f2097676d4fc1465bf94353f1a004741e03c45b Mon Sep 17 00:00:00 2001 From: mtojek Date: Tue, 26 Oct 2021 14:50:31 +0200 Subject: [PATCH 09/13] Fix: wrong function --- internal/stack/compose.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/stack/compose.go b/internal/stack/compose.go index 10cab705a6..2d26510441 100644 --- a/internal/stack/compose.go +++ b/internal/stack/compose.go @@ -50,7 +50,7 @@ func dockerComposeBuild(options Options) error { opts := compose.CommandOptions{ Env: newEnvBuilder(). withEnvs(appConfig.StackImageRefs(options.StackVersion).AsEnv()). - withEnv(selectStackVersion(options.StackVersion)). + withEnv(stackVariantAsEnv(options.StackVersion)). withEnvs(options.Profile.ComposeEnvVars()). build(), Services: withIsReadyServices(withDependentServices(options.Services)), @@ -76,7 +76,7 @@ func dockerComposePull(options Options) error { opts := compose.CommandOptions{ Env: newEnvBuilder(). withEnvs(appConfig.StackImageRefs(options.StackVersion).AsEnv()). - withEnv(selectStackVersion(options.StackVersion)). + withEnv(stackVariantAsEnv(options.StackVersion)). withEnvs(options.Profile.ComposeEnvVars()). build(), Services: withIsReadyServices(withDependentServices(options.Services)), @@ -107,7 +107,7 @@ func dockerComposeUp(options Options) error { opts := compose.CommandOptions{ Env: newEnvBuilder(). withEnvs(appConfig.StackImageRefs(options.StackVersion).AsEnv()). - withEnv(selectStackVersion(options.StackVersion)). + withEnv(stackVariantAsEnv(options.StackVersion)). withEnvs(options.Profile.ComposeEnvVars()). build(), ExtraArgs: args, @@ -134,7 +134,7 @@ func dockerComposeDown(options Options) error { downOptions := compose.CommandOptions{ Env: newEnvBuilder(). withEnvs(appConfig.StackImageRefs(options.StackVersion).AsEnv()). - withEnv(selectStackVersion(options.StackVersion)). + withEnv(stackVariantAsEnv(options.StackVersion)). withEnvs(options.Profile.ComposeEnvVars()). build(), // Remove associated volumes. From 6c6c64b2dda30a13cad556e4e19cea9412a06dc1 Mon Sep 17 00:00:00 2001 From: mtojek Date: Tue, 26 Oct 2021 14:56:49 +0200 Subject: [PATCH 10/13] Bug: makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1914a9b29b..9a2b89955f 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,7 @@ test-stack-command-lts: test-stack-command-8x: ./scripts/test-stack-command.sh 8.0.0-SNAPSHOT -test-stack-command: test-stack-command-715x test-stack-command-716x test-stack-command-8x +test-stack-command: test-stack-command-default test-stack-command-lts test-stack-command-8x test-check-packages: ./scripts/test-check-packages.sh From c0131aa6489d79005abd50b47f10c3089e2ae648 Mon Sep 17 00:00:00 2001 From: mtojek Date: Tue, 26 Oct 2021 15:42:18 +0200 Subject: [PATCH 11/13] Remove deprecated flags --- internal/profile/_static/kibana_config_8x.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/profile/_static/kibana_config_8x.yml b/internal/profile/_static/kibana_config_8x.yml index 8af5fbf052..912fe362f3 100644 --- a/internal/profile/_static/kibana_config_8x.yml +++ b/internal/profile/_static/kibana_config_8x.yml @@ -5,11 +5,11 @@ elasticsearch.hosts: [ "http://elasticsearch:9200" ] elasticsearch.username: elastic elasticsearch.password: changeme -xpack.monitoring.ui.container.elasticsearch.enabled: true +monitoring.ui.container.elasticsearch.enabled: true xpack.fleet.registryUrl: "http://package-registry:8080" xpack.fleet.agents.enabled: true -xpack.fleet.agents.elasticsearch.host: "http://elasticsearch:9200" +xpack.fleet.agents.elasticsearch.hosts: "http://elasticsearch:9200" xpack.fleet.agents.fleet_server.hosts: ["http://fleet-server:8220"] xpack.encryptedSavedObjects.encryptionKey: "12345678901234567890123456789012" From 16a21031170aa59c5b5ca639620a9f28c027ba37 Mon Sep 17 00:00:00 2001 From: mtojek Date: Tue, 26 Oct 2021 16:09:21 +0200 Subject: [PATCH 12/13] Use 7x instead of lts --- .ci/Jenkinsfile | 2 +- Makefile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index c159a3b44e..7799c672be 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -92,7 +92,7 @@ pipeline { script { parallel([ 'stack-command-default': generateTestCommandStage(command: 'test-stack-command-default', artifacts: ['build/elastic-stack-dump/stack/*/logs/*.log', 'build/elastic-stack-dump/stack/*/logs/fleet-server-internal/*']), - 'stack-command-lts': generateTestCommandStage(command: 'test-stack-command-lts', artifacts: ['build/elastic-stack-dump/stack/*/logs/*.log', 'build/elastic-stack-dump/stack/*/logs/fleet-server-internal/*']), + 'stack-command-7x': generateTestCommandStage(command: 'test-stack-command-7x', artifacts: ['build/elastic-stack-dump/stack/*/logs/*.log', 'build/elastic-stack-dump/stack/*/logs/fleet-server-internal/*']), 'stack-command-8x': generateTestCommandStage(command: 'test-stack-command-8x', artifacts: ['build/elastic-stack-dump/stack/*/logs/*.log', 'build/elastic-stack-dump/stack/*/logs/fleet-server-internal/*']), 'check-packages': generateTestCommandStage(command: 'test-check-packages', artifacts: ['build/test-results/*.xml', 'build/kubectl-dump.txt', 'build/elastic-stack-dump/check/logs/*.log', 'build/elastic-stack-dump/check/logs/fleet-server-internal/*'], junitArtifacts: true, publishCoverage: true), 'build-zip': generateTestCommandStage(command: 'test-build-zip', artifacts: ['build/elastic-stack-dump/build-zip/logs/*.log']), diff --git a/Makefile b/Makefile index 9a2b89955f..37ed821816 100644 --- a/Makefile +++ b/Makefile @@ -41,13 +41,13 @@ test-go-ci: test-stack-command-default: ./scripts/test-stack-command.sh -test-stack-command-lts: +test-stack-command-7x: ./scripts/test-stack-command.sh 7.16.0-SNAPSHOT test-stack-command-8x: ./scripts/test-stack-command.sh 8.0.0-SNAPSHOT -test-stack-command: test-stack-command-default test-stack-command-lts test-stack-command-8x +test-stack-command: test-stack-command-default test-stack-command-7x test-stack-command-8x test-check-packages: ./scripts/test-check-packages.sh From 6a56dd3f58316153ebdb9cade6d95d244855ea36 Mon Sep 17 00:00:00 2001 From: mtojek Date: Tue, 26 Oct 2021 16:19:45 +0200 Subject: [PATCH 13/13] Fix: xpack.fleet.agents.elasticsearch.hosts is array --- internal/profile/_static/kibana_config_8x.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/profile/_static/kibana_config_8x.yml b/internal/profile/_static/kibana_config_8x.yml index 912fe362f3..5d5a56188d 100644 --- a/internal/profile/_static/kibana_config_8x.yml +++ b/internal/profile/_static/kibana_config_8x.yml @@ -9,7 +9,7 @@ monitoring.ui.container.elasticsearch.enabled: true xpack.fleet.registryUrl: "http://package-registry:8080" xpack.fleet.agents.enabled: true -xpack.fleet.agents.elasticsearch.hosts: "http://elasticsearch:9200" +xpack.fleet.agents.elasticsearch.hosts: ["http://elasticsearch:9200"] xpack.fleet.agents.fleet_server.hosts: ["http://fleet-server:8220"] xpack.encryptedSavedObjects.encryptionKey: "12345678901234567890123456789012"