Skip to content

Commit 220cbc3

Browse files
authored
Fix installing bundler gem for errands on Ruby 3.3 (#617)
1 parent 176cd7f commit 220cbc3

3 files changed

Lines changed: 15 additions & 7 deletions

File tree

jobs/blobstore_benchmark/templates/bpm.yml.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ processes:
33
executable: /var/vcap/jobs/blobstore_benchmark/bin/run
44
args:
55
- run
6+
ephemeral_disk: true
67

jobs/rotate_cc_database_key/templates/bpm.yml.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ processes:
44
executable: /var/vcap/jobs/rotate_cc_database_key/bin/run
55
args:
66
- run
7+
ephemeral_disk: true

shared_job_templates/ruby_version.sh.erb

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,18 @@ CC_PACKAGE_DIR="${BOSH_PACKAGES_DIR:-/var/vcap/packages}/cloud_controller_ng"
55
BUNDLER_VERSION=$(grep "BUNDLED WITH" ${CC_PACKAGE_DIR}/cloud_controller_ng/Gemfile.lock -A 1 | grep -v "BUNDLED" | awk '{print $1}')
66

77
# Install the vendored bundler if it's not already installed
8-
# Use a lock file to avoid concurrent installations
9-
BUNDLER_LOCK_FILE="/var/vcap/sys/run/bundler_install.lock"
10-
mkdir -p "$(dirname $BUNDLER_LOCK_FILE)"
11-
(
12-
flock -x 200
13-
if ! gem list -i bundler -v $BUNDLER_VERSION > /dev/null 2>&1; then
8+
if ! gem list -i bundler -v $BUNDLER_VERSION > /dev/null 2>&1; then
9+
# Use a lock file to avoid concurrent installations (for colocated jobs).
10+
# Skip locking if /var/vcap/sys/run isn't available (e.g., dedicated errand VMs).
11+
BUNDLER_LOCK_FILE="/var/vcap/sys/run/bundler_install.lock"
12+
if [[ -d "$(dirname $BUNDLER_LOCK_FILE)" ]]; then
13+
(
14+
flock -x 200
15+
if ! gem list -i bundler -v $BUNDLER_VERSION > /dev/null 2>&1; then
16+
gem install --local ${CC_PACKAGE_DIR}/cloud_controller_ng/vendor/cache/bundler-${BUNDLER_VERSION}.gem
17+
fi
18+
) 200>$BUNDLER_LOCK_FILE
19+
else
1420
gem install --local ${CC_PACKAGE_DIR}/cloud_controller_ng/vendor/cache/bundler-${BUNDLER_VERSION}.gem
1521
fi
16-
) 200>$BUNDLER_LOCK_FILE
22+
fi

0 commit comments

Comments
 (0)