From cc34a5cdea21b3b64a585284dc9ac4f1b0d9236c Mon Sep 17 00:00:00 2001 From: aixianling Date: Fri, 18 Oct 2024 09:38:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E5=89=8D=E5=BB=BA=E8=AE=BE=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/websocket/custom/getZip.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/websocket/custom/getZip.js b/src/websocket/custom/getZip.js index ddd38cd..1ee120e 100644 --- a/src/websocket/custom/getZip.js +++ b/src/websocket/custom/getZip.js @@ -61,21 +61,22 @@ const handleZip = (id, ws) => { const {signal} = controller; const progress = new counter(`正在处理 ${info.name} 的打包工作...`) if (info.type == 'web') { - let {name, version, dist} = info - dist = dist?.trim() || `${name}_v${version}` + const {name, version, dist} = info + const deploy = dist?.trim() || `${name}_v${version}` const buildConfig = { web: {task: "devops-web", token: 'fLeOGSVIRs405Me'}, }[info.type] startUpdateSql() .then(() => progress.set(30, id)) + .then(() => fse.emptyDir(dist || `../zips/${deploy}`)) .then(() => http.get(`/view/devops/job/${buildConfig.task}/buildWithParameters`, - {params: {token: buildConfig.token, pid: id, dist}})) - .then(() => http.get(`/view/devops/job/${buildConfig.task}/api/json`).then(res => res.data?.lastBuild.number||1)) + {params: {token: buildConfig.token, pid: id, deploy}})) + .then(() => http.get(`/view/devops/job/${buildConfig.task}/api/json`).then(res => res.data?.lastBuild.number || 1)) .then(currentJob => new Promise((resolve, reject) => { jobs[id] = {task: buildConfig.task, build: currentJob} const timer = setInterval(() => { http.get(`/view/devops/job/${buildConfig.task}/${currentJob}/api/json`).then(res => { - if (res.data.result == 'SUCCESS') { + if (['SUCCESS', 'UNSTABLE'].includes(res.data.result)) { clearInterval(timer) resolve(endUpdateSql()) } else if (res.data.result == 'ABORTED') {