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

Complete variant for the elastic agent is not generating the right binaries #27608

Closed
mdelapenya opened this issue Aug 26, 2021 · 8 comments · Fixed by #27621 or #28526
Closed

Complete variant for the elastic agent is not generating the right binaries #27608

mdelapenya opened this issue Aug 26, 2021 · 8 comments · Fixed by #27621 or #28526
Assignees
Labels
bug build-system Issue or change affecting Mage, Make, or build scripts. Team:Automation Label for the Observability productivity team Team:Elastic-Agent Label for the Agent team Team:obs-ds-hosted-services Label for the Observability Hosted Services team

Comments

@mdelapenya
Copy link
Contributor

mdelapenya commented Aug 26, 2021

When running mage package, the binaries generated by the elastic-agent are incorrect:

  • there are three variants: "default", ubi8 and complete.
  • the docker image for the ubi8 variant is properly generated under build/distributions
  • the docker image for the complete variant is generated under build/distributions, BUT overriding the default image.

I suspect that this has been caused by #27350 and #27052

Steps to reproduce

  1. Run cd x-pack/elastic-agent
  2. Run PLATFORMS="linux/amd64" mage package (Narrowing down the process to build only one platform)
  3. Wait for the process to finish... (10 min?)

Expected behaviour

Three docker image binaries are generated, one per variant (default, ubi8 and complete), being the complete one the heaviest in weight (contains node runtime plus libs).

$ ls -l x-pack/elastic-agent/build/distributions | grep docker
-rw-r--r--  1 mdelapenya  staff  244359238 26 Aug 13:51 elastic-agent-8.0.0-linux-amd64.docker.tar.gz
-rw-r--r--  1 mdelapenya  staff        175 26 Aug 13:51 elastic-agent-8.0.0-linux-amd64.docker.tar.gz.sha512
-rw-r--r--  1 mdelapenya  staff  614539725 26 Aug 13:55 elastic-agent-complete-8.0.0-linux-amd64.docker.tar.gz
-rw-r--r--  1 mdelapenya  staff        184 26 Aug 13:56 elastic-agent-complete-8.0.0-linux-amd64.docker.tar.gz.sha512
-rw-r--r--  1 mdelapenya  staff  163226167 26 Aug 13:50 elastic-agent-ubi8-8.0.0-linux-amd64.docker.tar.gz
-rw-r--r--  1 mdelapenya  staff        180 26 Aug 13:50 elastic-agent-ubi8-8.0.0-linux-amd64.docker.tar.gz.sha512

When you docker load the default image, the default image is loaded into the Docker engine:

$ docker load -i x-pack/elastic-agent/build/distributions/elastic-agent-8.0.0-linux-amd64.docker.tar.gz 
Loaded image: docker.elastic.co/beats/elastic-agent:8.0.0

Current behaviour

Two docker image binaries are generated, one per variant (default and ubi8, only).

$ ls -l x-pack/elastic-agent/build/distributions | grep docker
-rw-r--r--   1 mdelapenya  staff  608875722 26 Aug 12:57 elastic-agent-8.0.0-linux-amd64.docker.tar.gz
-rw-r--r--   1 mdelapenya  staff        175 26 Aug 12:58 elastic-agent-8.0.0-linux-amd64.docker.tar.gz.sha512
-rw-r--r--   1 mdelapenya  staff  163226167 26 Aug 12:56 elastic-agent-ubi8-8.0.0-linux-amd64.docker.tar.gz
-rw-r--r--   1 mdelapenya  staff        180 26 Aug 12:56 elastic-agent-ubi8-8.0.0-linux-amd64.docker.tar.gz.sha512

When you docker load the default image, the complete image is loaded into the Docker engine:

$ docker load -i x-pack/elastic-agent/build/distributions/elastic-agent-8.0.0-linux-amd64.docker.tar.gz 
Loaded image: docker.elastic.co/beats/elastic-agent-complete:8.0.0
@mdelapenya mdelapenya added bug Team:obs-ds-hosted-services Label for the Observability Hosted Services team Team:Automation Label for the Observability productivity team build-system Issue or change affecting Mage, Make, or build scripts. Team:Elastic-Agent Label for the Agent team labels Aug 26, 2021
@mdelapenya mdelapenya self-assigned this Aug 26, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/uptime (Team:Uptime)

@elasticmachine
Copy link
Collaborator

Pinging @elastic/agent (Team:Agent)

@mdelapenya
Copy link
Contributor Author

I'm currently sending a fix, as I reproduced and fixed it locally

@mdelapenya
Copy link
Contributor Author

What surprises me even more is that the unified release process does contain the three artifacts: https://artifacts-api.elastic.co/v1/search/8.0.0-SNAPSHOT/elastic-agent?x-elastic-no-kpi=true

If you wget the elastic-agent default image, and then docker.load it, then you'll have the default image loaded in your Docker engine. cc/ @elastic/observablt-robots

@andrewvc
Copy link
Contributor

Hmmm, running mage package on my machine I get images that look correct in terms of sizes. This issue looks to be about the tar.gz files which I did not test. I'll look into that next

docker.elastic.co/beats/elastic-agent-complete   8.0.0                     4cb35ae0f32a   About an hour ago   1.55GB
docker.elastic.co/beats/elastic-agent-ubi8       8.0.0                     92579b6d4741   About an hour ago   298MB
docker.elastic.co/beats/elastic-agent            8.0.0                     748b00424478   About an hour ago   522MB

@mdelapenya
Copy link
Contributor Author

Yep, docker images seem correct. I found the issue in the tar.gz representation of the docker images.

andrewvc added a commit to andrewvc/beats that referenced this issue Aug 27, 2021
This interpolates the `variant` into the format string for .tar.gz
docker artifacts. In also correctly handles the case where the format
string is used in contexts without variant present, such as darwin. We
still need an empty value for the templating language not to error.

Fixes elastic#27608
@andrewvc
Copy link
Contributor

@mdelapenya see my fix here: #27621 , I'd appreciate a review if possible. It works locally!

@justinkambic
Copy link
Contributor

Post FF testing LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug build-system Issue or change affecting Mage, Make, or build scripts. Team:Automation Label for the Observability productivity team Team:Elastic-Agent Label for the Agent team Team:obs-ds-hosted-services Label for the Observability Hosted Services team
Projects
None yet
4 participants