-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
fix: use declarative style for complete variant of the elastic-agent #28526
fix: use declarative style for complete variant of the elastic-agent #28526
Conversation
…ge (elastic#27621)" This reverts commit 89e415d.
…lastic#27399)" This reverts commit 954a250.
As we prefer using the declarative way over the programmatic way, we do not need the variable. Instead, we'll use the YAML file for declaring the new variants
This pull request does not have a backport label. Could you fix it @mdelapenya? 🙏
NOTE: |
@@ -37,9 +37,6 @@ RUN readlink -f {{ $beatBinary }} | xargs setcap {{ .linux_capabilities }} | |||
|
|||
FROM {{ .from }} | |||
|
|||
# Contains the elastic agent image variant, an empty string for the standard variant | |||
# or "complete" for the bigger one. | |||
ENV ELASTIC_AGENT_IMAGE_VARIANT={{.Variant}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we still need this environment variable for the complete
variant, we can enclose it in an if/else block:
{{- if (and (contains .image_name "-complete")) }}
ENV ELASTIC_AGENT_IMAGE_VARIANT=complete
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #27052 (comment)
I wonder if adding a metadata could be an option, though the docker tag contains that value anywawy.
I was not able to find any references for ELASTIC_AGENT_IMAGE_VARIANT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
description="{{ .BeatDescription }}" |
maybe?
image_name: {{ .image_name }}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that labels or metadata would be better to consider
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, my comment was just a comment, so therefore it's not blocking and I don't see any reasons why ELASTIC_AGENT_IMAGE_VARIANT
should be kept
cc @andrewvc , can you please help to understand if removing is harmless?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's currently unused, so can be deleted.
Pinging @elastic/uptime (Team:Uptime) |
Pinging @elastic/elastic-agent (Team:Elastic-Agent) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
neat!!!
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
💚 Flaky test reportTests succeeded. 🤖 GitHub commentsTo re-run your PR in the CI, just comment with:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good 👍
@@ -48,7 +48,7 @@ const ( | |||
packageStagingDir = "build/package" | |||
|
|||
// defaultBinaryName specifies the output file for zip and tar.gz. | |||
defaultBinaryName = "{{.Name}}-{{if .Variant}}{{.Variant}}-{{end}}{{.Version}}{{if .Snapshot}}-SNAPSHOT{{end}}{{if .OS}}-{{.OS}}{{end}}{{if .Arch}}-{{.Arch}}{{end}}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be represented in the packages.yml
definition? If this is needed, maybe output_file
(used here) can be set in agent_docker_complete_spec
.
(I see output_file
is not defined anywhere, maybe you find surprises if you try to use it 😬)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about it, this line is part of the revert of the initial commits. Maybe @andrewvc can help us out here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Jaime Soriano Pastor <[email protected]>
…28526) * Revert "[elastic-agent] Fix docker tar.gz generation for complete image (#27621)" This reverts commit 89e415d. * Revert "[elastic-agent] Use -complete in docker image name, not tag (#27399)" This reverts commit 954a250. * chore: use declarative variant for complete * fix: pass agent dockerfile to complete spec * fix: do not append variant to the artifact name * docs: update reference to complete variant * chore: remove unused param * chore: remove Variants from PacakgeSpec struct As we prefer using the declarative way over the programmatic way, we do not need the variable. Instead, we'll use the YAML file for declaring the new variants * fix: align comment Co-authored-by: Jaime Soriano Pastor <[email protected]> Co-authored-by: Jaime Soriano Pastor <[email protected]> (cherry picked from commit 554399a) # Conflicts: # dev-tools/packaging/packages.yml # dev-tools/packaging/templates/docker/Dockerfile.elastic-agent.tmpl
…28526) * Revert "[elastic-agent] Fix docker tar.gz generation for complete image (#27621)" This reverts commit 89e415d. * Revert "[elastic-agent] Use -complete in docker image name, not tag (#27399)" This reverts commit 954a250. * chore: use declarative variant for complete * fix: pass agent dockerfile to complete spec * fix: do not append variant to the artifact name * docs: update reference to complete variant * chore: remove unused param * chore: remove Variants from PacakgeSpec struct As we prefer using the declarative way over the programmatic way, we do not need the variable. Instead, we'll use the YAML file for declaring the new variants * fix: align comment Co-authored-by: Jaime Soriano Pastor <[email protected]> Co-authored-by: Jaime Soriano Pastor <[email protected]> (cherry picked from commit 554399a) # Conflicts: # dev-tools/packaging/packages.yml
…urnalbeat-ci * upstream/master: (49 commits) [CI]: use the downstream packaging pipeline for branches/tags (elastic#28589) fix: use declarative style for complete variant of the elastic-agent (elastic#28526) x-pack/auditbeat/tracing: fix regexp for kprobe description line (elastic#28609) docs: Update `api_key` example on elasticsearch output (elastic#28606) chore: add build scripts to CODEOWNERS (elastic#28615) Osquerybeat: Fix host_processes missing cmdline arguments (elastic#28622) Add note about changes to regexp package in Golang (elastic#28616) CI: nightly/weekly builds for 7.x targeting 7.16 instead (elastic#28612) Osquerybeat: Fix extenstion unable to start on windows (elastic#28598) Osquerybeat: Return the query result count with the action response (elastic#28576) Agent: Allow custom response properties in the action response (elastic#28575) [Heartbeat] Only setuid in elastic-agent image (elastic#28577) Fix formatting of `mapStateJSON` and `layerListJSON` in dashboard assets (elastic#28530) CI: refactor the run e2e build (elastic#28502) Use fsnotify with long windows name-safe changes (elastic#28517) Remove unneeded mergify config backport: Add 7.16 branch (elastic#28560) Add proxy_url support to threatintel module's malwarebazaar fileset (elastic#28533) Osquerybeat: Implement host_users, host_groups, host_processes tables as a part of our osquery_extension. (elastic#28434) [Heartbeat] Make run_once syntax a boolean (elastic#28548) ...
…lastic#28526) * Revert "[elastic-agent] Fix docker tar.gz generation for complete image (elastic#27621)" This reverts commit 89e415d. * Revert "[elastic-agent] Use -complete in docker image name, not tag (elastic#27399)" This reverts commit 954a250. * chore: use declarative variant for complete * fix: pass agent dockerfile to complete spec * fix: do not append variant to the artifact name * docs: update reference to complete variant * chore: remove unused param * chore: remove Variants from PacakgeSpec struct As we prefer using the declarative way over the programmatic way, we do not need the variable. Instead, we'll use the YAML file for declaring the new variants * fix: align comment Co-authored-by: Jaime Soriano Pastor <[email protected]> Co-authored-by: Jaime Soriano Pastor <[email protected]>
…nt of the elastic-agent (#28635) * fix: use declarative style for complete variant of the elastic-agent (#28526) * Revert "[elastic-agent] Fix docker tar.gz generation for complete image (#27621)" This reverts commit 89e415d. * Revert "[elastic-agent] Use -complete in docker image name, not tag (#27399)" This reverts commit 954a250. * chore: use declarative variant for complete * fix: pass agent dockerfile to complete spec * fix: do not append variant to the artifact name * docs: update reference to complete variant * chore: remove unused param * chore: remove Variants from PacakgeSpec struct As we prefer using the declarative way over the programmatic way, we do not need the variable. Instead, we'll use the YAML file for declaring the new variants * fix: align comment Co-authored-by: Jaime Soriano Pastor <[email protected]> Co-authored-by: Jaime Soriano Pastor <[email protected]> (cherry picked from commit 554399a) # Conflicts: # dev-tools/packaging/packages.yml * fix: resolve conflicts in packages.yml file Co-authored-by: Manuel de la Peña <[email protected]>
What does this PR do?
This PR does a few things:
packages.yml
descriptor file. AS we already had anubi8
variant, and we recently added acloud
one, adding acomplete
variant means replicating the building blocks to form the Docker image.Why is it important?
We realised that CI builds were generating incorrect binaries for the agent, as the elastic-agent docker image (TAR.GZ binary) was pushed to the internal GCP bucket only once, as described in #27608. Then, any consumer of those binaries was always receiving a +500MB file when downloading it from the bucket. An example of a consumer is the e2e-testing framework, which gets a binary for a merge commit or a PR in Beats project, and runs the E2E tests against those non-released delta binaries. We noticed the download times for the default artifact increased up to the double, also missing the complete TAR.GZ binary in the GCP bucket.
With this fix we expect the CI artifacts, which are super useful for bisecting errors, will be generated properly again.
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Author's Checklist
How to test this PR locally
After a while:
Related issues