@@ -45,17 +45,17 @@ def image(self):
4545 image = self .build .image .replace ('{}/' .format (settings .REGISTRY_URL ), '' )
4646 return image .replace ('{}/' .format (settings .REGISTRY_HOST ), '' )
4747
48- if not self .build .dockerfile :
49- # Deis Pull
50- if not self .build .sha :
51- return '{}/{}:v{}' .format (settings .REGISTRY_URL , self .app .id , str (self .version ))
52-
48+ # Sort out image information based on build type
49+ if self .build .type == 'dockerfile' :
50+ # DockerFile
51+ return '{}/{}:git-{}' .format (settings .REGISTRY_URL , self .app .id , str (self .build .sha ))
52+ elif self .build .type == 'image' :
53+ # Deis Pull, docker image in local registry
54+ return '{}/{}:v{}' .format (settings .REGISTRY_URL , self .app .id , str (self .version ))
55+ elif self .build .type == 'buildpack' :
5356 # Build Pack - Registry URL not prepended since slugrunner image will download slug
5457 return self .build .image
5558
56- # DockerFile
57- return '{}/{}:git-{}' .format (settings .REGISTRY_URL , self .app .id , str (self .build .sha ))
58-
5959 def new (self , user , config , build , summary = None , source_version = 'latest' ):
6060 """
6161 Create a new application release using the provided Build and Config
@@ -83,12 +83,12 @@ def new(self, user, config, build, summary=None, source_version='latest'):
8383
8484 return release
8585
86- def publish (self , source_version = 'latest' ):
86+ def publish (self ):
8787 if self .build is None :
8888 raise DeisException ('No build associated with this release to publish' )
8989
9090 # If the build has a SHA, assume it's from deis-builder and in the deis-registry already
91- if self .build .dockerfile or self . build . sha :
91+ if self .build .source_based :
9292 return
9393
9494 source_image = self .build .image
@@ -102,8 +102,7 @@ def publish(self, source_version='latest'):
102102
103103 # add tag if it was not provided
104104 if ':' not in source_image :
105- source_tag = 'git-{}' .format (self .build .sha ) if self .build .sha else source_version
106- source_image = "{}:{}" .format (source_image , source_tag )
105+ source_image = "{}:{}" .format (source_image , self .build .version )
107106
108107 # gather custom login information for registry if needed
109108 auth = None
@@ -114,7 +113,8 @@ def publish(self, source_version='latest'):
114113 'email' : self .owner .email
115114 }
116115
117- deis_registry = bool (self .build .sha )
116+ # if build is source based then it was pushed into the deis registry
117+ deis_registry = bool (self .build .source_based )
118118 publish_release (source_image , self .image , deis_registry , auth )
119119
120120 def previous (self ):
0 commit comments