diff --git a/.buildkite/pipeline.trigger.integration.tests.sh b/.buildkite/pipeline.trigger.integration.tests.sh index cacf672dc..9eddf754f 100755 --- a/.buildkite/pipeline.trigger.integration.tests.sh +++ b/.buildkite/pipeline.trigger.integration.tests.sh @@ -20,6 +20,7 @@ STACK_COMMAND_TESTS=( test-stack-command-7x test-stack-command-86 test-stack-command-8x + test-stack-command-9x test-stack-command-with-apm-server ) diff --git a/.buildkite/scripts/stack_tests_windows.ps1 b/.buildkite/scripts/stack_tests_windows.ps1 index 1062e7a7e..2ecbcbf5f 100644 --- a/.buildkite/scripts/stack_tests_windows.ps1 +++ b/.buildkite/scripts/stack_tests_windows.ps1 @@ -45,7 +45,7 @@ fixCRLF withGolang $env:GO_VERSION withDocker $env:DOCKER_VERSION -withDockerCompose $env:DOCKER_COMPOSE_VERSION +withDockerCompose $env:DOCKER_COMPOSE_VERSION.Substring(1) Write-Host "--- Docker Info" docker info diff --git a/.github/workflows/updatecli/updatecli.d/bump-latest-snapshot-version.yml b/.github/workflows/updatecli/updatecli.d/bump-latest-8x-snapshot-version.yml similarity index 90% rename from .github/workflows/updatecli/updatecli.d/bump-latest-snapshot-version.yml rename to .github/workflows/updatecli/updatecli.d/bump-latest-8x-snapshot-version.yml index 3f2994139..e947836b3 100644 --- a/.github/workflows/updatecli/updatecli.d/bump-latest-snapshot-version.yml +++ b/.github/workflows/updatecli/updatecli.d/bump-latest-8x-snapshot-version.yml @@ -1,6 +1,6 @@ --- -name: Bump latest elastic-stack test version -pipelineid: 'bump-latest-elastic-stack-version' +name: Bump latest 8.x-SNAPSHOT elastic-stack test version +pipelineid: 'bump-latest-8x-elastic-stack-version' actions: default: diff --git a/.github/workflows/updatecli/updatecli.d/bump-latest-9x-snapshot-version.yml b/.github/workflows/updatecli/updatecli.d/bump-latest-9x-snapshot-version.yml new file mode 100644 index 000000000..fe1313bde --- /dev/null +++ b/.github/workflows/updatecli/updatecli.d/bump-latest-9x-snapshot-version.yml @@ -0,0 +1,44 @@ +--- +name: Bump latest 9.x-SNAPSHOT elastic-stack test version +pipelineid: 'bump-latest-9x-elastic-stack-version' + +actions: + default: + title: '[updatecli] Update latest snapshot to {{ source "latestSnapshot" }}' + kind: github/pullrequest + scmid: default + spec: + labels: + - automation + - dependency + +scms: + default: + kind: github + spec: + owner: '{{ .scm.owner }}' + repository: '{{ .scm.repository }}' + user: '{{ requiredEnv "GITHUB_ACTOR" }}' + username: '{{ requiredEnv "GITHUB_ACTOR" }}' + token: '{{ requiredEnv "GITHUB_TOKEN" }}' + commitusingapi: true + branch: main + +sources: + latestSnapshot: + name: Get latest snapshot build + kind: json + spec: + file: https://storage.googleapis.com/artifacts-api/snapshots/main.json + key: .build_id + +targets: + update-snapshot: + name: '[updatecli] Update latest snapshot to {{ source "latestSnapshot" }}' + kind: file + sourceid: latestSnapshot + scmid: default + spec: + file: Makefile + matchpattern: '(./scripts/test-stack-command.sh) 9\.[^\s]+-SNAPSHOT' + replacepattern: '$1 {{ source "latestSnapshot" }}-SNAPSHOT' diff --git a/Makefile b/Makefile index 6e156b63a..0cfb23099 100644 --- a/Makefile +++ b/Makefile @@ -75,13 +75,16 @@ test-stack-command-86: test-stack-command-8x: ./scripts/test-stack-command.sh 8.16.0-5f5fcfdc-SNAPSHOT +test-stack-command-9x: + ./scripts/test-stack-command.sh 9.0.0-SNAPSHOT + test-stack-command-with-apm-server: APM_SERVER_ENABLED=true ./scripts/test-stack-command.sh test-stack-command-with-self-monitor: SELF_MONITOR_ENABLED=true ./scripts/test-stack-command.sh -test-stack-command: test-stack-command-default test-stack-command-7x test-stack-command-800 test-stack-command-8x test-stack-command-with-apm-server +test-stack-command: test-stack-command-default test-stack-command-7x test-stack-command-800 test-stack-command-8x test-stack-command-9x test-stack-command-with-apm-server test-check-packages: test-check-packages-with-kind test-check-packages-other test-check-packages-parallel test-check-packages-with-custom-agent test-check-packages-benchmarks test-check-packages-false-positives test-check-packages-with-logstash diff --git a/internal/install/application_configuration.go b/internal/install/application_configuration.go index f2e76434e..61934b4bf 100644 --- a/internal/install/application_configuration.go +++ b/internal/install/application_configuration.go @@ -153,13 +153,13 @@ func (ac *ApplicationConfiguration) SetCurrentProfile(name string) { // This is mandatory as "elastic-agent-complete" is available since 7.15.0-SNAPSHOT. func selectElasticAgentImageName(version, agentBaseImage string) string { if version == "" { // as version is optional and can be empty - return elasticAgentLegacyImageName + return elasticAgentWolfiImageName } v, err := semver.NewVersion(version) if err != nil { - logger.Errorf("stack version not in semver format (value: %s): %v", v, err) - return elasticAgentLegacyImageName + logger.Errorf("stack version not in semver format (value: %s): %v", version, err) + return elasticAgentWolfiImageName } disableWolfiImages := false diff --git a/internal/install/application_configuration_test.go b/internal/install/application_configuration_test.go index 20320a58c..4e257608e 100644 --- a/internal/install/application_configuration_test.go +++ b/internal/install/application_configuration_test.go @@ -14,43 +14,43 @@ import ( func TestSelectElasticAgentImageName_NoVersion(t *testing.T) { var version string selected := selectElasticAgentImageName(version, "") - assert.Equal(t, selected, elasticAgentLegacyImageName) + assert.Equal(t, elasticAgentWolfiImageName, selected) } func TestSelectElasticAgentImageName_OlderStack(t *testing.T) { version := "7.14.99-SNAPSHOT" selected := selectElasticAgentImageName(version, "") - assert.Equal(t, selected, elasticAgentLegacyImageName) + assert.Equal(t, elasticAgentLegacyImageName, selected) } func TestSelectElasticAgentImageName_FirstStackWithCompleteAgent(t *testing.T) { version := stackVersion715 selected := selectElasticAgentImageName(version, "") - assert.Equal(t, selected, elasticAgentCompleteLegacyImageName) + assert.Equal(t, elasticAgentCompleteLegacyImageName, selected) } func TestSelectElasticAgentImageName_NextStackWithAgentComplete(t *testing.T) { version := "7.16.0-SNAPSHOT" selected := selectElasticAgentImageName(version, "") - assert.Equal(t, selected, elasticAgentCompleteLegacyImageName) + assert.Equal(t, elasticAgentCompleteLegacyImageName, selected) } func TestSelectElasticAgentImageName_OwnNamespace(t *testing.T) { version := "8.2.0-SNAPSHOT" selected := selectElasticAgentImageName(version, "") - assert.Equal(t, selected, elasticAgentCompleteImageName) + assert.Equal(t, elasticAgentCompleteImageName, selected) } func TestSelectElasticAgentImageName_OwnNamespace_Release(t *testing.T) { version := "8.2.0" selected := selectElasticAgentImageName(version, "") - assert.Equal(t, selected, elasticAgentCompleteImageName) + assert.Equal(t, elasticAgentCompleteImageName, selected) } func TestSelectElasticAgentImageName_NextStackInOwnNamespace(t *testing.T) { version := "8.4.0-SNAPSHOT" selected := selectElasticAgentImageName(version, "") - assert.Equal(t, selected, elasticAgentCompleteImageName) + assert.Equal(t, elasticAgentCompleteImageName, selected) } func TestSelectElasticAgentImageName_DefaultImage816_WithoutEnvVar(t *testing.T) { @@ -60,56 +60,56 @@ func TestSelectElasticAgentImageName_DefaultImage816_WithoutEnvVar(t *testing.T) os.Unsetenv(disableElasticAgentWolfiEnvVar) selected := selectElasticAgentImageName(version, "") - assert.Equal(t, selected, elasticAgentWolfiImageName) + assert.Equal(t, elasticAgentWolfiImageName, selected) } func TestSelectElasticAgentImageName_DisableWolfiImageEnvVar(t *testing.T) { version := stackVersion8160 t.Setenv(disableElasticAgentWolfiEnvVar, "true") selected := selectElasticAgentImageName(version, "") - assert.Equal(t, selected, elasticAgentCompleteImageName) + assert.Equal(t, elasticAgentCompleteImageName, selected) } func TestSelectElasticAgentImageName_EnableWolfiImageEnvVar(t *testing.T) { version := stackVersion8160 t.Setenv(disableElasticAgentWolfiEnvVar, "false") selected := selectElasticAgentImageName(version, "") - assert.Equal(t, selected, elasticAgentWolfiImageName) + assert.Equal(t, elasticAgentWolfiImageName, selected) } func TestSelectCompleteElasticAgentImageName_ForceCompleteImage(t *testing.T) { version := stackVersion8160 selected := selectElasticAgentImageName(version, "complete") - assert.Equal(t, selected, elasticAgentCompleteImageName) + assert.Equal(t, elasticAgentCompleteImageName, selected) } func TestSelectCompleteElasticAgentImageName_ForceDefaultImage_DisabledEnvVar(t *testing.T) { version := stackVersion8160 t.Setenv(disableElasticAgentWolfiEnvVar, "true") selected := selectElasticAgentImageName(version, "default") - assert.Equal(t, selected, elasticAgentCompleteImageName) + assert.Equal(t, elasticAgentCompleteImageName, selected) } func TestSelectCompleteElasticAgentImageName_ForceDefaultImage_EnabledEnvVar(t *testing.T) { version := stackVersion8160 t.Setenv(disableElasticAgentWolfiEnvVar, "false") selected := selectElasticAgentImageName(version, "default") - assert.Equal(t, selected, elasticAgentWolfiImageName) + assert.Equal(t, elasticAgentWolfiImageName, selected) } func TestSelectCompleteElasticAgentImageName_ForceDefaultImageOldStack(t *testing.T) { version := "8.15.0-SNAPSHOT" selected := selectElasticAgentImageName(version, "default") - assert.Equal(t, selected, elasticAgentCompleteImageName) + assert.Equal(t, elasticAgentCompleteImageName, selected) } func TestSelectCompleteElasticAgentImageName_ForceSystemDImage(t *testing.T) { version := stackVersion8160 selected := selectElasticAgentImageName(version, "systemd") - assert.Equal(t, selected, elasticAgentImageName) + assert.Equal(t, elasticAgentImageName, selected) } func TestSelectCompleteElasticAgentImageName_ForceSystemDImageOldStack(t *testing.T) { version := stackVersion715 selected := selectElasticAgentImageName(version, "systemd") - assert.Equal(t, selected, elasticAgentLegacyImageName) + assert.Equal(t, elasticAgentLegacyImageName, selected) }