0

I am trying to deploy my rails application on openShift, Everthing is going fine but it giving warning for bundle update.

Warning: the running version of Bundler (1.16.1) is older than the version that created the lockfile (1.16.6). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.

I want to update openshift bundler or some other way around to overcome this.

Anshul Riyal
  • 123
  • 1
  • 12
  • You have to update `bundler` that is installed on openShift. That's all. – MrShemek Mar 29 '19 at 12:18
  • I have tried reading all the documentation of OpenShift as well as redhat's but didn't able to fund the exact way to do that. Can you please help me out with that. @MrShemek – Anshul Riyal Mar 29 '19 at 12:52
  • I do not have any experience with OpenShift but I guess you have to ssh to the OpenShift and the run `gem install bundler`. – MrShemek Mar 29 '19 at 12:54
  • @MrShemek no it's not like that here. We either can create a docker image or add pre-build-hooks, but currently, I am not getting the exact right way. Thanks for the support thou :) – Anshul Riyal Mar 29 '19 at 12:57
  • You will have to update the version of Bundler in the image that is being used to perform the s2i builds. If you are using an image generated by someone else you will either have to create your own image or use the version of Bundler that is in that image when doing development. In this case this seems like a harmless warning that can probably be ignored. – Nick Mar 29 '19 at 13:16
  • @Nick thanks for the help. Can ypou please look into this ` Installing application source ... mv: cannot move '/tmp/src/bin' to './bin': File exists` – Anshul Riyal Apr 01 '19 at 08:10

1 Answers1

1

Typically, running an out-of-date bundler will not cause any issues, so you should be able to safely ignore the Warning.

However, if you must update the version of bundler for some reason, you should use an .s2i/bin/assemble script to update the version of bundler prior to the default build process. So something similar to

#!/bin/bash -e
# The assemble script builds the application artifacts from source and
# places them into appropriate directories inside the image.

echo "---> Updating bundler gem..."
gem install bundler

# Execute the default S2I script
source ${STI_SCRIPTS_PATH}/assemble

should do the trick. If you add this to your repository in the .s2i/bin directory as an executable assemble script (definition don't forget to chmod +x assemble before adding this to your repository), this should take care of the issue for you.

You can also see the default Ruby 2.5 assemble script in the sclorg GitHub repo: https://github.com/sclorg/s2i-ruby-container/blob/master/2.5/s2i/bin/assemble. Just change the version in the URL as needed in case your curious.

Will Gordon
  • 3,303
  • 2
  • 11
  • 22
  • ---> Installing application source ... mv: cannot move '/tmp/src/bin' to './bin': File exists @Will Gordon – Anshul Riyal Apr 01 '19 at 07:27
  • i have to paste complete script file to my assembly and need to install bundle update after installing source application mv command.. What can i do to not copy all script and make it more optimized – Anshul Riyal Apr 01 '19 at 13:47
  • @AnshulEnbake, I'm actually not able to induce the same error that you're seeing. What version of Ruby are you using? Maybe it's an issue in the older Ruby s2i images. – Will Gordon Apr 04 '19 at 17:24
  • @AnshulEnbake Try something like what I put together in https://github.com/wgordon17/ruby-ex/blob/master/.s2i/bin/assemble. The `--bindir` should help keep the current directory empty to ensure that the `mv` command succeeds. Also note that if the Bundler version in `Gemfile.lock` isn't 2.X yet, that you need to specify the `$BUNDLER_INSTALL_VERSION` environment variable in your build (for my assemble script) – Will Gordon Apr 04 '19 at 18:50
  • Thanks mate for support, i understand what approach you trying to say. **Happy Coding** i'll work on that and make it run.. I'm using latest ruby version where as openshift only provide ruby version till 2.5.3. – Anshul Riyal Apr 05 '19 at 05:11