From 92467024857babdc49abeb1478054ecdf422c89a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20de=20la=20Pe=C3=B1a?= Date: Thu, 7 Jan 2021 05:29:54 +0100 Subject: [PATCH] fix: make docker namespace configurable (#560) (#562) * 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 # Conflicts: # cli/config/compose/services/elastic-agent/docker-compose.yml # cli/config/compose/services/metricbeat/docker-compose.yml --- .../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 9de66ce2ac..46f004293f 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/beats/elastic-agent${elasticAgentDockerImageSuffix}:${elasticAgentTag:-7.10-SNAPSHOT} + image: docker.elastic.co/${elasticAgentDockerNamespace:-beats}/elastic-agent${elasticAgentDockerImageSuffix}:${elasticAgentTag:-7.10-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 f69f713921..adc04cadfd 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/beats/metricbeat:${metricbeatTag:-7.10-SNAPSHOT}" + image: "docker.elastic.co/${metricbeatDockerNamespace:-beats}/metricbeat:${metricbeatTag:-7.10-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://raw.githubusercontent.com/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 685a2090bd..dcbcfe33a4 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{