-
-
Notifications
You must be signed in to change notification settings - Fork 590
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
Pass system environment variables when executing custom command #4611
Pass system environment variables when executing custom command #4611
Conversation
@@ -9,12 +9,21 @@ public final class MockSystem: Systeming { | |||
|
|||
// swiftlint:disable:next large_tuple | |||
public var stubs: [String: (stderror: String?, stdout: String?, exitstatus: Int?)] = [:] | |||
public var requiredEnvironmentVariables: [String: [String: String]] = [:] |
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 not sure about writing so much code to MockSystem
for testing a very specific thing. I would rather use E2E tests for this:
- Define a new step here for adding a custom env variable
- Update or create a new plugin inside this example repository. A new release will need to be made (I can do this for you if you ping me)
- Invoke that command here - make sure it would fail if the env variable was not passed.
Given the E2E flow for plugins is not as straightforward as I want it to be, I am personally ok for now to merge this without any additional tests. Or if you could simplify the unit test without introducing too much code in MockSystem
. I will leave that up to you, let me know 🙂
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.
Thanks @fortmarek !
As you suggested, I updated create-file
plugin in this repository to retrieve content string from the environment variable. And implemented E2E test cases.
My ExampleTuistPlugin implementation is currently in my forked repository and if there is no problem with this change, I will create PR in tuist organization's repository
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.
This is great! Please, create a PR against the tuist's ExampleTuistPlugin
repo and I'll do a review there 👍
e923202
to
e609996
Compare
@woohyunjin06 I have updated the PR to use the new plugin, could you please have a look that everything is ok? |
Thanks @danyf90 The test scenario currently written cannot be completed successfully without I don't know the exact intension of executing |
Short description 📝
How to test the changes locally 🧐
Checklist ✅
changelog:added
,changelog:fixed
, orchangelog:changed
, whenever it should be included in the “Added”, “Fixed” or “Changed” section of the CHANGELOG. Note: when included in the CHANGELOG, the title of the PR will be used as entry, please make sure it is clear and suitable.TuistGraph.Target
, theConstants.cacheVersion
has been updated.