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

remove local golang dependency for ocb binary #11382

Closed
jackgopack4 opened this issue Oct 7, 2024 · 4 comments · May be fixed by #11386
Closed

remove local golang dependency for ocb binary #11382

jackgopack4 opened this issue Oct 7, 2024 · 4 comments · May be fixed by #11386

Comments

@jackgopack4
Copy link
Contributor

Is your feature request related to a problem? Please describe.
ocb binaries, even as they are compiled and built for specific architectures, still require a golang environment to run. This seems counterintuitive; I might expect go install command or compiling from scratch to require golang compiler, but I wouldn't expect a compiled binary to still require golang in the environment

Describe the solution you'd like
I would like to remove the golang dependency for the ocb binary, allowing users to run ocb in a minimal (e.g. scratch, alpine, etc.) environment

Describe alternatives you've considered
Alternative is adding some explicit mention of golang requirement for ocb in documentation, both on github and opentelemetry.io

Additional context
I have been working on and submitted open-telemetry/opentelemetry-collector-releases#671 which has a "thicker" image than required due the golang dependency for ocb binary. Making this change would allow a smaller image, such as from scratch that the collector distros run on.

@jackgopack4
Copy link
Contributor Author

jackgopack4 commented Oct 7, 2024

In my opinion, the quickest solution would be embedding the appropriate version of the golang compiler into ocb binary; this would necessarily raise the size of the ocb binary by around ~75MB.
However, I'm not even certain this is possible. Doing some more investigation to see if I can find any examples of this.

I am also looking into whether I could import golang's cmd/compile or go/build packages as a dependency and call the go build functions in code instead of running as a command.

Alternatively it might also be possible to use the command-line execution functionality of ocb to download and install go binary into a local path if it does not find it installed in PATH.

@Annosha
Copy link

Annosha commented Oct 7, 2024

Hi @jackgopack4 I'm an Outreachy applicant. If the documentation part of this issue is open and beginner friendly can I work on it?

@jackgopack4
Copy link
Contributor Author

Absolutely, feel free to take a crack at it. I think it will be up for discussion whether this is a feature the maintainers want to include (certain security concerns with a program that downloads another binary and executes it on your behalf) but if it is a desired feature, it shouldn't be too complicated, code-wise.

@andrzej-stencel
Copy link
Member

I don't think embedding the Go compiler in the OTel Collector Builder binary is the way to go. The builder's purpose is to generate the sources for a distro and then use the Go compiler to compile the sources. Go compiler is an external dependency of the Builder and in my opinion it should stay like that.

I have commented on open-telemetry/opentelemetry-collector-releases#671 too. Thanks Jack and sorry for the confusion I caused!

@andrzej-stencel andrzej-stencel closed this as not planned Won't fix, can't repro, duplicate, stale Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants