21700: Standardize on Bundler~>2.4.0
authorBrett Smith <brett.smith@curii.com>
Fri, 19 Apr 2024 16:05:18 +0000 (12:05 -0400)
committerBrett Smith <brett.smith@curii.com>
Sat, 20 Apr 2024 13:12:19 +0000 (09:12 -0400)
These are the last versions to support Ruby 2.7, which we're still
supporting as I write this.

Our usual install recipe is:

  gem install --conservative --version '~> 2.4.0' bundler

In environments where we *know* we have Ruby 3, that becomes:

  gem install --conservative --version '>= 2.4.0' bundler

As long as we have something at least as recent as 2.4.0, that should be
enough for function. This recipe meets our functional needs while
striking a balance between being easy to implement and avoiding
redundant installs.

Arvados-DCO-1.1-Signed-off-by: Brett Smith <brett.smith@curii.com>

14 files changed:
build/package-build-dockerfiles/debian11/Dockerfile
build/package-build-dockerfiles/debian12/Dockerfile
build/package-build-dockerfiles/rocky8/Dockerfile
build/package-build-dockerfiles/ubuntu2004/Dockerfile
build/package-build-dockerfiles/ubuntu2204/Dockerfile
build/package-test-dockerfiles/debian11/Dockerfile
build/package-test-dockerfiles/debian12/Dockerfile
build/package-test-dockerfiles/rocky8/Dockerfile
build/package-test-dockerfiles/ubuntu2004/Dockerfile
build/package-test-dockerfiles/ubuntu2204/Dockerfile
build/rails-package-scripts/postinst.sh
build/run-tests.sh
lib/boot/passenger.go
lib/install/deps.go

index 762e4d2335859263d920fb3864187a1adac32728..e5b4b07b988e930cbbfffc4a2456a8f2e4a8a0dd 100644 (file)
@@ -68,7 +68,7 @@ RUN /usr/bin/apt-get update && /usr/bin/apt-get install -q -y \
 # fpm depends on dotenv, but version 3.0 of that gem dropped support for
 # Ruby 2.7, so we need to specifically install an older version.
 RUN echo "gem: --no-document" >> ~/.gemrc && \
-    gem install bundler --version 2.2.19 && \
+    gem install --conservative --version '~> 2.4.0' bundler && \
     gem install dotenv --version '~> 2.8' && \
     gem install fpm --version 1.15.1 && \
     bundle config --global jobs $(let a=$(grep -c processor /proc/cpuinfo )-1; echo $a)
index 17f2218d0dcefa6d197270e392455fea58f281a0..738c9d946fd813b41b44f4c7e83e4de6bdd188f8 100644 (file)
@@ -64,7 +64,7 @@ RUN /usr/bin/apt-get update && /usr/bin/apt-get install -q -y \
     unzip
 
 RUN echo "gem: --no-document" >> ~/.gemrc && \
-    gem install bundler --version 2.2.19 && \
+    gem install --conservative --version '>= 2.4.0' bundler && \
     gem install fpm --version 1.15.1 && \
     bundle config --global jobs $(let a=$(grep -c processor /proc/cpuinfo )-1; echo $a)
 
index 8a9ac4c97b391bd5e9b3d240154d0e956cf373af..38dd5fdbcc38470046e8c9716e3c4257209a37ee 100644 (file)
@@ -74,7 +74,7 @@ RUN microdnf --assumeyes module enable ruby:3.1 \
 # fpm depends on dotenv, but version 3.0 of that gem dropped support for
 # Ruby 2.7, so we need to specifically install an older version.
 RUN echo "gem: --no-document" >> ~/.gemrc && \
-    gem install bundler --version 2.2.19 && \
+    gem install --conservative --version '>= 2.4.0' bundler && \
     gem install dotenv --version '~> 2.8' && \
     gem install fpm --version 1.15.1 && \
     bundle config --global jobs $(let a=$(grep -c processor /proc/cpuinfo )-1; echo $a)
index aecc138a48782a284e1fef927b32b136c4c0c133..c7c9bb791d2294cca3d4c90d9098c7ba6ca819ec 100644 (file)
@@ -74,7 +74,7 @@ RUN /usr/bin/apt-get update && /usr/bin/apt-get install -q -y \
 # fpm depends on dotenv, but version 3.0 of that gem dropped support for
 # Ruby 2.7, so we need to specifically install an older version.
 RUN echo "gem: --no-document" >> ~/.gemrc && \
