-
-
Notifications
You must be signed in to change notification settings - Fork 538
457 lines (433 loc) · 19.6 KB
/
Copy pathupdate_lockfiles.yml
File metadata and controls
457 lines (433 loc) · 19.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
name: Update lockfiles
# Generates one committed, checksummed lockfile per test-matrix cell so that CI
# installs are fully pinned (supply-chain hardening). Run manually to create the
# initial lockfiles, and on a schedule to refresh them deliberately.
#
# Each gen-<gem> job MUST keep its matrix in sync with that gem's *_test.yml
# workflow (minus `options`/RUBYOPT, which don't change dependency resolution).
# When a test matrix changes, mirror it here or the frozen install will fail for
# the missing cell.
on:
workflow_dispatch:
schedule:
# Weekly: refresh pins so we keep getting security patches.
- cron: "0 4 * * 1"
permissions:
contents: write
jobs:
# Keep in sync with the matrix in tests.yml
ruby-versions:
uses: ruby/actions/.github/workflows/ruby_versions.yml@6d15c16f6259d657961bcdccf2598d3d53e90635
with:
engine: cruby-jruby
min_version: 2.7
versions: '["jruby-9.4.14.0"]'
gen-sentry-ruby:
needs: ruby-versions
name: lock sentry-ruby ${{ matrix.ruby_version }} / rack ${{ matrix.rack_version }} / redis ${{ matrix.redis_rb_version }}
runs-on: ubuntu-latest
timeout-minutes: 15
defaults:
run:
working-directory: sentry-ruby
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/sentry-ruby/gemfiles/ruby-${{ matrix.ruby_version }}_rack-${{ matrix.rack_version }}_redis-${{ matrix.redis_rb_version }}.gemfile
RACK_VERSION: ${{ matrix.rack_version }}
REDIS_RB_VERSION: ${{ matrix.redis_rb_version }}
strategy:
fail-fast: false
# Keep in sync with the matrix in sentry_ruby_test.yml.
matrix:
ruby_version: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
rack_version: [2.0, 3.0, 3.1]
redis_rb_version: [4.0]
include:
- { ruby_version: 3.2, rack_version: 0, redis_rb_version: 5.0 }
- { ruby_version: 3.2, rack_version: 2.0, redis_rb_version: 5.0 }
- { ruby_version: 3.2, rack_version: 3.0, redis_rb_version: 5.0 }
- { ruby_version: 3.2, rack_version: 3.0, redis_rb_version: 4.0 }
- { ruby_version: 3.3, rack_version: 3.1, redis_rb_version: 5.3 }
- { ruby_version: 3.4, rack_version: 3.1, redis_rb_version: 5.3 }
exclude:
- ruby_version: 'jruby'
- ruby_version: 'jruby-head'
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
# Wrapper keys the lock to this cell (<cell>.gemfile -> <cell>.gemfile.lock).
# Must exist before setup-ruby, which errors if BUNDLE_GEMFILE points at a missing file.
- name: Write wrapper gemfile
run: |
mkdir -p gemfiles
echo 'eval_gemfile "../Gemfile"' > "$BUNDLE_GEMFILE"
- uses: ruby/setup-ruby@319994f95fa847cf3fb3cd3dbe89f6dcde9f178f # v1
with:
ruby-version: ${{ matrix.ruby_version }}
bundler: latest
bundler-cache: false
- name: Resolve lockfile
run: |
bundle lock --update
# Checksums need Bundler >= 2.5 (Ruby >= 3.0); older Rubies get version pinning only.
bundle lock --add-checksums || echo "::warning::--add-checksums unsupported on $(bundle --version); version pinning only for ${{ matrix.ruby_version }}"
- uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
with:
name: lock-sentry-ruby-${{ matrix.ruby_version }}-${{ matrix.rack_version }}-${{ matrix.redis_rb_version }}
# Leading wildcard keeps the repo-relative path (sentry-ruby/gemfiles/...)
# inside the artifact. Only the lock is committed; the wrapper .gemfile is
# regenerated on the fly wherever it's needed.
path: "*/gemfiles/ruby-${{ matrix.ruby_version }}_rack-${{ matrix.rack_version }}_redis-${{ matrix.redis_rb_version }}.gemfile.lock"
if-no-files-found: error
gen-sentry-rails:
needs: ruby-versions
name: lock sentry-rails ${{ matrix.ruby_version }} / rails ${{ matrix.rails_version }}
runs-on: ubuntu-latest
timeout-minutes: 15
defaults:
run:
working-directory: sentry-rails
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/sentry-rails/gemfiles/ruby-${{ matrix.ruby_version }}_rails-${{ matrix.rails_version }}.gemfile
RAILS_VERSION: ${{ matrix.rails_version }}
strategy:
fail-fast: false
# Keep in sync with the matrix in sentry_rails_test.yml.
matrix:
ruby_version: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
rails_version: [6.1.0, 7.0.0, 7.1.0]
include:
- { ruby_version: "2.7", rails_version: 5.2.0 }
- { ruby_version: "2.7", rails_version: 6.0.0 }
- { ruby_version: "3.1", rails_version: 7.2.0 }
- { ruby_version: "3.2", rails_version: 7.2.0 }
- { ruby_version: "3.3", rails_version: 7.2.0 }
- { ruby_version: "3.4", rails_version: 7.2.0 }
- { ruby_version: "3.2", rails_version: "8.0.0" }
- { ruby_version: "3.3", rails_version: "8.0.0" }
- { ruby_version: "3.4", rails_version: "8.0.0" }
- { ruby_version: "4.0", rails_version: "8.0.0" }
- { ruby_version: "3.4", rails_version: "8.1.3" }
- { ruby_version: "4.0", rails_version: "8.1.3" }
- { ruby_version: "3.2", rails_version: 7.1.0 }
exclude:
- ruby_version: head
- ruby_version: jruby-head
- { ruby_version: "3.4", rails_version: "6.1.0" }
- { ruby_version: "3.4", rails_version: "7.0.0" }
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
# Wrapper keys the lock to this cell (<cell>.gemfile -> <cell>.gemfile.lock).
# Must exist before setup-ruby, which errors if BUNDLE_GEMFILE points at a missing file.
- name: Write wrapper gemfile
run: |
mkdir -p gemfiles
echo 'eval_gemfile "../Gemfile"' > "$BUNDLE_GEMFILE"
- uses: ruby/setup-ruby@319994f95fa847cf3fb3cd3dbe89f6dcde9f178f # v1
with:
ruby-version: ${{ matrix.ruby_version }}
bundler: latest
bundler-cache: false
- name: Resolve lockfile
run: |
bundle lock --update
bundle lock --add-checksums || echo "::warning::--add-checksums unsupported on $(bundle --version); version pinning only for ${{ matrix.ruby_version }}"
- uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
with:
name: lock-sentry-rails-${{ matrix.ruby_version }}-${{ matrix.rails_version }}
path: "*/gemfiles/ruby-${{ matrix.ruby_version }}_rails-${{ matrix.rails_version }}.gemfile.lock"
if-no-files-found: error
gen-sentry-sidekiq:
needs: ruby-versions
name: lock sentry-sidekiq ${{ matrix.ruby_version }} / sidekiq ${{ matrix.sidekiq_version }}
runs-on: ubuntu-latest
timeout-minutes: 15
defaults:
run:
working-directory: sentry-sidekiq
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/sentry-sidekiq/gemfiles/ruby-${{ matrix.ruby_version }}_sidekiq-${{ matrix.sidekiq_version }}.gemfile
SIDEKIQ_VERSION: ${{ matrix.sidekiq_version }}
strategy:
fail-fast: false
# Keep in sync with the matrix in sentry_sidekiq_test.yml.
matrix:
ruby_version: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
sidekiq_version: ["5.0", "6.5", "7.0"]
include:
- { ruby_version: jruby-9.4.14.0, sidekiq_version: 5.0 }
- { ruby_version: jruby-9.4.14.0, sidekiq_version: 6.0 }
- { ruby_version: jruby-9.4.14.0, sidekiq_version: 7.0 }
- { ruby_version: "3.2", sidekiq_version: 8.0.0 }
- { ruby_version: "3.3", sidekiq_version: 8.0.0 }
- { ruby_version: "3.4", sidekiq_version: 8.0.0 }
exclude:
- ruby_version: head
- ruby_version: jruby
- ruby_version: jruby-head
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
# Wrapper keys the lock to this cell (<cell>.gemfile -> <cell>.gemfile.lock).
# Must exist before setup-ruby, which errors if BUNDLE_GEMFILE points at a missing file.
- name: Write wrapper gemfile
run: |
mkdir -p gemfiles
echo 'eval_gemfile "../Gemfile"' > "$BUNDLE_GEMFILE"
- uses: ruby/setup-ruby@319994f95fa847cf3fb3cd3dbe89f6dcde9f178f # v1
with:
ruby-version: ${{ matrix.ruby_version }}
bundler: latest
bundler-cache: false
- name: Resolve lockfile
run: |
bundle lock --update
bundle lock --add-checksums || echo "::warning::--add-checksums unsupported on $(bundle --version); version pinning only for ${{ matrix.ruby_version }}"
- uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
with:
name: lock-sentry-sidekiq-${{ matrix.ruby_version }}-${{ matrix.sidekiq_version }}
path: "*/gemfiles/ruby-${{ matrix.ruby_version }}_sidekiq-${{ matrix.sidekiq_version }}.gemfile.lock"
if-no-files-found: error
gen-sentry-resque:
needs: ruby-versions
name: lock sentry-resque ${{ matrix.ruby_version }}
runs-on: ubuntu-latest
timeout-minutes: 15
defaults:
run:
working-directory: sentry-resque
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/sentry-resque/gemfiles/ruby-${{ matrix.ruby_version }}.gemfile
strategy:
fail-fast: false
# Keep in sync with the matrix in sentry_resque_test.yml.
matrix:
ruby_version: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
exclude:
- ruby_version: 'jruby'
- ruby_version: 'jruby-head'
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
# Wrapper keys the lock to this cell (<cell>.gemfile -> <cell>.gemfile.lock).
# Must exist before setup-ruby, which errors if BUNDLE_GEMFILE points at a missing file.
- name: Write wrapper gemfile
run: |
mkdir -p gemfiles
echo 'eval_gemfile "../Gemfile"' > "$BUNDLE_GEMFILE"
- uses: ruby/setup-ruby@319994f95fa847cf3fb3cd3dbe89f6dcde9f178f # v1
with:
ruby-version: ${{ matrix.ruby_version }}
bundler: latest
bundler-cache: false
- name: Resolve lockfile
run: |
bundle lock --update
bundle lock --add-checksums || echo "::warning::--add-checksums unsupported on $(bundle --version); version pinning only for ${{ matrix.ruby_version }}"
- uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
with:
name: lock-sentry-resque-${{ matrix.ruby_version }}
path: "*/gemfiles/ruby-${{ matrix.ruby_version }}.gemfile.lock"
if-no-files-found: error
gen-sentry-delayed_job:
needs: ruby-versions
name: lock sentry-delayed_job ${{ matrix.ruby_version }}
runs-on: ubuntu-latest
timeout-minutes: 15
defaults:
run:
working-directory: sentry-delayed_job
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/sentry-delayed_job/gemfiles/ruby-${{ matrix.ruby_version }}.gemfile
strategy:
fail-fast: false
# Keep in sync with the matrix in sentry_delayed_job_test.yml.
matrix:
ruby_version: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
exclude:
- ruby_version: head
- ruby_version: jruby-head
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
# Wrapper keys the lock to this cell (<cell>.gemfile -> <cell>.gemfile.lock).
# Must exist before setup-ruby, which errors if BUNDLE_GEMFILE points at a missing file.
- name: Write wrapper gemfile
run: |
mkdir -p gemfiles
echo 'eval_gemfile "../Gemfile"' > "$BUNDLE_GEMFILE"
- uses: ruby/setup-ruby@319994f95fa847cf3fb3cd3dbe89f6dcde9f178f # v1
with:
ruby-version: ${{ matrix.ruby_version }}
bundler: latest
bundler-cache: false
- name: Resolve lockfile
run: |
bundle lock --update
bundle lock --add-checksums || echo "::warning::--add-checksums unsupported on $(bundle --version); version pinning only for ${{ matrix.ruby_version }}"
- uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
with:
name: lock-sentry-delayed_job-${{ matrix.ruby_version }}
path: "*/gemfiles/ruby-${{ matrix.ruby_version }}.gemfile.lock"
if-no-files-found: error
gen-sentry-opentelemetry:
needs: ruby-versions
name: lock sentry-opentelemetry ${{ matrix.ruby_version }}
runs-on: ubuntu-latest
timeout-minutes: 15
defaults:
run:
working-directory: sentry-opentelemetry
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/sentry-opentelemetry/gemfiles/ruby-${{ matrix.ruby_version }}.gemfile
strategy:
fail-fast: false
# Keep in sync with the matrix in sentry_opentelemetry_test.yml.
matrix:
ruby_version: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
exclude:
- ruby_version: 'jruby-head'
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
# Wrapper keys the lock to this cell (<cell>.gemfile -> <cell>.gemfile.lock).
# Must exist before setup-ruby, which errors if BUNDLE_GEMFILE points at a missing file.
- name: Write wrapper gemfile
run: |
mkdir -p gemfiles
echo 'eval_gemfile "../Gemfile"' > "$BUNDLE_GEMFILE"
- uses: ruby/setup-ruby@319994f95fa847cf3fb3cd3dbe89f6dcde9f178f # v1
with:
ruby-version: ${{ matrix.ruby_version }}
bundler: latest
bundler-cache: false
- name: Resolve lockfile
run: |
bundle lock --update
bundle lock --add-checksums || echo "::warning::--add-checksums unsupported on $(bundle --version); version pinning only for ${{ matrix.ruby_version }}"
- uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
with:
name: lock-sentry-opentelemetry-${{ matrix.ruby_version }}
path: "*/gemfiles/ruby-${{ matrix.ruby_version }}.gemfile.lock"
if-no-files-found: error
gen-sentry-yabeda:
needs: ruby-versions
name: lock sentry-yabeda ${{ matrix.ruby_version }}
runs-on: ubuntu-latest
timeout-minutes: 15
defaults:
run:
working-directory: sentry-yabeda
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/sentry-yabeda/gemfiles/ruby-${{ matrix.ruby_version }}.gemfile
strategy:
fail-fast: false
# Keep in sync with the matrix in sentry_yabeda_test.yml.
matrix:
ruby_version: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
exclude:
- ruby_version: 'jruby'
- ruby_version: 'jruby-head'
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
# Wrapper keys the lock to this cell (<cell>.gemfile -> <cell>.gemfile.lock).
# Must exist before setup-ruby, which errors if BUNDLE_GEMFILE points at a missing file.
- name: Write wrapper gemfile
run: |
mkdir -p gemfiles
echo 'eval_gemfile "../Gemfile"' > "$BUNDLE_GEMFILE"
- uses: ruby/setup-ruby@319994f95fa847cf3fb3cd3dbe89f6dcde9f178f # v1
with:
ruby-version: ${{ matrix.ruby_version }}
bundler: latest
bundler-cache: false
- name: Resolve lockfile
run: |
bundle lock --update
bundle lock --add-checksums || echo "::warning::--add-checksums unsupported on $(bundle --version); version pinning only for ${{ matrix.ruby_version }}"
- uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
with:
name: lock-sentry-yabeda-${{ matrix.ruby_version }}
path: "*/gemfiles/ruby-${{ matrix.ruby_version }}.gemfile.lock"
if-no-files-found: error
commit:
needs:
- gen-sentry-ruby
- gen-sentry-rails
- gen-sentry-sidekiq
- gen-sentry-resque
- gen-sentry-delayed_job
- gen-sentry-opentelemetry
- gen-sentry-yabeda
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
# Each artifact carries its repo-relative path, so merging them straight into
# the workspace lands every pair back at <gem>/gemfiles/ — no routing.
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
merge-multiple: true
- name: Configure git
run: |
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
- name: Create branch
id: create-branch
run: |
# Stage first, then diff the index against HEAD. `git diff` alone only
# sees tracked files, so newly generated (untracked) pairs — i.e. the
# bootstrap run and any filled-in missing cell — would otherwise look
# like "no change" and never get pushed.
git add '**/gemfiles/*.gemfile.lock'
if git diff --cached --quiet; then
echo "No lockfile changes; nothing to do."
echo "changed=false" >> "$GITHUB_OUTPUT"
exit 0
fi
COMMIT_TITLE="ci: 🤖 Update pinned CI lockfiles"
BRANCH_NAME="lockfiles/update-$(date +%m-%d)"
git checkout -B "$BRANCH_NAME"
git commit -m "$COMMIT_TITLE"
git push origin "$BRANCH_NAME" --force
echo "changed=true" >> "$GITHUB_OUTPUT"
echo "branch_name=$BRANCH_NAME" >> "$GITHUB_OUTPUT"
echo "commit_title=$COMMIT_TITLE" >> "$GITHUB_OUTPUT"
- name: Create pull request
if: steps.create-branch.outputs.changed == 'true'
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
BRANCH_NAME: ${{ steps.create-branch.outputs.branch_name }}
COMMIT_TITLE: ${{ steps.create-branch.outputs.commit_title }}
with:
script: |
const branchName = process.env.BRANCH_NAME;
const commitTitle = process.env.COMMIT_TITLE;
const prBody = `Automated regeneration of the per-matrix lockfiles used to pin CI dependencies (supply-chain hardening).
#skip-changelog
## Action required
- If CI passes on this PR, it's safe to approve and merge: the refreshed pins resolve and the suite is green.
- If CI fails, a dependency update broke something — investigate before merging.
_🤖 This PR was automatically created by [.github/workflows/update_lockfiles.yml](https://github.com/getsentry/sentry-ruby/blob/master/.github/workflows/update_lockfiles.yml)._`.replace(/^ {12}/gm, '');
// Close stale lockfile PRs — they're now obsolete.
const existingPRs = await github.paginate(github.rest.pulls.list, {
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
});
for (const pr of existingPRs) {
if (pr.head.ref.startsWith('lockfiles/')) {
await github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr.number,
state: 'closed',
});
}
}
await github.rest.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: commitTitle,
head: branchName,
base: 'master',
body: prBody,
});