From b5e3e0121c790700271cf87ed7b808e8c7af5773 Mon Sep 17 00:00:00 2001 From: vapao Date: Fri, 3 Apr 2020 16:48:52 +0800 Subject: [PATCH] =?UTF-8?q?A=20=E5=8F=91=E5=B8=83=E6=B7=BB=E5=8A=A0SPUG=5F?= =?UTF-8?q?DEPLOY=5FID,SPUG=5FHOST=5FID,SPUG=5FHOST=5FNAME=E5=85=A8?= =?UTF-8?q?=E5=B1=80=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_api/apps/deploy/utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spug_api/apps/deploy/utils.py b/spug_api/apps/deploy/utils.py index ffb82e5..c37f71e 100644 --- a/spug_api/apps/deploy/utils.py +++ b/spug_api/apps/deploy/utils.py @@ -27,6 +27,7 @@ def deploy_dispatch(request, req, token): SPUG_APP_NAME=req.deploy.app.name, SPUG_APP_ID=str(req.deploy.app_id), SPUG_REQUEST_NAME=req.name, + SPUG_DEPLOY_ID=req.deploy.id, SPUG_REQUEST_ID=str(req.id), SPUG_ENV_ID=str(req.deploy.env_id), SPUG_ENV_KEY=req.deploy.env.key, @@ -127,6 +128,7 @@ def _deploy_ext1_host(helper, h_id, extend, env): host = Host.objects.filter(pk=h_id).first() if not host: helper.send_error(h_id, 'no such host') + env.update({'SPUG_HOST_ID': h_id, 'SPUG_HOST_NAME': host.hostname}) ssh = host.get_ssh() code, _ = ssh.exec_command(f'mkdir -p {extend.dst_repo} && [ -e {extend.dst_dir} ] && [ ! -L {extend.dst_dir} ]') if code == 0: @@ -171,6 +173,7 @@ def _deploy_ext2_host(helper, h_id, actions, env): host = Host.objects.filter(pk=h_id).first() if not host: helper.send_error(h_id, 'no such host') + env.update({'SPUG_HOST_ID': h_id, 'SPUG_HOST_NAME': host.hostname}) ssh = host.get_ssh() helper.send_step(h_id, 2, '完成\r\n') for index, action in enumerate(actions):