@@ -417,6 +417,9 @@ def _scale_pods(self, scale_types):
417417 # get application level pod termination grace period
418418 pod_termination_grace_period_seconds = release .config .values .get ('KUBERNETES_POD_TERMINATION_GRACE_PERIOD_SECONDS' , settings .KUBERNETES_POD_TERMINATION_GRACE_PERIOD_SECONDS ) # noqa
419419
420+ # set the image pull policy that is associated with the application container
421+ image_pull_policy = release .config .values .get ('IMAGE_PULL_POLICY' , settings .IMAGE_PULL_POLICY ) # noqa
422+
420423 # create image pull secret if needed
421424 image_pull_secret_name = self .image_pull_secret (self .id , registry , image )
422425
@@ -450,8 +453,14 @@ def _scale_pods(self, scale_types):
450453 'deploy_timeout' : deploy_timeout ,
451454 'pod_termination_grace_period_seconds' : pod_termination_grace_period_seconds ,
452455 'image_pull_secret_name' : image_pull_secret_name ,
456+ 'image_pull_policy' : image_pull_policy
453457 }
454458
459+ # Check if it is a slug builder image.
460+ if release .build .type == 'buildpack' :
461+ # overwrite image so slugrunner image is used in the container
462+ image = settings .SLUGRUNNER_IMAGE
463+
455464 # gather all proc types to be deployed
456465 tasks .append (
457466 functools .partial (
@@ -512,6 +521,9 @@ def deploy(self, release, force_deploy=False, rollback_on_failure=True): # noqa
512521 # get application level pod termination grace period
513522 pod_termination_grace_period_seconds = release .config .values .get ('KUBERNETES_POD_TERMINATION_GRACE_PERIOD_SECONDS' , settings .KUBERNETES_POD_TERMINATION_GRACE_PERIOD_SECONDS ) # noqa
514523
524+ # set the image pull policy that is associated with the application container
525+ image_pull_policy = release .config .values .get ('IMAGE_PULL_POLICY' , settings .IMAGE_PULL_POLICY ) # noqa
526+
515527 # create image pull secret if needed
516528 image_pull_secret_name = self .image_pull_secret (self .id , registry , image )
517529
@@ -549,6 +561,7 @@ def deploy(self, release, force_deploy=False, rollback_on_failure=True): # noqa
549561 'release_summary' : release .summary ,
550562 'pod_termination_grace_period_seconds' : pod_termination_grace_period_seconds ,
551563 'image_pull_secret_name' : image_pull_secret_name ,
564+ 'image_pull_policy' : image_pull_policy
552565 }
553566
554567 # Sort deploys so routable comes first
@@ -561,6 +574,10 @@ def deploy(self, release, force_deploy=False, rollback_on_failure=True): # noqa
561574 # create the application config in k8s (secret in this case) for all deploy objects
562575 self ._scheduler .set_application_config (self .id , envs , version )
563576
577+ if release .build .type == 'buildpack' :
578+ # overwrite image so slugrunner image is used in the container
579+ image = settings .SLUGRUNNER_IMAGE
580+
564581 # gather all proc types to be deployed
565582 tasks = [
566583 functools .partial (
@@ -778,6 +795,9 @@ def pod_name(size=5, chars=string.ascii_lowercase + string.digits):
778795 # get application level pod termination grace period
779796 pod_termination_grace_period_seconds = release .config .values .get ('KUBERNETES_POD_TERMINATION_GRACE_PERIOD_SECONDS' , settings .KUBERNETES_POD_TERMINATION_GRACE_PERIOD_SECONDS ) # noqa
780797
798+ # set the image pull policy that is associated with the application container
799+ image_pull_policy = release .config .values .get ('IMAGE_PULL_POLICY' , settings .IMAGE_PULL_POLICY ) # noqa
800+
781801 # create image pull secret if needed
782802 image_pull_secret_name = self .image_pull_secret (self .id , registry , image )
783803
@@ -795,8 +815,14 @@ def pod_name(size=5, chars=string.ascii_lowercase + string.digits):
795815 'deploy_timeout' : deploy_timeout ,
796816 'pod_termination_grace_period_seconds' : pod_termination_grace_period_seconds ,
797817 'image_pull_secret_name' : image_pull_secret_name ,
818+ 'image_pull_policy' : image_pull_policy
798819 }
799820
821+ # Check if it is a slug builder image.
822+ if release .build .type == 'buildpack' :
823+ # overwrite image so slugrunner image is used in the container
824+ image = settings .SLUGRUNNER_IMAGE
825+
800826 try :
801827 exit_code , output = self ._scheduler .run (
802828 self .id ,
0 commit comments