opentelemetry-collector-releases icon indicating copy to clipboard operation
opentelemetry-collector-releases copied to clipboard

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

Open DesAWSume opened this issue 6 months ago • 5 comments

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

DesAWSume avatar May 12 '25 06:05 DesAWSume

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[bot] avatar May 12 '25 06:05 dosubot[bot]

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.

braydonk avatar May 12 '25 18:05 braydonk

@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

DesAWSume avatar May 12 '25 21:05 DesAWSume

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.

braydonk avatar May 12 '25 21:05 braydonk

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?

DesAWSume avatar May 15 '25 23:05 DesAWSume

This issue has been closed as inactive because it has been stale for 120 days with no activity.

github-actions[bot] avatar Sep 14 '25 05:09 github-actions[bot]