|
|
@@ -56,13 +56,17 @@ public class JenkinsApiImpl implements JenkinsApi {
|
|
|
public QueueItem invokeBuild(String jobName, Map<String, String> params) throws ServiceException {
|
|
|
QueueReference reference;
|
|
|
try {
|
|
|
- JobWithDetails job=server.getJob(jobName);
|
|
|
- logger.info(jobName+" "+job.getUrl()+" "+job.getFullName());
|
|
|
+ JobWithDetails externalJob=server.getJob(jobName);
|
|
|
+ Job job = new Job(externalJob.getName(),
|
|
|
+ externalJob.getUrl().replace("build-jenkins.internal-paas.seec.seecoder.cn","environment-9-12.seec.svc.cluster.local:8080"),
|
|
|
+ externalJob.getFullName());
|
|
|
if (params == null) {
|
|
|
reference = job.build();
|
|
|
+ logger.info(reference.getQueueItemUrlPart());
|
|
|
} else {
|
|
|
// 0.3.7版本的Jenkins客户端库中build(Map<String, String> params)方法存在BUG,会触发两次构建
|
|
|
reference = job.build(params, false);
|
|
|
+ logger.info(reference.getQueueItemUrlPart());
|
|
|
}
|
|
|
QueueItem item = server.getQueueItem(reference);
|
|
|
while (item.getExecutable() == null) {
|
|
|
@@ -113,7 +117,7 @@ public class JenkinsApiImpl implements JenkinsApi {
|
|
|
@Override
|
|
|
public <T extends BaseModel> T get(BuildWithDetails build, String path, Class<T> cls) throws ServiceException {
|
|
|
try {
|
|
|
- return build.getClient().get(build.getUrl() + path, cls);
|
|
|
+ return build.getClient().get(build.getUrl().replace("build-jenkins.internal-paas.seec.seecoder.cn","environment-9-12.seec.svc.cluster.local:8080") + path, cls);
|
|
|
} catch (IOException e) {
|
|
|
logger.error("get exception={}, path={}", e, path);
|
|
|
throw new ServiceException("101", e.getMessage());
|
|
|
@@ -123,7 +127,7 @@ public class JenkinsApiImpl implements JenkinsApi {
|
|
|
@Override
|
|
|
public String get(BuildWithDetails build, String path) throws ServiceException {
|
|
|
try {
|
|
|
- return build.getClient().get(build.getUrl() + path);
|
|
|
+ return build.getClient().get(build.getUrl().replace("build-jenkins.internal-paas.seec.seecoder.cn","environment-9-12.seec.svc.cluster.local:8080") + path);
|
|
|
} catch (IOException e) {
|
|
|
logger.error("get exception={}, path={}", e, path);
|
|
|
throw new ServiceException("101", e.getMessage());
|
|
|
@@ -135,7 +139,10 @@ public class JenkinsApiImpl implements JenkinsApi {
|
|
|
try {
|
|
|
Artifact artifact = new Artifact();
|
|
|
artifact.setRelativePath(relativePath);
|
|
|
- return build.downloadArtifact(artifact);
|
|
|
+ URI uri = new URI(build.getUrl().replace("build-jenkins.internal-paas.seec.seecoder.cn","environment-9-12.seec.svc.cluster.local:8080"));
|
|
|
+ String artifactPath = uri.getPath() + "artifact/" + artifact.getRelativePath();
|
|
|
+ URI artifactUri = new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), artifactPath, "", "");
|
|
|
+ return build.getClient().getFile(artifactUri);
|
|
|
} catch (IOException | URISyntaxException e) {
|
|
|
logger.error("get exception={}, relativePath={}", e, relativePath);
|
|
|
throw new ServiceException("101", e.getMessage());
|