|
@@ -72,11 +72,12 @@ class Deployer:
|
|
|
self.project_info = self.taskMdl.get('project_info')
|
|
|
|
|
|
# copy to a local version
|
|
|
- self.release_version = '{project_id}_{task_id}_{timestamp}'.format(
|
|
|
- project_id=self.project_info['id'],
|
|
|
- task_id=self.task_id,
|
|
|
- timestamp=time.strftime('%Y%m%d_%H%M%S', time.localtime(time.time())),
|
|
|
- )
|
|
|
+ self.release_version = self.taskMdl.get('link_id') if (self.taskMdl.get("is_rollback")) else \
|
|
|
+ '{project_id}_{task_id}_{timestamp}'.format(
|
|
|
+ project_id=self.project_info['id'],
|
|
|
+ task_id=self.task_id,
|
|
|
+ timestamp=time.strftime('%Y%m%d_%H%M%S', time.localtime(time.time())),
|
|
|
+ )
|
|
|
current_app.logger.info(self.taskMdl)
|
|
|
|
|
|
# 将环境变量包在 "" 里,防止特殊字符报错
|
|
@@ -491,10 +492,10 @@ class Deployer:
|
|
|
waller = Waller(host=host, user=server_info['user'], port=server_info['port'], inline_ssh_env=True)
|
|
|
waller.init_env(env=self.custom_global_env)
|
|
|
|
|
|
- self.connections[host] = waller
|
|
|
- self.prev_release(self.connections[host])
|
|
|
- self.release(self.connections[host])
|
|
|
- self.post_release(self.connections[host])
|
|
|
+ self.connections[self.task_id] = waller
|
|
|
+ self.prev_release(self.connections[self.task_id])
|
|
|
+ self.release(self.connections[self.task_id])
|
|
|
+ self.post_release(self.connections[self.task_id])
|
|
|
RecordModel().save_record(stage=RecordModel.stage_end, sequence=0, user_id=current_user.id,
|
|
|
task_id=self.task_id, status=RecordModel.status_success, host=host,
|
|
|
user=server_info['user'], command='')
|
|
@@ -519,17 +520,16 @@ class Deployer:
|
|
|
|
|
|
try:
|
|
|
is_all_servers_success = True
|
|
|
- self.release_version = self.taskMdl.get('link_id')
|
|
|
for server_info in self.servers:
|
|
|
host = server_info['host']
|
|
|
try:
|
|
|
waller = Waller(host=host, user=server_info['user'], port=server_info['port'], inline_ssh_env=True)
|
|
|
waller.init_env(env=self.custom_global_env)
|
|
|
|
|
|
- self.connections[host] = waller
|
|
|
- self.prev_release_custom(self.connections[host])
|
|
|
- self.release(self.connections[host])
|
|
|
- self.post_release(self.connections[host])
|
|
|
+ self.connections[self.task_id] = waller
|
|
|
+ self.prev_release_custom(self.connections[self.task_id])
|
|
|
+ self.release(self.connections[self.task_id])
|
|
|
+ self.post_release(self.connections[self.task_id])
|
|
|
RecordModel().save_record(stage=RecordModel.stage_end, sequence=0, user_id=current_user.id,
|
|
|
task_id=self.task_id, status=RecordModel.status_success, host=host,
|
|
|
user=server_info['user'], command='')
|