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

Disable VCS stamping #393

Closed
wants to merge 2 commits into from
Closed

Conversation

oakrizan
Copy link
Contributor

@oakrizan oakrizan commented Feb 29, 2024

While migrating beats repo faced an error during packaging.
To fix issue it's required to disable vcs stamping.

Copy link

mergify bot commented Feb 29, 2024

This pull request does not have a backport label. Could you fix it @oakrizan? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d is the label to automatically backport to the 1./d branch. /d is the digit
    NOTE: backport-skip has been added to this pull request.

@@ -7,6 +7,7 @@ env:
DOCKER_REGISTRY: "docker.elastic.co"
STAGING_IMAGE: "${DOCKER_REGISTRY}/observability-ci"
BUILDX: 1
GOFLAGS: "-buildvcs=false"
Copy link
Member

Choose a reason for hiding this comment

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

wait, IIUC, the issue is in beats if that's the case, aren't these changes needed to be included in the consumer instead?

Copy link
Member

Choose a reason for hiding this comment

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

For instance, the elastic-agent team did something similar and they are also consumers of this library (golang-crossbuild):

Copy link
Contributor

@dliappis dliappis Mar 14, 2024

Choose a reason for hiding this comment

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

For instance, the elastic-agent team did something similar and they are also consumers of this library (golang-crossbuild):

FYI @v1v the above PR you mentioned is interesting; the problem didn't get fixed by setting export GOFLAGS='-buildvcs=false' because this value gets overwritten and is hardcoded when docker is invoked here: https://github.com/elastic/beats/blob/main/dev-tools/mage/crossbuild.go#L330 (permalink).

The problem got fixed by avoiding having a nested repo (i.e. cloning beats within another cloned repo (elastic-agent): elastic/elastic-agent@cc81e4b#diff-f8bd7a8bc1f2826590a0bd7c0937871d04d15970ee75a830324888f63ce116f5R19 . A similar reproduction is described here.

vcs stamping issues seem to be rampant after go 1.18.0, e.g. see golang/go#49004 and specifically the commit description in golang/go@4569fe6
See also https://github.com/elastic/endgame-gameover/commit/a9d2c6ca12e81eace3802e39bbd933d4cac7cbc3

cc @alexsapran

@v1v v1v self-requested a review March 1, 2024 08:53
@v1v
Copy link
Member

v1v commented Mar 1, 2024

In addition, #232 might be relevant too

Copy link
Member

@v1v v1v left a comment

Choose a reason for hiding this comment

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

This will not fix the issue; those flags are only relevant for building the Golang Crossbuild in Buildkite. It will also not fix the problem in the consumers.

Can you point out where this is failing in the Buildkite builds for the Golang Crossbuild?

@oakrizan oakrizan force-pushed the fix-arm-vcs-status branch from b0b60ca to 5d3180c Compare March 11, 2024 21:52
@elasticmachine
Copy link

💚 Build Succeeded

History

@elasticmachine
Copy link

💚 Build Succeeded

History

@elasticmachine
Copy link

💚 Build Succeeded

History

@oakrizan oakrizan closed this Mar 12, 2024
@alexsapran
Copy link

I think we should revisit this. I am not sure why this is failing on some and working on others.
Reading the official Golang docs

The go command now embeds version control information in binaries. It includes the currently checked-out revision, commit time, and a flag indicating whether edited or untracked files are present. Version control information is embedded if the go command is invoked in a directory within a Git, Mercurial, Fossil, or Bazaar repository, and the main package and its containing main module are in the same repository. This information may be omitted using the flag -buildvcs=false.

So I am not 100% sure if we should by default disable it or have it in a way that allow someone to disable it, similar to how it was tried with the elastic-agent repo.

@dliappis
Copy link
Contributor

I think we should revisit this. I am not sure why this is failing on some and working on others. Reading the official Golang docs

The go command now embeds version control information in binaries. It includes the currently checked-out revision, commit time, and a flag indicating whether edited or untracked files are present. Version control information is embedded if the go command is invoked in a directory within a Git, Mercurial, Fossil, or Bazaar repository, and the main package and its containing main module are in the same repository. This information may be omitted using the flag -buildvcs=false.

So I am not 100% sure if we should by default disable it or have it in a way that allow someone to disable it, similar to how it was tried with the elastic-agent repo.

I spent a little more time during the weekend and with a simpler reproducer, I have able to reliable hit the error which goes away when setting -buildvcs=false in the GOFLAGS of the docker image as shown in this commit.

I also did many reruns of with buildvcs disabled and there was no flakiness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants