nacos加入到项目当中
This commit is contained in:
parent
aaacbc9c3f
commit
39cbf699ad
@ -136,6 +136,10 @@
|
|||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-loadbalancer</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.nacos</groupId>
|
<groupId>com.alibaba.nacos</groupId>
|
||||||
<artifactId>nacos-client</artifactId>
|
<artifactId>nacos-client</artifactId>
|
||||||
@ -143,7 +147,10 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
<version>3.12.0</version>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|||||||
@ -3,16 +3,17 @@ package com.qc.soft.deploy.ease;
|
|||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.SpringBootConfiguration;
|
import org.springframework.boot.SpringBootConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||||
|
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||||
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
import org.springframework.scheduling.annotation.EnableAsync;
|
import org.springframework.scheduling.annotation.EnableAsync;
|
||||||
|
|
||||||
import java.net.URL;
|
|
||||||
import java.net.URLClassLoader;
|
|
||||||
|
|
||||||
@SpringBootConfiguration
|
@SpringBootConfiguration
|
||||||
@EnableAutoConfiguration
|
@EnableAutoConfiguration
|
||||||
@ComponentScan("com.qc.soft.deploy.ease")
|
@ComponentScan("com.qc.soft.deploy.ease")
|
||||||
@EnableAsync
|
@EnableAsync
|
||||||
|
@EnableFeignClients
|
||||||
|
@EnableDiscoveryClient
|
||||||
public class DeployEaseApplication {
|
public class DeployEaseApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|||||||
@ -7,8 +7,10 @@ import com.alibaba.druid.support.http.WebStatFilter;
|
|||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||||
|
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -50,4 +52,11 @@ public class DruidConfig {
|
|||||||
bean.setUrlPatterns(Arrays.asList("/*"));
|
bean.setUrlPatterns(Arrays.asList("/*"));
|
||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@LoadBalanced
|
||||||
|
public RestTemplate restTemplate() {
|
||||||
|
return new RestTemplate();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,31 @@
|
|||||||
|
package com.qc.soft.deploy.ease.controller.mgmt;
|
||||||
|
|
||||||
|
|
||||||
|
import com.qc.soft.deploy.ease.fegin.ITenantAdapterService;
|
||||||
|
import com.qc.soft.deploy.ease.fegin.response.JenkinsAggregateResponse;
|
||||||
|
import com.qc.soft.framework.basic.context.TenantContext;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/mgmt")
|
||||||
|
public class JenkinsController {
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ITenantAdapterService tenantAdapterService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RestTemplate restTemplate;
|
||||||
|
|
||||||
|
@GetMapping(value = "jenkins/aggregate")
|
||||||
|
public JenkinsAggregateResponse aggregate() {
|
||||||
|
// JenkinsAggregateResponse aggregate = tenantAdapterService.aggregate();
|
||||||
|
return restTemplate.getForObject("http://deploy-ease-tenant-adapter-" + TenantContext.getCurrentTenant() + "/mgmt/jenkins/aggregate", JenkinsAggregateResponse.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package com.qc.soft.deploy.ease.fegin;
|
||||||
|
|
||||||
|
|
||||||
|
import com.qc.soft.deploy.ease.fegin.response.JenkinsAggregateResponse;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
|
@FeignClient(name = "deploy-ease-tenant-adapter-longi")
|
||||||
|
public interface ITenantAdapterService {
|
||||||
|
|
||||||
|
@GetMapping("/mgmt/jenkins/aggregate")
|
||||||
|
JenkinsAggregateResponse aggregate();
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
package com.qc.soft.deploy.ease.fegin.response;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@Data
|
||||||
|
public class JenkinsAggregateResponse {
|
||||||
|
|
||||||
|
private List<JenkinsViewAggregateResponse> views;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
package com.qc.soft.deploy.ease.fegin.response;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@Data
|
||||||
|
public class JenkinsViewAggregateResponse {
|
||||||
|
|
||||||
|
private String viewName;
|
||||||
|
|
||||||
|
private List<JenkinsViewProjectAggregateResponse> projects;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
package com.qc.soft.deploy.ease.fegin.response;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@Data
|
||||||
|
public class JenkinsViewProjectAggregateResponse {
|
||||||
|
|
||||||
|
String projectName;
|
||||||
|
|
||||||
|
String color;
|
||||||
|
|
||||||
|
String description;
|
||||||
|
|
||||||
|
String displayName;
|
||||||
|
|
||||||
|
String fullDisplayName;
|
||||||
|
|
||||||
|
String fullName;
|
||||||
|
|
||||||
|
// List<JenkinsViewProjectTaskAggregateResponse> builds;
|
||||||
|
//
|
||||||
|
// JenkinsViewProjectTaskAggregateResponse firstBuild;
|
||||||
|
|
||||||
|
JenkinsViewProjectTaskAggregateResponse lastBuild;
|
||||||
|
|
||||||
|
// JenkinsViewProjectTaskAggregateResponse lastCompletedBuild;
|
||||||
|
//
|
||||||
|
// JenkinsViewProjectTaskAggregateResponse lastStableBuild;
|
||||||
|
//
|
||||||
|
// JenkinsViewProjectTaskAggregateResponse lastSuccessfulBuild;
|
||||||
|
|
||||||
|
int nextBuildNumber;
|
||||||
|
|
||||||
|
boolean disabled;
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.qc.soft.deploy.ease.fegin.response;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
|
@Data
|
||||||
|
public class JenkinsViewProjectTaskAggregateResponse {
|
||||||
|
|
||||||
|
private Integer number;
|
||||||
|
|
||||||
|
private Boolean inProgress;
|
||||||
|
|
||||||
|
private Boolean building;
|
||||||
|
|
||||||
|
private String result;
|
||||||
|
|
||||||
|
private String timestamp;
|
||||||
|
|
||||||
|
private Long duration;
|
||||||
|
|
||||||
|
private Integer queueId;
|
||||||
|
|
||||||
|
private Map<String, Object> changeSet;
|
||||||
|
|
||||||
|
}
|
||||||
@ -101,10 +101,6 @@
|
|||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-webflux</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user