-    gem install bundler --version 2.2.19 && \
+    gem install --conservative --version '~> 2.4.0' bundler && \
     gem install dotenv --version '~> 2.8' && \
     gem install fpm --version 1.15.1 && \
     bundle config --global jobs $(let a=$(grep -c processor /proc/cpuinfo )-1; echo $a)
index f8ea8b33f4d23e3a9a5f99a9b15c751315801768..a0ef1c686f808dac54a594e0041b9afb53c08e81 100644 (file)
@@ -66,7 +66,7 @@ RUN /usr/bin/apt-get update && /usr/bin/apt-get install -q -y \
     unzip
 
 RUN echo "gem: --no-document" >> ~/.gemrc && \
-    gem install bundler --version 2.2.19 && \
+    gem install --conservative --version '>= 2.4.0' bundler && \
     gem install fpm --version 1.15.1 && \
     bundle config --global jobs $(let a=$(grep -c processor /proc/cpuinfo )-1; echo $a)
 
index 4c3f892587c8b703824de50820bee55c8ba49932..cd57ffde621757a7a929a938264500b8d4a31acd 100644 (file)
@@ -11,6 +11,6 @@ ENV DEBIAN_FRONTEND noninteractive
 RUN apt-get update && \
     apt-get -y install --no-install-recommends curl ca-certificates gpg procps gpg-agent ruby ruby-dev && \
     echo "gem: --no-document" >> /etc/gemrc && \
-    gem install bundler --version 2.2.19 && \
+    gem install --conservative --version '~> 2.4.0' bundler && \
     mkdir -p /etc/udev/disabled && \
     echo "deb file:///arvados/packages/debian11/ /" >>/etc/apt/sources.list
index 7c3ee1292d6d2f8f093d13843e0c0869bbb1be47..6cc700d742f03b92e428c2e64e8489a2d396a8e8 100644 (file)
@@ -11,6 +11,6 @@ ENV DEBIAN_FRONTEND noninteractive
 RUN apt-get update && \
     apt-get -y install --no-install-recommends curl ca-certificates gpg procps gpg-agent ruby ruby-dev && \
     echo "gem: --no-document" >> /etc/gemrc && \
-    gem install bundler --version 2.2.19 && \
+    gem install --conservative --version '>= 2.4.0' bundler && \
     mkdir -p /etc/udev/disabled && \
     echo "deb file:///arvados/packages/debian12/ /" >>/etc/apt/sources.list
