Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle string ports in docker compose v2 config yaml #748

Merged
merged 4 commits into from
Mar 23, 2022

Conversation

jsoriano
Copy link
Member

@jsoriano jsoriano commented Mar 22, 2022

Using docker-compose v2.3.x (go implementation), elastic-package shellinit fails with:

Error: shellinit failed: could not get Docker Compose configuration for service: could not unmarshal YAML map node: yaml: unmarshal errors:
  line 4: cannot unmarshal !!str `9200` into int

This seems to happen because some ports are represented as strings in the docker-compose config output.

Support both versions by allowing ports to be integers or numbers.

@jsoriano jsoriano requested a review from a team March 22, 2022 17:03
@jsoriano jsoriano self-assigned this Mar 22, 2022
@elasticmachine
Copy link
Collaborator

elasticmachine commented Mar 22, 2022

💚 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: 2022-03-23T08:56:52.573+0000

  • Duration: 23 min 39 sec

Test stats 🧪

Test Results
Failed 0
Passed 618
Skipped 1
Total 619

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

Copy link
Contributor

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

Is this the moment, when we should use Compose V2 in general for CI testing?

internal/compose/compose.go Outdated Show resolved Hide resolved
@jsoriano
Copy link
Member Author

Is this the moment, when we should use Compose V2 in general for CI testing?

I think we are close, the main blocker I have found so far with v2 has been not being able to use elastic-package shellinit, what would be solved by this PR.
Apart of that, installation of packages during tests fail on my laptop, as if docker compose is not correctly recreating the package registry after packages are built. I would have to investigate this a bit more.

Something we might also investigate is to use the Go API 🙂, so we don't depend on the installed binary.

@jsoriano
Copy link
Member Author

/test

@jsoriano
Copy link
Member Author

jsoriano commented Mar 23, 2022

Actually this may be a bug in docker compose. This is the documented format:

    - mode: ingress
      target: 80
      published: 80
      protocol: tcp

This is what I am finding:

    - mode: ingress
      host_ip: 127.0.0.1
      target: 9200
      published: "9200"
      protocol: tcp

@jsoriano
Copy link
Member Author

Open issue in docker compose project: docker/compose#9306

@jsoriano jsoriano merged commit 867e842 into elastic:main Mar 23, 2022
@jsoriano jsoriano deleted the docker-compose-v2-config branch March 23, 2022 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants