Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/read-only.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: read-only

on:
pull_request:

push:
branches:
- master

concurrency:
group: ci-${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

permissions: # added using https://github.com/step-security/secure-workflows
contents: read

defaults:
run:
shell: bash

jobs:
read-only:
name: Bundler on read-only system (${{ matrix.ruby.name }})
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
ruby:
- { name: ruby-3.1, value: 3.1.6 }
- { name: ruby-3.2, value: 3.2.6 }
- { name: ruby-3.3, value: 3.3.6 }
- { name: ruby-3.4, value: 3.4.1 }

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Basic usage on a read-only filesystem
run: docker run --mount type=bind,source=.,target=/rubygems --rm --read-only ruby:${{ matrix.ruby.value }} ruby -I/rubygems/bundler/lib -r'bundler/inline' -e 'gemfile {}; puts :ok'

timeout-minutes: 15
4 changes: 4 additions & 0 deletions bundler/lib/bundler/plugin/index.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ def initialize
rescue GenericSystemCallError
# no need to fail when on a read-only FS, for example
nil
rescue ArgumentError => e
# ruby 3.4 checks writability in Dir.tmpdir
raise unless e.message&.include?("could not find a temporary directory")
nil
end
load_index(local_index_file) if SharedHelpers.in_bundle?
end
Expand Down
8 changes: 0 additions & 8 deletions bundler/spec/bundler/plugin/index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,4 @@
include_examples "it cleans up"
end
end

describe "readonly disk without home" do
it "ignores being unable to create temp home dir" do
expect_any_instance_of(Bundler::Plugin::Index).to receive(:global_index_file).
and_raise(Bundler::GenericSystemCallError.new("foo", "bar"))
Bundler::Plugin::Index.new
end
end
end