Skip to content

Commit bf70f15

Browse files
committed
Enforce lifecycle_type on apps, droplets, and builds
1 parent 20fb68b commit bf70f15

34 files changed

Lines changed: 144 additions & 521 deletions

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969

7070
# Initializes the CodeQL tools for scanning.
7171
- name: Initialize CodeQL
72-
uses: github/codeql-action/init@v4.37.8
72+
uses: github/codeql-action/init@v4.37.6
7373
with:
7474
languages: ${{ matrix.language }}
7575
build-mode: ${{ matrix.build-mode }}
@@ -97,6 +97,6 @@ jobs:
9797
exit 1
9898
9999
- name: Perform CodeQL Analysis
100-
uses: github/codeql-action/analyze@v4.37.8
100+
uses: github/codeql-action/analyze@v4.37.6
101101
with:
102102
category: "/language:${{matrix.language}}"

.github/workflows/openapi_breaking_changes.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
yarn build
5656
5757
- name: Check for Breaking Changes
58-
uses: oasdiff/oasdiff-action/breaking@v0.1.13
58+
uses: oasdiff/oasdiff-action/breaking@v0.1.12
5959
with:
6060
base: 'base/docs/openapi/dist/latest/openapi.yaml'
6161
revision: 'pr/docs/openapi/dist/latest/openapi.yaml'

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ gem 'sequel', '~> 5.107'
2626
gem 'sequel_pg', require: 'sequel'
2727
gem 'sinatra', '~> 4.2'
2828
gem 'sinatra-contrib'
29-
gem 'statsd-instrument', '~> 4.0'
29+
gem 'statsd-instrument', '~> 3.11'
3030
gem 'talentbox-delayed_job_sequel', '~> 4.4.0'
3131
gem 'uri', '~> 1.1'
3232

@@ -62,7 +62,7 @@ group :test do
6262
gem 'rubocop', '~> 1.89.0'
6363
gem 'rubocop-capybara'
6464
gem 'rubocop-factory_bot'
65-
gem 'rubocop-rails', '~> 2.37'
65+
gem 'rubocop-rails', '~> 2.36'
6666
gem 'rubocop-rspec', '~> 3.10'
6767
gem 'rubocop-rspec_rails'
6868
gem 'rubocop-sequel', '~> 0.4.1'

