修正下获取构建id的异常问题

This commit is contained in:
aixianling
2024-10-18 10:49:41 +08:00
parent 3d5bce566e
commit 47af53443e

View File

@@ -66,12 +66,13 @@ const handleZip = (id, ws) => {
const buildConfig = { const buildConfig = {
web: {task: "devops-web", token: 'fLeOGSVIRs405Me'}, web: {task: "devops-web", token: 'fLeOGSVIRs405Me'},
}[info.type] }[info.type]
let currentJob = 1
startUpdateSql() startUpdateSql()
.then(() => progress.set(30, id)) .then(() => progress.set(30, id))
.then(() => fse.emptyDir(dist || `../zips/${deploy}`)) .then(() => fse.emptyDir(dist || `../zips/${deploy}`))
.then(() => http.get(`/view/devops/job/${buildConfig.task}/api/json`).then(res => currentJob = (res.data?.nextBuildNumber || 1)))
.then(() => http.get(`/view/devops/job/${buildConfig.task}/buildWithParameters`, {params: {token: buildConfig.token, pid: id, dist: deploy}})) .then(() => http.get(`/view/devops/job/${buildConfig.task}/buildWithParameters`, {params: {token: buildConfig.token, pid: id, dist: deploy}}))
.then(() => http.get(`/view/devops/job/${buildConfig.task}/api/json`).then(res => (res.data?.nextBuildNumber - 1) || 1)) .then(() => new Promise((resolve, reject) => {
.then(currentJob => new Promise((resolve, reject) => {
jobs[id] = {task: buildConfig.task, build: currentJob} jobs[id] = {task: buildConfig.task, build: currentJob}
const timer = setInterval(() => { const timer = setInterval(() => {
http.get(`/view/devops/job/${buildConfig.task}/${currentJob}/api/json`).then(res => { http.get(`/view/devops/job/${buildConfig.task}/${currentJob}/api/json`).then(res => {