F 修复常规发布缺少环境变量SPUG_GIT_BRANCH/SPUG_GIT_COMMIT_ID/SPUG_GIT_TAG

pull/410/head
vapao 2021-10-28 14:35:20 +08:00
parent 9c7e77f506
commit f384374db7
2 changed files with 8 additions and 0 deletions

View File

@ -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)

View File

@ -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='参数错误')