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

Update Process.dependencies to allow more flexibility when setting envs #124

Merged
merged 3 commits into from
Sep 16, 2024

Conversation

kylewlacy
Copy link
Member

This PR updates how the dependencies field is use when a process recipe is baked. Each dependency recipe can contain a brioche-env.d/env directory to set env vars on the process, but previously this was limited to appending $PATH-like env vars: each entry in brioche-env.d/env had to be a directory (whose name was an env var), where each entry within was a symlink, whose target would be appended to the env var (separated by :).

This PR lifts the restriction, and now each env var within brioche-env.d/env can either be a file, directory, or symlink:

  • Directory: Same behavior as before. Each entry within the directory must be a symlink whose target is appended to the env var (the name of the symlink doesn't matter)
  • Symlink: If the env var is empty, then it will be set to the target of the symlink. This is only used as a fallback, so this will be skipped if the env var is already set
  • File: If the env var is empty, then it will be set to the file's contents. This is only used as a fallback, so this will be skipped if the env var is already set

So, this is now a valid structure for a dependency:

- bin/
  - cc
- brioche-env.d/
  - env/
    - PATH/
      - path1 -> ../../../bin
    - CC -> ../../bin/cc
    - DEBUG [file containing the string "1"]

When used as a dependency, it will append bin to $PATH, set $CC to the path to bin/cc (if unset), and set $DEBUG to 1 (if unset)

@kylewlacy kylewlacy marked this pull request as ready for review September 16, 2024 05:44
@kylewlacy kylewlacy merged commit 1f09391 into main Sep 16, 2024
5 checks passed
@kylewlacy kylewlacy deleted the process-dependency-more-envs branch September 16, 2024 07:16
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.

1 participant