@@ -71,6 +71,7 @@ class App(UuidAuditedModel):
7171 validators = [validate_app_id ,
7272 validate_reserved_names ])
7373 structure = JSONField (default = {}, blank = True , validators = [validate_app_structure ])
74+ procfile_structure = JSONField (default = {}, blank = True , validators = [validate_app_structure ])
7475
7576 class Meta :
7677 verbose_name = 'Application'
@@ -408,6 +409,7 @@ def scale(self, user, structure): # noqa
408409 if new_structure != self .structure :
409410 # save new structure to the database
410411 self .structure = new_structure
412+ self .procfile_structure = release .build .procfile
411413 self .save ()
412414
413415 try :
@@ -474,6 +476,7 @@ def deploy(self, release, force_deploy=False, rollback_on_failure=True): # noqa
474476 # set processes structure to default if app is new.
475477 if self .structure == {}:
476478 self .structure = self ._default_structure (release )
479+ self .procfile_structure = self ._default_structure (release )
477480 self .save ()
478481 # reset canonical process types if build type has changed.
479482 else :
@@ -489,8 +492,18 @@ def deploy(self, release, force_deploy=False, rollback_on_failure=True): # noqa
489492 # update with the default process type.
490493 structure .update (self ._default_structure (release ))
491494 self .structure = structure
495+ # if procfile structure exists then we use it
496+ if release .build .procfile and \
497+ release .build .sha and not \
498+ release .build .dockerfile :
499+ self .procfile_structure = release .build .procfile
492500 self .save ()
493501
502+ # always set the procfile structure for any new release
503+ if release .build .procfile :
504+ self .procfile_structure = release .build .procfile
505+ self .save ()
506+
494507 # deploy application to k8s. Also handles initial scaling
495508 app_settings = self .appsettings_set .latest ()
496509 deploys = {}
0 commit comments