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

fix: Use absolute path for binaries #99

Closed
wants to merge 1 commit into from

Conversation

ravron
Copy link
Contributor

@ravron ravron commented Oct 13, 2023

Which problem is this PR solving?

The home directory varies across CI docker images. In CircleCI-provided convenience images, the user is circleci and therefore the home directory is /home/circleci. However, on many docker images, the user might be root and use /root as a home directory.

The problem is that the orb currently uses ~ in all its paths, even for commands that may run on different images. As a result, download_be_executables and save_be_cache write binaries to and cache them from ~/project/bin. Later, commands that try to use these binaries, like with_job_span, also look in ~/project/bin. But if the home directory differs between the image that cached the binaries and the one that restores the cache and tries to use them, the latter will fail to locate the binaries. For example, if the image that tries to use the binaries uses the root user, I observe the following error:

/bin/bash: line 8: /root/project/bin/be-linux-aarch64/buildevents: No such file or directory

Short description of the changes

This PR makes all of the paths in the orb absolute, rooted in /home/circleci. The rationale for that directory is that for CircleCI-provided convenience images, the binaries will be in the same spot they always were. This is also a directory that should be writable for both common uses: CircleCI images will be able to write to their own home directory, while images using root will be able to write anywhere.

@ravron ravron requested a review from a team as a code owner October 13, 2023 20:20
@ravron
Copy link
Contributor Author

ravron commented Oct 13, 2023

I've discovered that this PR does not work on macOS builders, because macOS does not permit writes to /home/circleci. That makes it a tradeoff: if your current build uses only macOS builders, then this PR will break it. However, if your current build mixes non-macOS builders with different home directories, this orb doesn't work as-is.

@brookesargent
Copy link
Contributor

Thank you for your patience!

We spent a bit of time looking at this and appreciate the contribution and the follow-up pointing out that it breaks for macOS builders. We'd prefer to leave the orb as is until we can find a solution that fixes mixed builders without breaking macOS builders. I've opened #100 with the problem you described above so we can continue to track the issue.

@roblundiehill-plutoflume

Use /tmp/honeycomb-buildevents as the path? /tmp exists on macOS too. Hoping macOS or other systems don't have some execution prevention thingy on /tmp. There's got to be some mutually acceptable location - /usr/local/honeycomb-buildevents or similar?

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 this pull request may close these issues.

3 participants