-
Notifications
You must be signed in to change notification settings - Fork 90
Make Bundler load Project's Gemfile dependencies #703
Conversation
logger.error("The following gems are missing") | ||
not_installed.each { |s| logger.error(" * #{s.name} (#{s.version})") } | ||
end | ||
rescue Bundler::GemfileNotFound => ex |
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.
let's use notification_service
here too, here's an example:
ci/app/shared/models/git_repo.rb
Line 176 in c81ec49
def handle_exception(ex, console_message: nil, exception_context: {}) |
Ideally, we send this notification to the admin of the machine so they can potentially file a bug, or something
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.
Nice! I'll first try to make it work properly but that's a good one!!
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.
Cool, there's already a notification_service
property on the super class 👍
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.
Oh wow, great job on finding out how to use this, it looks great. Can we verify that this works, by trying to onboard fastlane/fastlane
, where we make use of fastlane plugins?
This is becoming to a dead end. When I success in loading the Gemfile, it fails if there's already the same gem (different version loaded) and I don't see any way to unload the gems of the current process, and bundler seems not to achieve the isolation... I'll try to work on it this evening but is not looking good 😔 |
So this is the output of a
So the only way that I accomplished this is doing the following:
This works. Is not the perfect solution? I don't think so, but I can't make with another solution. |
58104bc
to
c4aa45d
Compare
@minuscorp does this merge the dependencies of CI and whatever project is being built? |
This temporally adds dependencies of other projects to the CI (while building) then, CI's original dependencies are restored and installed again. |
Ok, let's go with it for now, but ultimately I think we need to actually fork a new process to avoid this approach. |
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.
🕶:goat:
Yep, I know this is super hacky, but while we're attached to the same thread as the CI for the builds I couldn't find any other way to workaround this. In a future the whole fastlane build runner should(?) be a Maybe we should open a discussion about this, in a follow up PR/issue. |
💯 agree on that. It should be it's own process so there isn't any polluting of lane contexts like we have now, and it would enable us to have better resiliency to crashes and other issues. |
@@ -98,30 +98,50 @@ def run(new_line_block:, completion_block:) | |||
# folder, and all the following code works | |||
# This is needed to load other configuration files, and also find Xcode projects | |||
|
|||
original_gemfile = File.open(Bundler.default_gemfile, "rb") |
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.
Could we simplify this to:
original_gemfile_contents = File.read(Bundler.default_gemfile)
original_lockfile_contents = File.read(Bundler.default_lockfile)
@@ -153,6 +173,15 @@ def run(new_line_block:, completion_block:) | |||
artifacts_paths = gather_build_artifact_paths(loggers: [verbose_log, info_log]) | |||
|
|||
return | |||
ensure | |||
if gemfile_found |
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.
Could we simplify this ensure block to:
ensure
return unless gemfile_found
original_gemfile_contents = File.read(Bundler.default_gemfile)
original_lockfile_contents = File.read(Bundler.default_lockfile)
end
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.
agh, never return
in a ensure block 😢
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.
Forgot that, good catch.
Thinking out loud, unidirectional IPC -> |
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.
Thank you so much @minuscorp for fixing the gemfile dependencies issue! I just have two minor nitpicks, but great work!
This reverts commit d7c923d.
Oh man, just squashed :( |
Ahh no worries - we can do it in another PR, or leave it the way it is 🙂 |
Fixes #674