Skip to content

Commit c2d3716

Browse files
committed
Merge pull request #258 from helgi/build_image
fix(scheduler): support both long and short sha being passed in for builds
2 parents 1210376 + 3de4d0d commit c2d3716

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

rootfs/scheduler/__init__.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -601,11 +601,17 @@ def _create_rc(self, name, image, command, **kwargs):
601601
num = kwargs.get('num', {})
602602
imgurl = self.registry + "/" + image
603603
TEMPLATE = RCD_TEMPLATE
604-
shalen = len(image[image.index(":")+5:])
605-
git = image[image.index(":")+1:image.index(":")+4]
606-
if git == "git" and shalen == 8 and app_type == 'web':
607-
imgurl = "http://"+settings.S3EP+"/git/home/"+image+"/push/slug.tgz"
604+
605+
# Check if it is a slug builder image.
606+
# Example format: golden-earrings:git-5450cbcdaaf9afe6fadd219c94ac9c449bd62413s
607+
vcs, sha = image[image.index(':')+1:].split('-')
608+
if vcs == 'git' and len(sha) in [8, 40] and app_type == 'web':
609+
imgurl = 'http://{}/git/home/{}/push/slug.tgz'.format(
610+
settings.S3EP,
611+
image.replace(':', '-')
612+
)
608613
TEMPLATE = RCB_TEMPLATE
614+
609615
l = {
610616
"name": name,
611617
"id": app_name,

0 commit comments

Comments
 (0)