From f384374db7b3a40bfcf37f4ed0f0e37cc679394f Mon Sep 17 00:00:00 2001 From: vapao Date: Thu, 28 Oct 2021 14:35:20 +0800 Subject: [PATCH] =?UTF-8?q?F=20=E4=BF=AE=E5=A4=8D=E5=B8=B8=E8=A7=84?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E7=BC=BA=E5=B0=91=E7=8E=AF=E5=A2=83=E5=8F=98?= =?UTF-8?q?=E9=87=8FSPUG=5FGIT=5FBRANCH/SPUG=5FGIT=5FCOMMIT=5FID/SPUG=5FGI?= =?UTF-8?q?T=5FTAG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spug_api/apps/deploy/utils.py | 7 +++++++ spug_api/apps/deploy/views.py | 1 + 2 files changed, 8 insertions(+) diff --git a/spug_api/apps/deploy/utils.py b/spug_api/apps/deploy/utils.py index b0625b8..2a7cefa 100644 --- a/spug_api/apps/deploy/utils.py +++ b/spug_api/apps/deploy/utils.py @@ -75,6 +75,13 @@ def _ext1_deploy(req, helper, env): req.repository = rep extend = req.deploy.extend_obj env.update(SPUG_DST_DIR=extend.dst_dir) + extras = json.loads(req.extra) + if extras[0] == 'repository': + extras = extras[1:] + if extras[0] == 'branch': + env.update(SPUG_GIT_BRANCH=extras[1], SPUG_GIT_COMMIT_ID=extras[2]) + else: + env.update(SPUG_GIT_TAG=extras[1]) if req.deploy.is_parallel: threads, latest_exception = [], None max_workers = max(10, os.cpu_count() * 5) diff --git a/spug_api/apps/deploy/views.py b/spug_api/apps/deploy/views.py index 2d2fd05..021d157 100644 --- a/spug_api/apps/deploy/views.py +++ b/spug_api/apps/deploy/views.py @@ -245,6 +245,7 @@ def post_request_ext1(request): form.repository_id = repository.id form.version = repository.version form.spug_version = repository.spug_version + form.extra = ['repository'] + json.loads(repository.extra) else: return json_response(error='参数错误')