Skip to content

Commit f680df6

Browse files
author
Gabriel Monroy
committed
fix(deploy): rework initial deploy logic based on workflow
1 parent 877a87b commit f680df6

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

controller/api/models.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,19 @@ def delete(self, *args, **kwargs):
129129

130130
def deploy(self, release, initial=False):
131131
tasks.deploy_release.delay(self, release).get()
132-
# TODO: figure out if the logic below is what we really want
133132
if initial:
134-
# if there is procfile with a web worker, scale by web=1
135-
if release.build.procfile and 'web' in release.build.procfile:
136-
self.structure = {'web': 1}
137-
# otherwise assume dockerfile, scale cmd=1
133+
# if there is no SHA, assume a docker image is being promoted
134+
if not release.build.sha:
135+
self.structure = {'cmd': 1}
136+
# if a dockerfile exists without a procfile, assume docker workflow
137+
elif release.build.dockerfile and not release.build.procfile:
138+
self.structure = {'cmd': 1}
139+
# if a procfile exists without a web entry, assume docker workflow
140+
elif release.build.procfile and not 'web' in release.build.procfile:
141+
self.structure = {'cmd': 1}
142+
# default to heroku workflow
138143
else:
139-
release.build.app.structure = {'cmd': 1}
144+
self.structure = {'web': 1}
140145
self.save()
141146
self.scale()
142147

0 commit comments

Comments
 (0)