From 8de026ba3e469c081c33392e4457c747ef8dabb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20de=20la=20Pe=C3=B1a?= Date: Wed, 6 Jan 2021 19:18:45 +0100 Subject: [PATCH] fix: make docker namespace configurable (#560) * fix: use observability-ci namespace in snapshots * fix: forgot to update compose file for the agent * fix: apply CI snapshots namespace to metricbeat too * fix: wrong copy paste --- .../compose/services/elastic-agent/docker-compose.yml | 2 +- cli/config/compose/services/metricbeat/docker-compose.yml | 2 +- e2e/_suites/fleet/stand-alone.go | 7 +++++++ e2e/_suites/metricbeat/metricbeat_test.go | 6 ++++++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/cli/config/compose/services/elastic-agent/docker-compose.yml b/cli/config/compose/services/elastic-agent/docker-compose.yml index f032a9a59a..3adeffe94f 100644 --- a/cli/config/compose/services/elastic-agent/docker-compose.yml +++ b/cli/config/compose/services/elastic-agent/docker-compose.yml @@ -1,7 +1,7 @@ version: '2.3' services: elastic-agent: - image: docker.elastic.co/observability-ci/elastic-agent${elasticAgentDockerImageSuffix}:${elasticAgentTag:-8.0.0-SNAPSHOT} + image: docker.elastic.co/${elasticAgentDockerNamespace:-beats}/elastic-agent${elasticAgentDockerImageSuffix}:${elasticAgentTag:-8.0.0-SNAPSHOT} container_name: ${elasticAgentContainerName} depends_on: elasticsearch: diff --git a/cli/config/compose/services/metricbeat/docker-compose.yml b/cli/config/compose/services/metricbeat/docker-compose.yml index 98a42a123d..1d8a3365c7 100644 --- a/cli/config/compose/services/metricbeat/docker-compose.yml +++ b/cli/config/compose/services/metricbeat/docker-compose.yml @@ -14,7 +14,7 @@ services: ] environment: - BEAT_STRICT_PERMS=${beatStricPerms:-false} - image: "docker.elastic.co/observability-ci/metricbeat:${metricbeatTag:-8.0.0-SNAPSHOT}" + image: "docker.elastic.co/${metricbeatDockerNamespace:-beats}/metricbeat:${metricbeatTag:-8.0.0-SNAPSHOT}" labels: co.elastic.logs/module: "${serviceName}" volumes: diff --git a/e2e/_suites/fleet/stand-alone.go b/e2e/_suites/fleet/stand-alone.go index 85b87d9aa4..6e02291849 100644 --- a/e2e/_suites/fleet/stand-alone.go +++ b/e2e/_suites/fleet/stand-alone.go @@ -14,6 +14,7 @@ import ( "github.com/cucumber/godog" "github.com/elastic/e2e-testing/cli/docker" "github.com/elastic/e2e-testing/cli/services" + "github.com/elastic/e2e-testing/cli/shell" "github.com/elastic/e2e-testing/e2e" log "github.com/sirupsen/logrus" ) @@ -69,6 +70,12 @@ func (sats *StandAloneTestSuite) aStandaloneAgentIsDeployed(image string) error profileEnv["elasticAgentDockerImageSuffix"] = "-" + image } + profileEnv["elasticAgentDockerNamespace"] = "beats" + useCISnapshots, _ := shell.GetEnvBool("ELASTIC_AGENT_USE_CI_SNAPSHOTS") + if useCISnapshots { + profileEnv["elasticAgentDockerNamespace"] = "observability-ci" + } + containerName := fmt.Sprintf("%s_%s_%d", FleetProfileName, ElasticAgentServiceName, 1) configurationFileURL := "https://github.com/raw/elastic/beats/master/x-pack/elastic-agent/elastic-agent.docker.yml" diff --git a/e2e/_suites/metricbeat/metricbeat_test.go b/e2e/_suites/metricbeat/metricbeat_test.go index cac73bec44..4c1742c6f4 100644 --- a/e2e/_suites/metricbeat/metricbeat_test.go +++ b/e2e/_suites/metricbeat/metricbeat_test.go @@ -304,6 +304,12 @@ func (mts *MetricbeatTestSuite) runMetricbeatService() error { "serviceName": mts.ServiceName, } + env["metricbeatDockerNamespace"] = "beats" + useCISnapshots, _ := shell.GetEnvBool("ELASTIC_AGENT_USE_CI_SNAPSHOTS") + if useCISnapshots { + env["metricbeatDockerNamespace"] = "observability-ci" + } + err := serviceManager.AddServicesToCompose("metricbeat", []string{"metricbeat"}, env) if err != nil { log.WithFields(log.Fields{