|
@@ -9,6 +9,7 @@ import cn.seecoder.build.server.service.facade.jenkins.JenkinsApi;
|
|
|
import cn.seecoder.build.server.service.model.converter.PipelineConverter;
|
|
import cn.seecoder.build.server.service.model.converter.PipelineConverter;
|
|
|
import cn.seecoder.build.server.util.ServiceException;
|
|
import cn.seecoder.build.server.util.ServiceException;
|
|
|
import com.offbytwo.jenkins.model.BuildWithDetails;
|
|
import com.offbytwo.jenkins.model.BuildWithDetails;
|
|
|
|
|
+import com.offbytwo.jenkins.model.QueueItem;
|
|
|
import org.apache.commons.lang3.RandomStringUtils;
|
|
import org.apache.commons.lang3.RandomStringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -84,7 +85,7 @@ public class JobServiceImpl implements JobService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public void invokeBuild(Integer pipelineId, String jobName, Map<String, String> params) throws ServiceException {
|
|
|
|
|
|
|
+ public Integer invokeBuild(Integer pipelineId, String jobName, Map<String, String> params) throws ServiceException {
|
|
|
Pipeline pipeline = pipelineDAO.findById(pipelineId).orElse(null);
|
|
Pipeline pipeline = pipelineDAO.findById(pipelineId).orElse(null);
|
|
|
if (pipeline == null) {
|
|
if (pipeline == null) {
|
|
|
throw ServiceException.BAD_REQUEST;
|
|
throw ServiceException.BAD_REQUEST;
|
|
@@ -100,6 +101,7 @@ public class JobServiceImpl implements JobService {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
- jenkinsApi.invokeBuild(jobName, params);
|
|
|
|
|
|
|
+ QueueItem item = jenkinsApi.invokeBuild(jobName, params);
|
|
|
|
|
+ return item.getExecutable().getNumber().intValue();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|