gravitational / teleport

The easiest, and most secure way to access and protect all of your infrastructure.
https://goteleport.com
GNU Affero General Public License v3.0
17.33k stars 1.74k forks source link

`make full-ent` errors on Go 1.18 #11456

Closed webvictim closed 2 years ago

webvictim commented 2 years ago

Description

What happened: I checked out the Teleport repo, switched to tag v9.0.1 and tried to run make full-ent to build Enterprise binaries for darwin/arm64.

The build failed with an error:

error obtaining VCS status: main module is in repository "/Users/gus/go/src/github.com/gravitational/teleport" but current directory is in repository "/Users/gus/go/src/github.com/gravitational/teleport/e"
    Use -buildvcs=false to disable VCS stamping.

Full logs:

rm: lib/web/build/webassets: is a directory
rm -fr /Users/gus/go/src/github.com/gravitational/teleport/e/../lib/web/build
mkdir -p /Users/gus/go/src/github.com/gravitational/teleport/e/../lib/web/build
---> Copying Enterprise web assets.
mkdir -p /Users/gus/go/src/github.com/gravitational/teleport/e/../lib/web/build/webassets
cd ../webassets/e/teleport/ ; cp -r . /Users/gus/go/src/github.com/gravitational/teleport/e/../lib/web/build/webassets
---> Attaching Enterprise web assets.
/Applications/Xcode.app/Contents/Developer/usr/bin/make all WEBASSETS_TAG="webassets_embed"
---> Building Enterprise with GOOS=darwin GOARCH=arm64 and without PAM support and without FIPS support and without BPF support and without access tester and without Windows RDP client.
/Applications/Xcode.app/Contents/Developer/usr/bin/make build/teleport build/tctl build/tsh build/tbot
/Applications/Xcode.app/Contents/Developer/usr/bin/make -s -C .. ensure-webassets-e
GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 go build -tags "   webassets_embed " -o build/teleport  -ldflags '-w -s' ./tool/teleport
error obtaining VCS status: main module is in repository "/Users/gus/go/src/github.com/gravitational/teleport" but current directory is in repository "/Users/gus/go/src/github.com/gravitational/teleport/e"
    Use -buildvcs=false to disable VCS stamping.
make[3]: *** [build/teleport] Error 1
make[2]: *** [all] Error 2
make[1]: *** [full] Error 2
make: *** [full-ent] Error 2

Checkout status:

~/go/src/github.com/gravitational/teleport (7bbe6f15c) »
HEAD detached at v9.0.1
nothing to commit, working tree clean

~/go/src/github.com/gravitational/teleport/e (06f39e8) » git status
HEAD detached at 06f39e8
nothing to commit, working tree clean

This seems to have been introduced sometime between v8.0.6 (when I last compiled here) and v9.0.1. OSS binaries compile fine.

The annoying thing is that make release calls this step too.

What you expected to happen: The Enterprise build should complete without errors.

Reproduction Steps

See above.

zmb3 commented 2 years ago

@webvictim I believe this is actually a Go 1.18 issue. Did you recently upgrade?

webvictim commented 2 years ago

Ah, yes. Go is installed by Homebrew on this machine and it automatically installed 1.18.

zmb3 commented 2 years ago

Yeah this is the new Go feature that automatically embeds git metadata in the binary.

I guess the way we handle the e submodule is confusing Go. It doesn't expect multiple remotes in the same tree.