Skip to content

How to produce exe or msi executable file from OCB custom builder #951

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

Open
DesAWSume opened this issue May 12, 2025 · 5 comments
Open

How to produce exe or msi executable file from OCB custom builder #951

DesAWSume opened this issue May 12, 2025 · 5 comments

Comments

@DesAWSume
Copy link

DesAWSume commented May 12, 2025

I have successfully generated a no extension from OCB in Windows. However, I am not able to change it to exe or msi file from it.

Image

I can use ocb.exe with my custom builder-config.ymal to compile as binary. However, I cant see a way of converting it

Copy link

dosubot bot commented May 12, 2025

Hello @DesAWSume! I'm Dosu, here to help you with bugs, questions, and contributing. While you wait for a human maintainer, feel free to ask me anything!

To produce an exe or msi executable file from the OpenTelemetry Collector Builder (OCB) on Windows, you can follow these steps:

  1. Use Goreleaser: The OpenTelemetry Collector repository uses goreleaser to assist in converting binaries to Windows executable formats. Ensure that your .goreleaser.yaml file includes configurations for Windows builds and MSI packaging.

  2. Define MSI Configuration: In the .goreleaser.yaml file, specify the MSI configuration under the msi section. This includes the MSI ID, name template, WXS file, and any extra files to be included in the MSI package.

  3. Build Configuration: Ensure that the build configuration for Windows is defined under the builds section, specifying the target OS and architecture for the binary.

  4. Run Goreleaser: Execute goreleaser to package the binaries into MSI files. This tool will handle the conversion to Windows executable formats, including MSI packages.

These steps should help you convert your OCB-generated binary into exe or msi files using the configurations in the .goreleaser.yaml file [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot dosubot bot added the os:windows label May 12, 2025
@braydonk
Copy link

Firstly, I don't think this is the correct repository for this issue. I think you should open this issue in opentelemetry-collector-contrib where the builder component exists, since this appears to be an issue about the builder and not this particular releases repo.

However, I am not able to change it to exe

In my experience a rename does the trick here, can you provide more details why that didn't work?

or msi file from it.

msi file does not come from OCB. In this repo, they get MSIs via an pro feature of goreleaser which is a separate tool.

@DesAWSume
Copy link
Author

@braydonk Thanks for answering this, and appreciated the response.
I have also tried renamed the file into .exe and .msi, Unlike Linux distribution, the output file can run as service whereas windows is just a binary

Renamed to .exe
Image

After clicking it, it does like a ocb.exe
Image

Renamed it to .msi, and it will tell you not a executable that windows can run

Image

@braydonk
Copy link

braydonk commented May 12, 2025

Renamed it to .msi, and it will tell you not a executable that windows can run

Yes, to be clear you cannot get an msi from ocb. Renaming it to .exe works because the file produced is a Windows Executable. Adding the extension is a formality so Windows knows, but under the hood it is still always a Windows executable file. It is not an msi file, and changing the file name to .msi does not change that. To get an msi you will need to build one yourself, or use the pro features of goreleaser that this repo also uses.

@DesAWSume
Copy link
Author

I passed the config flag to the renamed binary and run this in an elevated Powershell session, it doesn't seem to hold the session but closed itself. However, if i run it in PS ISE will keep the session going.

If we use the renamed .exe, what is the best way of running as a backend process in some sort of quiet mode and make sure it runs as the server start or restart

I can think of a task scheduler, any other better way for windows?

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

No branches or pull requests

2 participants