-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Ensure tbot compiles on windows #43877
Conversation
The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting 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.
Looks good but @timothyb89 should deffo review this as well.
You could also add tbot to the build-windows workflow to prevent this from regressing |
I struggled to get tbot to compile on windows as io and syscall bits were spread across tbot's codebase. @strideynet or @timothyb89 please take another look as the PR significantly changed since you reviewed it. Cross-compilation now works: # install cross-compiler
brew install mingw-w64
# build for windows
GOOS=windows GOARCH=amd64 make build/tbot -B
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ go build -tags " kustomize_disable_go_plugin_support" -o build/tbot -ldflags '-w -s ' -trimpath -buildmode=pie ./tool/tbot
# build for darwin
make build/tbot -B
GOOS=darwin GOARCH=arm64 go build -tags " kustomize_disable_go_plugin_support" -o build/tbot -ldflags '-w -s -extldflags=-ld_classic' -trimpath ./tool/tbot
# build for linux
GOOS=linux GOARCH=amd64 make build/tbot -B
GOOS=linux GOARCH=amd64 go build -tags " kustomize_disable_go_plugin_support" -o build/tbot -ldflags '-w -s ' -trimpath ./tool/tbot |
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.
Looks fine to me, and worked without any trouble on my Windows box
@hugoShaka See the table below for backport results.
|
* Ensure tbot compiles on windows * Restore unix tbot support * fixup! Restore unix tbot support * address feedback * Fix tbot build on windows, use CGO for this OS * Move unix-specific syscalls and file descriptors out of os-agnostic files * fixup! Move unix-specific syscalls and file descriptors out of os-agnostic files * lint
* Ensure tbot compiles on windows * Restore unix tbot support * fixup! Restore unix tbot support * address feedback * Fix tbot build on windows, use CGO for this OS * Move unix-specific syscalls and file descriptors out of os-agnostic files * fixup! Move unix-specific syscalls and file descriptors out of os-agnostic files * lint
Tbot was not compiling on windows, this was not an issue because we never tried to. Now that tctl can run an embedded tbot (
tctl terraform env
) we needlib/tbot
to compile on windows.This PR splits the fs implementations for 3 OS variants:
This PR potentially breaks compiling tbot on non unix systems that are not windows. However I think this was never a thing to begin with as compilation was very likely broken (non unix systems don't have
*syscall.Stat_t
).After this PR tbot should now build on windows, and even be able to write files. However, as it is not able to verify ownership I don't think we want to officially support it yet.
Changelog: Make tbot compilable on Windows.