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

fix: apply container name to elastic-agent Docker services #1336

Merged
merged 2 commits into from
Jul 20, 2021

Conversation

mdelapenya
Copy link
Contributor

What does this PR do?

This PR avoids overridding the container_name of the elastic-agent service in a Docker Compose file, which avoids not needed calculations.

Why is it important?

I found an error while running the tests against a local version of the stack, and after debugging, found that if the DEV_MODE is enabled (services are not destroyed) the local Docker daemon is not able to recreate the containers properly.

I've not found an open issue related to this in the Compose repo, but I upgraded my local Docker engine very recently.

$ docker --version
Docker version 20.10.7, build f0df350

$ docker-compose --version
Docker Compose version v2.0.0-beta.6

I could have downgraded my local version and have tested again, but I consider this change (delegating the container name to Docker) should cover this use case.

On the other hand, when running the tests in DEVELOPER_MODE=true, I noticed Docker is not able to recreate containers properly. To reproduce it:

  1. Run TAGS="fleet_mode_agent && revoke-token && debian" TIMEOUT_FACTOR=5 LOG_LEVEL=TRACE DEVELOPER_MODE=true ELASTIC_APM_ACTIVE=false make -C e2e/_suites/fleet functional-test
  2. Run same command again: TAGS="fleet_mode_agent && revoke-token && debian" TIMEOUT_FACTOR=5 LOG_LEVEL=TRACE DEVELOPER_MODE=true ELASTIC_APM_ACTIVE=false make -C e2e/_suites/fleet functional-test

Because the services are not stopped, the second execution should fail with:

could not run compose file: [/Users/mdelapenya/.op/compose/profiles/fleet/docker-compose.yml /Users/mdelapenya/.op/compose/services/elastic-agent/debian/docker-compose.yml] - Local Docker compose exited abnormally whilst running docker-compose: [up -d]. exit status 2

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have run the Unit tests (make unit-test), and they are passing locally
  • I have run the End-2-End tests for the suite I'm working on, and they are passing locally
  • I have noticed new Go dependencies (run make notice in the proper directory)

Author's Checklist

  • [ ]

How to test this PR locally

Important: disable DEVELOPER_MODE!!!

TAGS="fleet_mode_agent && revoke-token"   TIMEOUT_FACTOR=5    LOG_LEVEL=TRACE    DEVELOPER_MODE=false    ELASTIC_APM_ACTIVE=false make -C e2e/_suites/fleet functional-test

Related issues

@mdelapenya mdelapenya self-assigned this Jul 20, 2021
@mdelapenya mdelapenya requested a review from a team July 20, 2021 12:24
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2021-07-20T12:24:24.187+0000

  • Duration: 36 min 53 sec

  • Commit: 71cb5f1

Test stats 🧪

Test Results
Failed 0
Passed 229
Skipped 0
Total 229

Trends 🧪

Image of Build Times

Image of Tests

💚 Flaky test report

Tests succeeded.

Expand to view the summary

Test stats 🧪

Test Results
Failed 0
Passed 229
Skipped 0
Total 229

@mdelapenya mdelapenya marked this pull request as ready for review July 20, 2021 14:00
@mdelapenya mdelapenya merged commit 787b976 into elastic:master Jul 20, 2021
mergify bot pushed a commit that referenced this pull request Jul 20, 2021
* fix: apply container name to elastic-agent Docker services

* chore: do not override container name for elastic-agent

(cherry picked from commit 787b976)

# Conflicts:
#	cli/config/compose/services/elastic-agent/cloud/docker-compose.yml
#	cli/config/compose/services/elastic-agent/docker-compose.yml
mergify bot pushed a commit that referenced this pull request Jul 20, 2021
* fix: apply container name to elastic-agent Docker services

* chore: do not override container name for elastic-agent

(cherry picked from commit 787b976)

# Conflicts:
#	cli/config/compose/services/elastic-agent/cloud/docker-compose.yml
#	cli/config/compose/services/elastic-agent/docker-compose.yml
mergify bot pushed a commit that referenced this pull request Jul 20, 2021
* fix: apply container name to elastic-agent Docker services

* chore: do not override container name for elastic-agent

(cherry picked from commit 787b976)

# Conflicts:
#	cli/config/compose/services/elastic-agent/cloud/docker-compose.yml
#	cli/config/compose/services/elastic-agent/docker-compose.yml
mdelapenya added a commit that referenced this pull request Jul 20, 2021
…er services (#1337)

* fix: apply container name to elastic-agent Docker services (#1336)

* fix: apply container name to elastic-agent Docker services

* chore: do not override container name for elastic-agent

(cherry picked from commit 787b976)

# Conflicts:
#	cli/config/compose/services/elastic-agent/cloud/docker-compose.yml
#	cli/config/compose/services/elastic-agent/docker-compose.yml

* fix: resolve conflicts

Co-authored-by: Manuel de la Peña <mdelapenya@gmail.com>
mdelapenya added a commit that referenced this pull request Jul 20, 2021
…ocker services (#1339)

* fix: apply container name to elastic-agent Docker services (#1336)

* fix: apply container name to elastic-agent Docker services

* chore: do not override container name for elastic-agent

(cherry picked from commit 787b976)

# Conflicts:
#	cli/config/compose/services/elastic-agent/cloud/docker-compose.yml
#	cli/config/compose/services/elastic-agent/docker-compose.yml

* fix: resolve conflicts

Co-authored-by: Manuel de la Peña <mdelapenya@gmail.com>
mdelapenya added a commit that referenced this pull request Jul 20, 2021
…ocker services (#1338)

* fix: apply container name to elastic-agent Docker services (#1336)

* fix: apply container name to elastic-agent Docker services

* chore: do not override container name for elastic-agent

(cherry picked from commit 787b976)

# Conflicts:
#	cli/config/compose/services/elastic-agent/cloud/docker-compose.yml
#	cli/config/compose/services/elastic-agent/docker-compose.yml

* fix: resolve conflicts

Co-authored-by: Manuel de la Peña <mdelapenya@gmail.com>
@mdelapenya mdelapenya deleted the fix-container-names branch July 20, 2021 14:58
mdelapenya added a commit to mdelapenya/e2e-testing that referenced this pull request Jul 27, 2021
* master:
  chore: read elastic-agent logs using native OS' log manager (elastic#1368)
  Add kubernetes autodiscover scenario without autodiscover (elastic#1361)
  fix: expose fleet-server port (elastic#1348)
  chore: improve the automation for the stack version bump (elastic#1351)
  bump stack version 8.0.0-a6334483 (elastic#1350)
  bump stack version 8.0.0-1e9bea0f (elastic#1346)
  chore(ci): be more specific about the underlying ARM OS (elastic#1341)
  fix: apply container name to elastic-agent Docker services (elastic#1336)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants