File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 2
2
from builder import Builder
3
3
import simplejson as json
4
4
image_builder = Builder ()
5
+ registry_name = "localhost:5000"
6
+
5
7
6
8
url = os .environ .get ('CLOUDAMQP_URL' , 'amqp://user:password@localhost:5672/%2f' )
7
9
params = pika .URLParameters (url )
11
13
channel .queue_declare (queue = 'build_image' )
12
14
13
15
def docker_builder (ch , method , properties , body ):
16
+
14
17
tmp = {}
15
18
tmp = json .loads (body )
16
19
17
20
git .Git ().clone ("git@{}:/home/git/version/{}" .format (tmp ["git_server" ],tmp ["repo_name" ]),branch = tmp ['branch_name' ])
18
21
img_status = image_builder .build_image (path = '{}/' .format (tmp ["repo_name" ]),tag = '{}' .format (tmp ['repo_name' ]+ tmp ['branch_name' ]))
19
-
22
+ if img_status :
23
+ os .system ("docker tag {} {}/{}" .format (tmp ['repo_name' ]+ tmp ['branch_name' ],registry_name ,tmp ['repo_name' ]+ tmp ['branch_name' ]))
24
+ os .system ("docker push {}/" .format (registry_name ,tmp ['repo_name' ]+ tmp ['branch_name' ]))
25
+ else :
26
+ print ("Errror !" )
20
27
21
28
if img_status [0 ] == True :
22
29
pass
You can’t perform that action at this time.
0 commit comments