index ace3c7c57297c3844f69f7763814160a998fdd61..7938d7d4217dbc83415fb6106fae34b487d91007 100644 (file)
@@ -40,6 +40,6 @@ RUN microdnf --assumeyes module enable ruby:3.1 \
 
 RUN touch /var/lib/rpm/* && \
     echo "gem: --no-document" >> ~/.gemrc && \
-    gem install bundler --version 2.2.19
+    gem install --conservative --version '>= 2.4.0' bundler
 
 COPY localrepo.repo /etc/yum.repos.d/localrepo.repo
index bffef5eb6319e13c16d6de3cf50bad4d588eb4d4..c996a8b9720ae3933c80a86ad6be93fdd06b57b6 100644 (file)
@@ -10,6 +10,6 @@ ENV DEBIAN_FRONTEND noninteractive
 # Install dependencies
 RUN apt-get update && \
     apt-get -y install --no-install-recommends curl ca-certificates gnupg2 ruby ruby-dev && \
-    gem install bundler --version 2.2.19 && \
+    gem install --conservative --version '~> 2.4.0' bundler && \
     mkdir -p /etc/udev/disabled && \
     echo "deb [trusted=yes] file:///arvados/packages/ubuntu2004/ /" >>/etc/apt/sources.list
index 2c71f4ffcbd5b2b6db8fd712c585141b2eacfb39..01a0496284ba2d855261bfddaaa88f01d8a908da 100644 (file)
@@ -10,6 +10,6 @@ ENV DEBIAN_FRONTEND noninteractive
 # Install dependencies
 RUN apt-get update && \
     apt-get -y install --no-install-recommends curl ca-certificates gnupg2 ruby ruby-dev && \
-    gem install bundler --version 2.2.19 && \
+    gem install --conservative --version '>= 2.4.0' bundler && \
     mkdir -p /etc/udev/disabled && \
     echo "deb [trusted=yes] file:///arvados/packages/ubuntu2204/ /" >>/etc/apt/sources.list
index c8326067856b32ed24e6482019fd6f443c50f0c0..b72347aca3acda52308eaf78eee2de12b889627d 100644 (file)
@@ -192,9 +192,7 @@ configure_version() {
   cd "$RELEASE_PATH"
   export RAILS_ENV=production
 
-  if ! bundle --version >/dev/null 2>&1; then
-      run_and_report "Installing bundler" gem install bundler --version 2.2.19 --no-document
-  fi
+  run_and_report "Installing bundler" gem install --conservative --version '~> 2.4.0' bundler
 
   run_and_report "Running bundle config set --local path $SHARED_PATH/vendor_bundle" \
                  bundle config set --local path "$SHARED_PATH/vendor_bundle"
index 90dc700b10262d7505e15d5eac6ca085bd38ac88..7089fb8668d22a7184903a51a3a9b2280aef5236 100755 (executable)
@@ -490,17 +490,8 @@ setup_ruby_environment() {
     echo "Will install dependencies to $(gem env gemdir)"
     echo "Will install bundler and arvados gems to $tmpdir_gem_home"
     echo "Gem search path is GEM_PATH=$GEM_PATH"
-    (
-        export HOME=$GEMHOME
-        versions=(2.2.19)
-        for v in ${versions[@]}; do
-            if ! gem list --installed --version "${v}" bundler >/dev/null; then
-                gem install --no-document --user $(for v in ${versions[@]}; do echo bundler:${v}; done)
-                break
-            fi
-        done
-        "$bundle" version | tee /dev/stderr | grep -q 'version 2'
-    ) || fatal 'install bundler'
+    gem install --user --no-document --conservative --version '~> 2.4.0' bundler \
+        || fatal 'install bundler'
        if test -d /var/lib/arvados-arvbox/ ; then
            # Inside arvbox, use bundler-installed binstubs.  The
            # system bundler and rail's own bin/bundle refuse to work.
index 5367337e81a1d0e605160c9c0dd789c9282a21f2..bf2ca2a78b5c25e8f5652e51ae7260040af98b3c 100644 (file)
@@ -84,14 +84,9 @@ func (runner installPassenger) Run(ctx context.Context, fail func(error), super
        if err != nil {
                return err
        }
-       for _, version := range []string{"2.2.19"} {
-               if !strings.Contains(buf.String(), "("+version+")") {
-                       err = super.RunProgram(ctx, appdir, runOptions{}, "gem", "install", "--user", "--conservative", "--no-document", "bundler:2.2.19")
-                       if err != nil {
-                               return err
-                       }
-                       break
-               }
+       err = super.RunProgram(ctx, appdir, runOptions{}, "gem", "install", "--user", "--conservative", "--no-document", "--version", "~> 2.4.0", "bundler")
+       if err != nil {
+               return err
        }
        err = super.RunProgram(ctx, appdir, runOptions{}, "bundle", "config", "--set", "local", "path", filepath.Join(os.Getenv("HOME"), ".gem"))
        if err != nil {
index 9720a30d26f1283e9ddaae0f1fb7f9ff4b1aba7b..6693e2ee87c853f8c90a5e1d1cb31fb13ce02b45 100644 (file)
@@ -35,7 +35,7 @@ const goversion = "1.20.6"
 
 const (
        defaultRubyVersion        = "3.2.2"
-       defaultBundlerVersion     = "2.2.19"
+       defaultBundlerVersion     = "~> 2.4.0"
        defaultSingularityVersion = "3.10.4"
        pjsversion                = "1.9.8"
        geckoversion              = "0.24.0"
@@ -123,7 +123,7 @@ func (inst *installCommand) RunCommand(prog string, args []string, stdin io.Read
                fmt.Fprintf(stderr, "invalid argument %q for -ruby-version\n", inst.RubyVersion)
                return 2
        }
-       if ok, _ := regexp.MatchString(`^\d`, inst.BundlerVersion); !ok {
+       if ok, _ := regexp.MatchString(`^ *(|~>|[<>!=]=) *\d`, inst.BundlerVersion); !ok {
                fmt.Fprintf(stderr, "invalid argument %q for -bundler-version\n", inst.BundlerVersion)
                return 2
        }
@@ -351,7 +351,7 @@ make install
 if [[ "$rubyversion" > "3" ]]; then
   /var/lib/arvados/bin/gem update --no-document --system 3.4.21
 fi
-/var/lib/arvados/bin/gem install bundler:`+inst.BundlerVersion+` --no-document
+/var/lib/arvados/bin/gem install --conservative --no-docuemnt --version '`+inst.BundlerVersion+`' bundler
 `, stdout, stderr)
                if err != nil {
                        return 1