Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

fix: support selecting the platform in docker-compose #751

Merged
merged 5 commits into from
Feb 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cli/cmd/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ func sanitizeComposeFile(composeFilePath string, targetFilePath string) error {
return err
}

// sets version to 2.4 for testing purpose
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not testing anymore?

Suggested change
// sets version to 2.4 for testing purpose

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I mean testing the execution of the tests. I added there to explain why we are setting that version there. Maybe it's not clear enough and it could be deleted

c.Version = "2.4"

for k, srv := range c.Services {
// we'll copy all fields but the excluded ones in this struct
output := make(map[string]service)
Expand Down
4 changes: 2 additions & 2 deletions cli/cmd/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestSanitizeComposeFile_Multiple(t *testing.T) {
err = yaml.Unmarshal(bytes, &c)
assert.Nil(t, err)

assert.Equal(t, c.Version, "2.3")
assert.Equal(t, c.Version, "2.4")
assert.Equal(t, len(c.Services), 2)

// we know that both services have different number of ports
Expand Down Expand Up @@ -77,6 +77,6 @@ func TestSanitizeComposeFile_Single(t *testing.T) {
err = yaml.Unmarshal(bytes, &c)
assert.Nil(t, err)

assert.Equal(t, c.Version, "2.3")
assert.Equal(t, c.Version, "2.4")
assert.Equal(t, len(c.Services), 1)
}
2 changes: 1 addition & 1 deletion cli/config/compose/profiles/fleet/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2.3'
version: '2.4'
services:
elasticsearch:
healthcheck:
Expand Down
2 changes: 1 addition & 1 deletion cli/config/compose/profiles/metricbeat/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2.3'
version: '2.4'
services:
elasticsearch:
environment:
Expand Down
2 changes: 1 addition & 1 deletion cli/config/compose/services/apm-server/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2.3'
version: '2.4'
services:
apm-server:
environment:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2.3'
version: '2.4'
services:
centos-systemd:
image: centos/systemd:${centos_systemdTag:-latest}
Expand Down
2 changes: 1 addition & 1 deletion cli/config/compose/services/centos/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2.3'
version: '2.4'
services:
centos:
image: centos:${centosTag:-7}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2.3'
version: '2.4'
services:
debian-systemd:
image: alehaa/debian-systemd:${debian_systemdTag:-stretch}
Expand Down
2 changes: 1 addition & 1 deletion cli/config/compose/services/debian/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2.3'
version: '2.4'
services:
debian:
image: debian:${debianTag:-9}
Expand Down
3 changes: 2 additions & 1 deletion cli/config/compose/services/elastic-agent/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2.3'
version: '2.4'
services:
elastic-agent:
image: docker.elastic.co/${elasticAgentDockerNamespace:-beats}/elastic-agent${elasticAgentDockerImageSuffix}:${elasticAgentTag:-8.0.0-SNAPSHOT}
Expand All @@ -10,5 +10,6 @@ services:
condition: service_healthy
environment:
- "KIBANA_HOST=http://${kibanaHost:-kibana}:${kibanaPort:-5601}"
platform: ${elasticAgentPlatform:-linux/amd64}
volumes:
- "${elasticAgentConfigFile}:/usr/share/elastic-agent/elastic-agent.yml"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2.3'
version: '2.4'
services:
elasticsearch:
environment:
Expand Down
2 changes: 1 addition & 1 deletion cli/config/compose/services/kibana/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2.3'
version: '2.4'
services:
kibana:
environment:
Expand Down
3 changes: 2 additions & 1 deletion cli/config/compose/services/metricbeat/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2.3'
version: '2.4'
services:
metricbeat:
command: [
Expand All @@ -17,5 +17,6 @@ services:
image: "docker.elastic.co/${metricbeatDockerNamespace:-beats}/metricbeat:${metricbeatTag:-8.0.0-SNAPSHOT}"
labels:
co.elastic.logs/module: "${serviceName}"
platform: ${metricbeatPlatform:-linux/amd64}
volumes:
- "${metricbeatConfigFile}:/usr/share/metricbeat/metricbeat.yml"
2 changes: 1 addition & 1 deletion cli/config/compose/services/opbeans-go/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2.3'
version: '2.4'
services:
opbeans-go:
environment:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2.3'
version: '2.4'
services:
opbeans-java:
environment:
Expand Down
2 changes: 1 addition & 1 deletion cli/config/compose/services/vsphere/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version: '2.3'
version: '2.4'
services:
vsphere:
image: "nimmis/vcsim:${VSPHERE_VERSION}"
Expand Down
1 change: 1 addition & 0 deletions e2e/_suites/fleet/stand-alone.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ func (sats *StandAloneTestSuite) aStandaloneAgentIsDeployed(image string) error

profileEnv["elasticAgentContainerName"] = containerName
profileEnv["elasticAgentConfigFile"] = sats.AgentConfigFilePath
profileEnv["elasticAgentPlatform"] = "linux/amd64"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value will be eventually dynamic for ARM/AMD

profileEnv["elasticAgentTag"] = agentVersion

err = serviceManager.AddServicesToCompose(FleetProfileName, []string{ElasticAgentServiceName}, profileEnv)
Expand Down
1 change: 1 addition & 0 deletions e2e/_suites/metricbeat/metricbeat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ func (mts *MetricbeatTestSuite) runMetricbeatService() error {
}

env["metricbeatDockerNamespace"] = e2e.GetDockerNamespaceEnvVar()
env["metricbeatPlatform"] = "linux/amd64"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value will be eventually dynamic for ARM/AMD


err := serviceManager.AddServicesToCompose("metricbeat", []string{"metricbeat"}, env)
if err != nil {
Expand Down