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

[Elastic Agent] Pick up version from libbeat #18350

Merged
merged 7 commits into from
May 14, 2020

Conversation

michalpristas
Copy link
Contributor

@michalpristas michalpristas commented May 7, 2020

What does this PR do?

For historical reasons we were keeping track of our version ourselves which creates overhead for releases. Picking up version from libbeat keeps us in par with other beats we're releasing with

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 added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

@elasticmachine
Copy link
Collaborator

Pinging @elastic/ingest-management (Team:Ingest Management)

@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label May 7, 2020
go.sum Outdated
@@ -221,6 +221,7 @@ github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc=
github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
github.com/eclipse/paho.mqtt.golang v1.2.1-0.20200121105743-0d940dd29fd2 h1:DW6WrARxK5J+o8uAKCiACi5wy9EK1UzrsCpGBPsKHAA=
github.com/eclipse/paho.mqtt.golang v1.2.1-0.20200121105743-0d940dd29fd2/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts=
github.com/elastic/beats v7.6.2+incompatible h1:jHdLv83KURaqWUC6f55iMyVP6LYZrgElfeqxKWcskVE=
Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops

@elasticmachine
Copy link
Collaborator

elasticmachine commented May 7, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

Copy link
Contributor

@blakerouse blakerouse left a comment

Choose a reason for hiding this comment

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

Code looks good.

I am curious why it's rather different than all the other beats, at least from what I can tell. Seems that the other beats get this with libbeat/cmd.GenVersionCmd, could we just change to using that instead for consistency.

@michalpristas
Copy link
Contributor Author

michalpristas commented May 7, 2020

we started out in a separate repo without libbeat so we implemented everything from scratch without dependencies we dont need. even this small version command instantiates a beat Instance,something agent does not use.

@ph
Copy link
Contributor

ph commented May 8, 2020

@blakerouse We have instead started out outside of beats and we wanted minimal dependencies on libbeat, after a few iterations maybe this was not the best decision because. We should try to converge on beats on behavior. Its something we should discuss moving forward.

One thing that might also happens is us to move to a separate repository.

fmt.Sprintf(`-X "github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/release.buildTime=%s"`, ts),
fmt.Sprintf(`-X "github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/release.commit=%s"`, commitID),
fmt.Sprintf(`-X "github.com/elastic/beats/v7/libbeat/version.buildTime=%s"`, ts),
fmt.Sprintf(`-X "github.com/elastic/beats/v7/libbeat/version.commit=%s"`, commitID),
fmt.Sprintf(` -X "github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/release.snapshot=%s"`, isSnapshot),
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really need this now? I would assume this would be handled by the libbeat part?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you're right i will try it to make sure

@ph ph added [zube]: In Review review and removed needs_team Indicates that the issue/PR needs a Team:* label labels May 8, 2020
@michalpristas
Copy link
Contributor Author

brought even with libbeat which removed the ability to override version using dev subcommand, i dont think we need that anymore with restrictions from kibana removed

@ph
Copy link
Contributor

ph commented May 11, 2020

@michalpristas I think this breaks the packaging?

Error: running "go build -o build/golang-crossbuild/elastic-agent-linux-arm64 -ldflags -s "github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/release.snapshot=false" -X github.com/elastic/beats/v7/libbeat/version.buildTime=2020-05-11T15:37:12Z -X github.com/elastic/beats/v7/libbeat/version.commit=3bcfa2a9984ad75e39a169e0f1d929a2b7f17c6c" failed with exit code 2
Error: failed building for linux/arm64: exit status 2
failed building for linux/arm64: exit status 2
# github.com/elastic/beats/v7/x-pack/elastic-agent
usage: link [options] main.o
  -B note
    	add an ELF NT_GNU_BUILD_ID note when using ELF
  -E entry
    	set entry symbol name
  -H type
    	set header type
  -I linker
    	use linker as ELF dynamic linker
  -L directory
    	add specified directory to library path
  -R quantum
    	set address rounding quantum (default -1)
  -T address
    	set text segment address (default -1)
  -V	print version and exit
  -X definition
    	add string value definition of the form importpath.name=value
  -a	disassemble output
  -buildid id
    	record id as Go toolchain build id
  -buildmode mode
    	set build mode
  -c	dump call graph
  -compressdwarf
    	compress DWARF if possible (default true)
  -cpuprofile file
    	write cpu profile to file
  -d	disable dynamic executable
  -debugtramp int
    	debug trampolines
  -dumpdep
    	dump symbol dependency graph
  -extar string
    	archive program for buildmode=c-archive
  -extld linker
    	use linker when linking in external mode
  -extldflags flags
    	pass flags to external linker
  -f	ignore version mismatch
  -g	disable go package data checks
  -h	halt on error
  -importcfg file
    	read import configuration from file
  -installsuffix suffix
    	set package directory suffix
  -k symbol
    	set field tracking symbol
  -libgcc string
    	compiler support lib for internal linking; use "none" to disable
  -linkmode mode
    	set link mode
  -linkshared
    	link against installed Go shared libraries
  -memprofile file
    	write memory profile to file
  -memprofilerate rate
    	set runtime.MemProfileRate to rate
  -msan
    	enable MSan interface
  -n	dump symbol table
  -o file
    	write output to file
  -pluginpath string
    	full path name for plugin
  -r path
    	set the ELF dynamic linker search path to dir1:dir2:...
  -race
    	enable race detector
  -s	disable symbol table
  -strictdups int
    	sanity check duplicate symbol contents during object file reading (1=warn 2=err).
  -tmpdir directory
    	use directory for temporary files
  -u	reject unsafe packages
  -v	print link trace
  -w	disable DWARF generation
Error: running "go build -o build/golang-crossbuild/elastic-agent-darwin-amd64 -ldflags -s "github.com/elastic/beats/v7/x-pack/elastic-agent/pkg/release.snapshot=false" -X github.com/elastic/beats/v7/libbeat/version.buildTime=2020-05-11T15:37:11Z -X github.com/elastic/beats/v7/libbeat/version.commit=3bcfa2a9984ad75e39a169e0f1d929a2b7f17c6c" failed with exit code 2
Error: failed building for darwin/amd64: exit status 2
failed building for darwin/amd64: exit status 2
package ran for 3m15.423462598s
Error: running "docker run --env EXEC_UID=1000 --env EXEC_GID=985 --env GOFLAGS=-mod=vendor --rm --env MAGEFILE_VERBOSE= --env MAGEFILE_TIMEOUT= --env SNAPSHOT=false -v /home/ph/go/src/github.com/elastic/beats:/go/src/github.com/elastic/beats -w /go/src/github.com/elastic/beats/x-pack/elastic-agent docker.elastic.co/beats-dev/golang-crossbuild:1.13.10-main-debian7 --build-cmd build/mage-linux-amd64 golangCrossBuild -p linux/amd64" failed with exit code 1
running "docker run --env EXEC_UID=1000 --env EXEC_GID=985 --env GOFLAGS=-mod=vendor --rm --env MAGEFILE_VERBOSE= --env MAGEFILE_TIMEOUT= --env SNAPSHOT=false -v /home/ph/go/src/github.com/elastic/beats:/go/src/github.com/elastic/beats -w /go/src/github.com/elastic/beats/x-pack/elastic-agent docker.elastic.co/beats-dev/golang-crossbuild:1.13.10-main --build-cmd build/ma

@michalpristas
Copy link
Contributor Author

@ph LDFlags vs Vars sorry, fixed

@ph ph added the needs_backport PR is waiting to be backported to other branches. label May 13, 2020
Copy link
Contributor

@ph ph left a comment

Choose a reason for hiding this comment

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

LGTM I have added need_backport, we should backport it to the 7.x and 7.8 but the 7.8 is frozen and I don't think it's worth the risk to merge it to 7.8 because it impacts the packaging.

@michalpristas michalpristas merged commit fe12fdd into elastic:master May 14, 2020
michalpristas added a commit to michalpristas/beats that referenced this pull request May 15, 2020
[Elastic Agent] Pick up version from libbeat (elastic#18350)
v1v added a commit to v1v/beats that referenced this pull request May 15, 2020
…w-oss

* upstream/master: (27 commits)
  Disable host fields for "cloud", panw, cef modules (elastic#18223)
  [docs] Rename monitoring collection from legacy internal collection to legacy collection (elastic#18504)
  Introduce auto detection of format (elastic#18095)
  Add additional fields to address issue elastic#18465 for googlecloud audit log (elastic#18472)
  Fix libbeat import path in seccomp policy template (elastic#18418)
  Address Okta input issue elastic#18530 (elastic#18534)
  [Ingest Manager] Avoid Chown on windows (elastic#18512)
  Fix Cisco ASA/FTD msgs that use a host name as NAT address (elastic#18376)
  [CI] Optimise stash/unstash performance (elastic#18473)
  Libbeat: Remove global loggers from libbeat/metric and libbeat/cloudid (elastic#18500)
  Fix PANW bad mapping of client/source and server/dest packets and bytes (elastic#18525)
  Add a file lock to the data directory on startup to prevent multiple agents. (elastic#18483)
  Followup to 12606 (elastic#18316)
  changed input from syslog to tcp/udp due to unsupported RFC (elastic#18447)
  Improve ECS field mappings in Sysmon module. (elastic#18381)
  [Elastic Agent] Cleaner output of inspect command  (elastic#18405)
  [Elastic Agent] Pick up version from libbeat (elastic#18350)
  Update communitybeats.asciidoc (elastic#18470)
  [Metricbeat] Change visualization interval from 15m to >=15m (elastic#18466)
  docs: Fix typo in kerberos docs (elastic#18503)
  ...
michalpristas added a commit that referenced this pull request May 15, 2020
[Elastic Agent] Pick up version from libbeat (#18350)
michalpristas added a commit to michalpristas/beats that referenced this pull request May 15, 2020
[Elastic Agent] Pick up version from libbeat (elastic#18350)
michalpristas added a commit that referenced this pull request May 18, 2020
[Elastic Agent] Pick up version from libbeat (#18350)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs_backport PR is waiting to be backported to other branches. review [zube]: In Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants