@@ -58,8 +58,8 @@ def run(stack, params, args, extra)
5858 exec_i "docker --context #{ name } config create #{ stack . name } _readme -" , stack . description
5959 deploy_status = 'deployed'
6060 ensure
61- if ENV [ 'DEPLOY_REGISTRY' ] || ENV [ ' CI_DEPLOY_REGISTRY']
62- deploy_registry = ENV [ 'DEPLOY_REGISTRY' ] || ENV [ ' CI_DEPLOY_REGISTRY']
61+ if ENV [ 'CI_DEPLOY_REGISTRY' ]
62+ deploy_registry = ENV [ 'CI_DEPLOY_REGISTRY' ]
6363 puts "Sending deploy status to #{ deploy_registry } "
6464 data = {
6565 deploy_host : endpoint ,
@@ -70,16 +70,20 @@ def run(stack, params, args, extra)
7070 stack : YAML . load ( yaml , aliases : true )
7171 }
7272
73- uri = URI ( "#{ deploy_registry } /api/v1/swarm_deploy" )
74- http = Net ::HTTP . new ( uri . host , uri . port )
75- http . use_ssl = uri . scheme == 'https'
73+ begin
74+ uri = URI ( "#{ deploy_registry } /api/v1/swarm_deploy" )
75+ http = Net ::HTTP . new ( uri . host , uri . port )
76+ http . use_ssl = uri . scheme == 'https'
7677
77- request = Net ::HTTP ::Post . new ( uri )
78- request [ 'Content-Type' ] = 'application/json'
79- request . body = data . to_json
78+ request = Net ::HTTP ::Post . new ( uri )
79+ request [ 'Content-Type' ] = 'application/json'
80+ request . body = data . to_json
8081
81- response = http . request ( request )
82- puts "POST Return value: #{ response . code } "
82+ response = http . request ( request )
83+ puts "POST Return value: #{ response . code } "
84+ rescue => e
85+ puts "Error: #{ e . message } "
86+ end
8387 end
8488 end
8589 end
0 commit comments