Gemfile.lock

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,13 @@ GEM
8484
fluent-logger (0.10.0)
8585
logger (~> 1.6)
8686
msgpack (>= 1.0.0, < 2)
87-
google-protobuf (4.36.0)
87+
google-protobuf (4.35.1)
8888
bigdecimal
8989
rake (~> 13.3)
90-
google-protobuf (4.36.0-x86_64-darwin)
90+
google-protobuf (4.35.1-x86_64-darwin)
9191
bigdecimal
9292
rake (~> 13.3)
93-
google-protobuf (4.36.0-x86_64-linux-gnu)
93+
google-protobuf (4.35.1-x86_64-linux-gnu)
9494
bigdecimal
9595
rake (~> 13.3)
9696
googleapis-common-protos (1.10.0)
@@ -153,12 +153,12 @@ GEM
153153
redis (~> 5)
154154
msgpack (1.8.4)
155155
multi_json (1.21.1)
156-
mustache (1.1.3)
156+
mustache (1.1.2)
157157
mustermann (3.1.1)
158158
mutex_m (0.3.0)
159159
mysql2 (0.5.7)
160160
bigdecimal
161-
newrelic_rpm (10.7.1)
161+
newrelic_rpm (10.7.0)
162162
logger
163163
nio4r (2.7.5)
164164
nokogiri (1.19.4)
@@ -202,14 +202,14 @@ GEM
202202
pry-byebug (3.12.0)
203203
byebug (~> 13.0)
204204
pry (>= 0.13, < 0.17)
205-
psych (5.5.0)
205+
psych (5.4.0)
206206
date
207207
stringio
208208
public_suffix (7.0.5)
209209
puma (8.0.2)
210210
nio4r (~> 2.0)
211211
racc (1.8.1)
212-
rack (3.2.7)
212+
rack (3.2.6)
213213
rack-protection (4.2.1)
214214
base64 (>= 0.1.0)
215215
logger (>= 1.6.0)
@@ -242,7 +242,7 @@ GEM
242242
rb-fsevent (0.11.2)
243243
rb-inotify (0.11.1)
244244
ffi (~> 1.0)
245-
rbs (4.2.0)
245+
rbs (4.1.3)
246246
logger
247247
prism (>= 1.6.0)
248248
tsort
@@ -316,11 +316,11 @@ GEM
316316
rubocop-factory_bot (2.28.0)
317317
lint_roller (~> 1.1)
318318
rubocop (~> 1.72, >= 1.72.1)
319-
rubocop-rails (2.37.0)
319+
rubocop-rails (2.36.0)
320320
activesupport (>= 4.2.0)
321321
lint_roller (~> 1.1)
322322
rack (>= 1.1)
323-
rubocop (>= 1.89.0, < 2.0)
323+
rubocop (>= 1.75.0, < 2.0)
324324
rubocop-ast (>= 1.44.0, < 2.0)
325325
rubocop-rspec (3.10.2)
326326
lint_roller (~> 1.1)
@@ -333,7 +333,7 @@ GEM
333333
rubocop-sequel (0.4.1)
334334
lint_roller (~> 1.1)
335335
rubocop (>= 1.72.1, < 2)
336-
ruby-lsp (0.26.11)
336+
ruby-lsp (0.26.10)
337337
language_server-protocol (~> 3.17.0)
338338
prism (>= 1.2, < 2.0)
339339
rbs (>= 3, < 5)
@@ -343,15 +343,15 @@ GEM
343343
ruby_parser (3.22.0)
344344
racc (~> 1.5)
345345
sexp_processor (~> 4.16)
346-
rubyzip (3.5.0)
346+
rubyzip (3.4.1)
347347
securerandom (0.4.1)
348348
sequel (5.107.0)
349349
bigdecimal
350350
sequel_pg (1.19.0)
351351
pg (>= 0.18.0, != 1.2.0)
352352
sequel (>= 4.38.0)
353353
sexp_processor (4.17.5)
354-
simplecov (1.1.1)
354+
simplecov (1.1.0)
355355
sinatra (4.2.1)
356356
logger (>= 1.6.0)
357357
mustermann (~> 3.0)
@@ -390,7 +390,7 @@ GEM
390390
yard (~> 0.9, >= 0.9.24)
391391
yard-activesupport-concern (~> 0.0)
392392
yard-solargraph (~> 0.1)
393-
sorbet-runtime (0.6.13439)
393+
sorbet-runtime (0.6.13421)
394394
sord (7.1.0)
395395
commander (~> 5.0)
396396
parlour (~> 9.1)
@@ -401,13 +401,13 @@ GEM
401401
spring (4.7.0)
402402
spring-commands-rspec (1.0.4)
403403
spring (>= 0.9.1)
404-
statsd-instrument (4.0.0)
404+
statsd-instrument (3.11.1)
405405
stringio (3.2.0)
406406
talentbox-delayed_job_sequel (4.4.0)
407407
delayed_job (~> 4.1)
408408
sequel (>= 5.0, < 6.0)
409409
thor (1.5.0)
410-
tilt (2.9.0)
410+
tilt (2.8.0)
411411
timecop (0.9.11)
412412
tsort (0.2.0)
413413
tzinfo (2.0.6)
@@ -417,7 +417,7 @@ GEM
417417
unicode-emoji (4.2.0)
418418
uri (1.1.1)
419419
useragent (0.16.11)
420-
webmock (3.26.3)
420+
webmock (3.26.2)
421421
addressable (>= 2.8.0)
422422
crack (>= 0.3.2)
423423
hashdiff (>= 0.4.0, < 2.0.0)
@@ -482,7 +482,7 @@ DEPENDENCIES
482482
rubocop (~> 1.89.0)
483483
rubocop-capybara
484484
rubocop-factory_bot
485-
rubocop-rails (~> 2.37)
485+
rubocop-rails (~> 2.36)
486486
rubocop-rspec (~> 3.10)
487487
rubocop-rspec_rails
488488
rubocop-sequel (~> 0.4.1)
@@ -496,7 +496,7 @@ DEPENDENCIES
496496
solargraph
497497
spring
498498
spring-commands-rspec
499-
statsd-instrument (~> 4.0)
499+
statsd-instrument (~> 3.11)
500500
talentbox-delayed_job_sequel (~> 4.4.0)
501501
timecop
502502
uri (~> 1.1)

