Skip to content

Commit 877a87b

Browse files
author
Gabriel Monroy
committed
fix(builder): include default_process_types from .release
1 parent b4ff75e commit 877a87b

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

builder/templates/builder

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,21 @@ if __name__ == '__main__':
117117
# use sha of master
118118
with open(os.path.join(repo_dir, 'refs/heads/master')) as f:
119119
body['sha'] = f.read().strip('\n')
120-
# extract the Procfile and convert to JSON
120+
# extract the user-defined Procfile and any default_process_types
121+
procfile_dict = {}
122+
p = subprocess.Popen('tar --to-stdout -xzf {temp_dir}/slug.tgz ./.release'.format(**locals()), shell=True, cwd=temp_dir,
123+
stdout=subprocess.PIPE, stderr=open(os.devnull, 'w'))
124+
rc = p.wait()
125+
if rc == 0:
126+
stdout = p.stdout.read()
127+
default_process_types = yaml.safe_load(stdout).get('default_process_types', {})
128+
procfile_dict.update(default_process_types)
121129
if os.path.exists(procfile):
122130
with open(procfile) as f:
123131
raw_procfile = f.read()
124-
body['procfile'] = json.dumps(yaml.safe_load(raw_procfile))
132+
procfile_dict.update(yaml.safe_load(raw_procfile))
133+
if procfile_dict:
134+
body['procfile'] = json.dumps(procfile_dict)
125135
# extract Dockerfile
126136
if os.path.exists(dockerfile):
127137
with open(dockerfile) as f:

0 commit comments

Comments
 (0)