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

Adds +INIT and $OS_RELEASE to cache id #25

Merged
merged 22 commits into from
Nov 15, 2023
Merged

Conversation

idelvall
Copy link
Member

@idelvall idelvall commented Nov 14, 2023

This PR:

  • Includes the distro information (from /etc/os-release) in the cache id default value. This avoids the scenario of reusing the cache entries across potentially incompatibles shared libraries.
  • Includes a +INIT UDC used for initialize the build environment for the rest UDCs to be invoked.
  • Exports the cache id to the build environment as $CARGO_HOME_CACHE_ID

@idelvall idelvall requested a review from a team as a code owner November 14, 2023 00:01
rust/README.md Outdated Show resolved Hide resolved
rust/Earthfile Show resolved Hide resolved
rust/Earthfile Show resolved Hide resolved
rust/Earthfile Outdated Show resolved Hide resolved
rust/Earthfile Show resolved Hide resolved
Co-authored-by: Vlad A. Ionescu <[email protected]>
ARG OS_RELEASE=$(md5sum /etc/os-release | cut -d ' ' -f 1)
ARG cache_id="${EARTHLY_TARGET_PROJECT_NO_TAG}#${OS_RELEASE}#earthly-cargo-cache"
RUN echo "$cache_id">/earthly/cfg/cache_id
ENV CARGO_HOME_CACHE_ID=$cache_id
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is nice as a workaround but can I suggest you consider making this a first class feature of Earthly UDCs. e.g.

IMPORT github.com/earthly/lib/rust AS rust-udc WITH --foo=bar --cache-id=foo

To set some ARG --global declared at the top of the UDC?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

rust/Earthfile Outdated Show resolved Hide resolved
rust/Earthfile Show resolved Hide resolved
rust/Earthfile Show resolved Hide resolved
rust/Earthfile Show resolved Hide resolved
rust/README.md Show resolved Hide resolved
@idelvall idelvall merged commit 1135c5c into main Nov 15, 2023
3 checks passed
@idelvall idelvall deleted the nacho/rust-init-osrelease branch November 15, 2023 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants