Compiling certain version

I followed the following instructions to compile beats from source: Building filebeat from source

It works, but even though I downloaded 6.5.4, when outputting the version I get:

~/Tmp/beats-6.5.4/x-pack/functionbeat  ./functionbeat version
functionbeat version 7.0.0 (amd64), libbeat 7.0.0 [ built 2019-01-03 15:31:34 +0000 UTC]

How can I compile a specific version?

It's might be an issue with your GOPATH and when building it's pulling in dependencies from elsewhere that you have checked out. Try building it in isolation.

# Dockerfile
FROM golang:1.10.6

RUN mkdir -p /go/src/github.com/elastic \
      && git clone https://github.com/elastic/beats.git /go/src/github.com/elastic/beats

WORKDIR /go/src/github.com/elastic/beats

ENV COMMIT v6.5.4

RUN git checkout $COMMIT

RUN cd x-pack/functionbeat \
      && make functionbeat \
      && ./functionbeat version
$ docker build .
...
 ---> Running in f80665e63454
go build -i -ldflags "-X github.com/elastic/beats/libbeat/version.buildTime=2019-01-03T17:00:45Z -X github.com/elastic/beats/libbeat/version.commit=bd8922f1c7e93d12b07e0b3f7d349e17107f7826"
functionbeat version 6.5.4 (amd64), libbeat 6.5.4 [bd8922f1c7e93d12b07e0b3f7d349e17107f7826 built 2019-01-03 17:00:45 +0000 UTC]

edit: The v6.5.4 tag has been fixed so I updated the example.

Checking github we did tag the wrong commit hash in the 6.5 release branch to be 6.5.4 by accident. It is the same code, but only the version number has already been updated to 6.5.5 (as this .

We fixed the commit hash to match the official release build hash. Redownloading beats-6.5.4 source code from github should get you the correct sources.

But you should not get the 7.0.0 version being displayed. Can you share your output of go env?

Do you have another checkout of Beats in $GOPATH/src/github.com/elastic/beats?

Awesome thanks @andrewkroh - that was exactly it - which means the thread I was linking to is not correct. Would be helpful to have it in the projects README.md

@steffens that was the second issue I was encountering, thank you for the heads-up!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.