app/actions/build_create.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def create_and_stage(package:, lifecycle:, metadata: nil, start_after_staging: f
5454
state: BuildModel::STAGING_STATE,
5555
package_guid: package.guid,
5656
app: package.app,
57+
lifecycle_type: lifecycle.type,
5758
staging_memory_in_mb: staging_details.staging_memory_in_mb,
5859
staging_disk_in_mb: staging_details.staging_disk_in_mb,
5960
staging_log_rate_limit: staging_details.staging_log_rate_limit_bytes_per_second,

app/actions/droplet_copy.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def copy(destination_app, user_audit_info)
2020
raise InvalidCopyError.new('source droplet is not staged') unless @source_droplet.staged?
2121
raise InvalidCopyError.new('source and destination lifecycle types do not match') unless @source_droplet.lifecycle_type == destination_app.lifecycle_type
2222

23-
new_droplet = DropletModel.new(state: DropletModel::COPYING_STATE, app: destination_app)
23+
new_droplet = DropletModel.new(state: DropletModel::COPYING_STATE, app: destination_app, lifecycle_type: destination_app.lifecycle_type)
2424

2525
# Needed to execute serializers and deserializers correctly on source and destination models
2626
CLONED_ATTRIBUTES.each do |attr|

app/actions/droplet_create.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def create(app, message, user_audit_info)
1414
droplet = DropletModel.new(
1515
app: app,
1616
state: DropletModel::AWAITING_UPLOAD_STATE,
17+
lifecycle_type: BuildpackLifecycleDataModel::LIFECYCLE_TYPE,
1718
process_types: message.process_types || DEFAULT_PROCESS_TYPES,
1819
execution_metadata: ''
1920
)
@@ -87,6 +88,7 @@ def droplet_from_build(build)
8788
app: build.app,
8889
package_guid: build.package_guid,
8990
state: DropletModel::STAGING_STATE,
91+
lifecycle_type: build.lifecycle_type,
9092
build: build
9193
)
9294
end

app/controllers/internal/staging_completion_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def droplet_completed(staging_guid)
2222
droplet = DropletModel.find(guid: staging_guid)
2323
raise CloudController::Errors::ApiError.new_from_details('ResourceNotFound', 'Droplet not found') if droplet.nil?
2424

25-
build = BuildModel.create(package: droplet.package, app: droplet.app, state: DropletModel::STAGING_STATE)
25+
build = BuildModel.create(package: droplet.package, app: droplet.app, state: DropletModel::STAGING_STATE, lifecycle_type: droplet.lifecycle_type)
2626

2727
BuildModel.db.transaction do
2828
build.lock!

app/controllers/runtime/apps_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def upload_droplet(guid)
194194

195195
enqueued_job = nil
196196
DropletModel.db.transaction do
197-
droplet = DropletModel.create(app: process.app, state: DropletModel::PROCESSING_UPLOAD_STATE)
197+
droplet = DropletModel.create(app: process.app, state: DropletModel::PROCESSING_UPLOAD_STATE, lifecycle_type: BuildpackLifecycleDataModel::LIFECYCLE_TYPE)
198198
BuildpackLifecycleDataModel.create(droplet:)
199199

200200
droplet_upload_job = Jobs::V2::UploadDropletFromUser.new(droplet_path, droplet.guid)

app/fetchers/app_list_fetcher.rb

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,32 +33,7 @@ def filter(message, dataset)
3333
dataset = dataset.where(guid: buildpack_lifecycle_data_dataset.select(:app_guid))
3434
end
3535

36-
if message.requested?(:lifecycle_type)
37-
case message.lifecycle_type
38-
when BuildpackLifecycleDataModel::LIFECYCLE_TYPE
39-
dataset = dataset.where(
40-
guid: BuildpackLifecycleDataModel.
41-
where(Sequel.~(app_guid: nil)).
42-
select(:app_guid)
43-
)
44-
when DockerLifecycleDataModel::LIFECYCLE_TYPE
45-
dataset = dataset.exclude(
46-
guid: BuildpackLifecycleDataModel.
47-
where(Sequel.~(app_guid: nil)).
48-
select(:app_guid)
49-
).exclude(
50-
guid: CNBLifecycleDataModel.
51-
where(Sequel.~(app_guid: nil)).
52-
select(:app_guid)
53-
)
54-
when CNBLifecycleDataModel::LIFECYCLE_TYPE
55-
dataset = dataset.where(
56-
guid: CNBLifecycleDataModel.
57-
where(Sequel.~(app_guid: nil)).
58-
select(:app_guid)
59-
)
60-
end
61-
end
36+
dataset = dataset.where(lifecycle_type: message.lifecycle_type) if message.requested?(:lifecycle_type)
6237

6338
if message.requested?(:organization_guids)
6439
dataset = dataset.

0 commit comments

Comments
 (0)