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

feat(ci): add windows builds to dev & pr workflows #762

Merged
merged 4 commits into from
Nov 7, 2022

Conversation

amdprophet
Copy link
Contributor

Signed-off-by: Justin Kolberg [email protected]

Adds Windows builds to the Dev builds & PRs checks GitHub Actions CI workflows.

@amdprophet amdprophet requested a review from a team as a code owner October 16, 2022 02:49
@github-actions github-actions bot added the github_actions Pull requests that update Github_actions code label Oct 16, 2022
@andrzej-stencel
Copy link
Contributor

👏 Impressive to see the engineering that went into this, but also scary to see how much more complicated the build process is becoming, given it was already quite complex. 😞

Probably the most important requirement is to be able to perform the build on a machine other than a GitHub Actions runner (for example a local laptop, or an EC2). Some documentation would probably be needed for this.

@perk-sumo
Copy link
Contributor

Agreed with @astencel-sumo - document describing how to build it locally would be a very nice addition here.

Ideally this would work outside of Github Actions, eg. with bash script or sth.

@github-actions github-actions bot added the go label Oct 18, 2022
@amdprophet
Copy link
Contributor Author

@astencel-sumo @perk-sumo I've started throwing together some notes to document how to build locally on Windows. Should I put it in the otelcolbuilder README.md file or somewhere in the docs directory?

I'm working on getting make gotest to pass at the moment. I've come across a test that checks the permissions of a temporary directory created by the tests (https://github.com/SumoLogic/sumologic-otel-collector/blob/main/pkg/extension/sumologicextension/extension_test.go#L251). Temporary directory permissions differ between Linux & Windows. I'm wondering if we can remove the check and instead run chmod 700 against the temp directory.

@andrzej-stencel
Copy link
Contributor

@astencel-sumo @perk-sumo I've started throwing together some notes to document how to build locally on Windows.

Can't thank you enough for your work @amdprophet 🙇

Should I put it in the otelcolbuilder README.md file or somewhere in the docs directory?

My first thought is CONTRIBUTING.md in the root directory, what do you think?

I'm working on getting make gotest to pass at the moment. I've come across a test that checks the permissions of a temporary directory created by the tests (https://github.com/SumoLogic/sumologic-otel-collector/blob/main/pkg/extension/sumologicextension/extension_test.go#L251). Temporary directory permissions differ between Linux & Windows. I'm wondering if we can remove the check and instead run chmod 700 against the temp directory.

Hm yeah it doesn't seem that this check makes any sense. It doesn't seem to be testing any functionality of the extension, it's reather an assertion on how the os.MkdirTmp() function works, which I don't think is relevant to anything. I support removing this check.

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Oct 20, 2022
@amdprophet
Copy link
Contributor Author

@astencel-sumo CONTRIBUTING.md makes sense to me. I've added some documentation to it; please let me know if you think it needs any changes.

@amdprophet
Copy link
Contributor Author

amdprophet commented Oct 24, 2022

I believe this is ready for review again. There are two tests that are failing intermittently with rawk8seventsreceiver but they don't seem to be Windows-specific as they're also occasionally failing in macOS.

The two tests are TestProcessEventE2E and TestStorage and the failure for both is due to LogRecordCount() returning 0 instead of the expected 1.

@amdprophet amdprophet force-pushed the dev-build/windows branch 2 times, most recently from 88d0879 to 1e8d7ca Compare October 26, 2022 17:03
@andrzej-stencel
Copy link
Contributor

Thanks a lot @amdprophet, this looks much much better. Following the instructions, I was able to build the binary on Windows and it seems to work perfectly fine. 👌 I might have just a few nits for the instructions.

Here's a silly question though: I just noticed there's an otelcol-sumo-windows_amd64 target in the otelcolbuilder/Makefile that seems to also build a Windows binary. What's the benefit of running the build on an actual Windows runner, if there is any?

CONTRIBUTING.md Outdated
setx path "%PATH%;C:\Program Files (x86)\GnuWin32\bin"
```

1. (Optional) Install [Windows Terminal][windows-terminal].
Copy link
Contributor

@andrzej-stencel andrzej-stencel Oct 26, 2022

Choose a reason for hiding this comment

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

I don't think I would bother the user with installing the Windows Terminal. I mean, it's a good app that I use and would recommend to anyone, but it's orthogonal to the instructions on building the binary and it's an additional step, even if optional, which you could argue is even worse, because the user now needs to make a decision, which is the harder to make the more uninformed the user is. 🙂

I'd rather keep the steps as minimal as possible.

CONTRIBUTING.md Outdated

1. Open gitbash (or Windows Terminal using gitbash shell).

1. Clone this repository:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I would assume the user has the repository already cloned, I would skip this step and straight to cd otelcolbuilder, the assumption being the user is already in the root of the repo. This is what is being done in the How to build steps below and I think it's enough.

@amdprophet
Copy link
Contributor Author

amdprophet commented Oct 26, 2022

Thanks a lot @amdprophet, this looks much much better. Following the instructions, I was able to build the binary on Windows and it seems to work perfectly fine. 👌 I might have just a few nits for the instructions.

Here's a silly question though: I just noticed there's an otelcol-sumo-windows_amd64 target in the otelcolbuilder/Makefile that seems to also build a Windows binary. What's the benefit of running the build on an actual Windows runner, if there is any?

The binary doesn't have to be built on a Windows runner but the MSI packaging will. Rather than setting up a complex pipeline that can pass binaries from one runner to another, I thought it would be best to run everything on a single Windows runner.

@andrzej-stencel
Copy link
Contributor

The binary doesn't have to be built on a Windows runner but the MSI packaging will.

Oh I see, so we want to expand this in the future to things that are easier/more feasible on Windows OS (like building the installer). Thanks for the explanation 👍

@swiatekm swiatekm enabled auto-merge (rebase) October 27, 2022 11:06
@swiatekm swiatekm self-requested a review October 27, 2022 11:37
Copy link

@swiatekm swiatekm left a comment

Choose a reason for hiding this comment

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

@amdprophet We need to prevent the install script tests from running on Windows as well. Right now, unsurprisingly, they fail: https://github.com/SumoLogic/sumologic-otel-collector/actions/runs/3332408749/jobs/5522454895.

I think it's sufficient to add a build tag to the tests module: https://github.com/SumoLogic/sumologic-otel-collector/tree/main/pkg/scripts_test

@amdprophet
Copy link
Contributor Author

@swiatekm-sumo I've already added build tags to prevent execution of those tests on Windows. It seems like this is due to the Makefile attempting to run the tests with sudo which doesn't exist on the Windows runner. I've used a variable called SUDO in the past which contains the name or path to sudo and then I overridde it to an empty string on platforms where there is no sudo. What do you think?

@amdprophet
Copy link
Contributor Author

It seems that the env command is problematic on Windows as well https://github.com/SumoLogic/sumologic-otel-collector/blob/main/pkg/scripts_test/Makefile#L5. Perhaps conditional behaviour for that make target is a better choice.

auto-merge was automatically disabled October 27, 2022 19:13

Head branch was pushed to by a user without write access

@swiatekm
Copy link

swiatekm commented Oct 31, 2022

chmod +x ./cmd/otelcol-sumo-windows_amd64.exe.exe

Looks like you've got an extraneous .exe somewhere in there.

@swiatekm swiatekm self-requested a review November 2, 2022 09:02
Copy link

@swiatekm swiatekm left a comment

Choose a reason for hiding this comment

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

LGTM

@swiatekm swiatekm enabled auto-merge (rebase) November 7, 2022 16:34
auto-merge was automatically disabled November 7, 2022 16:50

Head branch was pushed to by a user without write access

@amdprophet
Copy link
Contributor Author

I believe the failing test just needs to be rerun. I saw intermittent failures of that test on both Windows & macOS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation github_actions Pull requests that update Github_actions code go
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants