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

Disparate Ruby Versions #1371

Closed
Phillita opened this issue Oct 16, 2024 · 7 comments
Closed

Disparate Ruby Versions #1371

Phillita opened this issue Oct 16, 2024 · 7 comments

Comments

@Phillita
Copy link

Hello ShipIt Team!

First off, thank you for your commitment to OSS.

I've run into an issue during the setup of the ShipIt project. I've initiated the repo with Ruby 3.1 and went through the setup steps. All was going well until I tried to deploy a test application. This application runs on Ruby 3.4. I get the following error at the bundle step:

Image

I've tried running a setup using the shipit.yml where I set the Ruby version in the dependencies.pre and overrode using the dependencies.override and have had no luck getting past this issue. Below is me trying to run the install by installing/setting the version before the bundle install:

Image

Unfortunately, many projects won't have the same version as the ShipIt project. Can ShipIt detect/install/use the Ruby version from the project it is trying to deploy? I'm likely doing something wrong.

@casperisfine
Copy link
Contributor

Can ShipIt detect/install/use the Ruby version from the project it is trying to deploy?

No it's not, it's part of its simple design, the assumption is that you don't need the full projects to bundle on Shipit, only their deploy scripts.

If I had to do it all over again today, I'd probably do something docker based, but it wasn't that mature back in the day.

An easy way out is often to have the deploy script and dependencies split in a subdirectory and to use machine.directory to work there.

That said your issue is probably in big part because you are bypassing the default generated bundler command, which strips the Ruby constraint: https://github.com/Shopify/shipit-engine/blob/51bc4c86f12437959dfe5a1f02e3cb37435efbe6/app/models/shipit/deploy_spec/bundler_discovery.rb#L33C11-L41

@Phillita
Copy link
Author

Thank you for your reply @casperisfine!

You've pointed me in the right direction for where to look. I hadn't realized there was a step to remove this constraint.

That said your issue is probably in big part because you are bypassing the default generated bundler command, which strips the Ruby constraint: https://github.com/Shopify/shipit-engine/blob/51bc4c86f12437959dfe5a1f02e3cb37435efbe6/app/models/shipit/deploy_spec/bundler_discovery.rb#L33C11-L41

You're right. In my last runs, when I used the dependencies.override, I skipped this step. With my earlier runs, I used the default setup without a shipit.yml. For some reason, it isn't removing the Ruby line in the gemfile.

I've now tried running the sed command /usr/bin/sed -i '' '/^ruby\s/d' Gemfile which should remove the ruby version from the file in place but doesn't seem to do that.

@Phillita
Copy link
Author

@casperisfine I was playing with the sed command and for some reason I would need to remove the \s from the regex expression for my Unix system to remove the ruby constraint from the gemfile.

Has anyone else run into this? I tested the linux sed command and it works fine.

Working Unix Command: /usr/bin/sed -i '' '/^ruby/d' Gemfile

@casperisfine
Copy link
Contributor

my Unix system

What system is that?

@Phillita
Copy link
Author

I'm on a Mac OS Sonoma 14.7

@casperisfine
Copy link
Contributor

I just tried it and it's indeed broken, I suppose sed changed on OSX a while ago.

I think we should change it for /usr/bin/sed -i '' '/^ruby /d' Gemfile

@Phillita
Copy link
Author

Tested on my end and that works as expected!

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

No branches or pull requests

2 participants