-
Notifications
You must be signed in to change notification settings - Fork 33
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
Task / Configurable runner environment #140
Task / Configurable runner environment #140
Conversation
It seems the Update: @giginet done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to keep you waiting!
I understood the requirements and wish to merge this
I commented some points.
This reverts commit bd0a035.
…unner-environment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry for asking so late.
I want to clarify whether changes to the Environment affect the cache.
In your current example, you are passing DEVELOPER_DIR
and PATH
. As such, these changes will not affect the final artifacts.
I'd like to know whether there are any other configuration values that could affect the final product due to changes in the Environment.
And if it is not necessary to incorporate Environment changes into CacheKey, it seems better to pass Environment directly to Runner
rather than having it in BuildOptions
.
BuildOptions
contains configuration values that are directly included in CacheKey, so it may cause confusion if some values are not included depending on the property
How about a design where the values are passed to Runner.Options
instead of BuildOptions
and then propagated?
@giginet What you say sounds reasonable, it would lead to a better architecture indeed. Additionally, environment configuration should be done once per run so it's applied for all build targets consistently, hence it fits more when done on the runner level.
I just applied the changes as suggested here. Please have a look. P.S: I just realized that the PR is called "Configurable runner environment" 🤦 |
I didn't add any tests since there are no existing test cases for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost looks great!
Thank you for the quick fixes.
I pointed trivial points.
@dmhts Thank you for the contribution! I'll release the new version soon. By the way, I'm very excited that your company uses this product heavily. I'm happy to hear the case study someday. |
@giginet That's not it, there's one more PR coming soon :) We're currently working on a tool that uses SwiftPM and Scipio at its core. Once everything is polished, our goal is to open-source it. It's already running successfully in our CI pipelines. You'll be one of the first people I let know when it's ready! |
Motivation:
The motivation for this PR is to make
Runner
more flexible by optionally allowing the provision of a custom environment for the underlyingUserToolchain
.Context:
In our company, we use ScipioKit in a quite advanced way. Specifically, we use it to precompile packages with multiple toolchains within a single run. For this, we set certain environment variables such as
PATH
andDEVELOPER_DIR
before each Runner's run to delicately control the compiling process.It all works well, except for the case when the environment is not provided to
UserToolchain
; it defaults toEnvironment.current
. This is not a problem by itself; the problem is that such an environment is statically cached when called for the very first time, and there's no way to redefine it in the subsequent runs (as all the Environment state modifiers are internal).Solution:
This problem can be easily fixed by extending the
Runner
interface so it takes an optionalEnvironment
parameter in its build options, which is then handed over to the underlyingUserToolchain
.Important:
The PR ensures that the newly introduced environment property (in
BuildOptions
) does not affect the existingSwiftPMCacheKey
, meaning the cache will remain environment-agnostic.@giginet I'd love to hear your opinion on this.