Showing
13 changed files
with
384 additions
and
61 deletions
1 | +package com.monitor.model.request; | ||
2 | + | ||
3 | + | ||
4 | +import lombok.Data; | ||
5 | + | ||
6 | +/** | ||
7 | + * jenkins发布镜像 | ||
8 | + */ | ||
9 | +@Data | ||
10 | +public class DockerJenkinsReq { | ||
11 | + private String appNames; | ||
12 | + private String branch; | ||
13 | + private String nodeEnv; | ||
14 | + private String userName; | ||
15 | + private String userMail; | ||
16 | + private String releaseWorkId; | ||
17 | +} |
1 | +package com.model; | ||
2 | + | ||
3 | +import lombok.Data; | ||
4 | + | ||
5 | +import java.util.Date; | ||
6 | + | ||
7 | +@Data | ||
8 | +public class DockerJenkinsRecord { | ||
9 | + private String id; | ||
10 | + private String projectName; | ||
11 | + private String jenkinsJobId; | ||
12 | + private String jenkinsBuildStatus; | ||
13 | + private String ReleaseWorkId; | ||
14 | + /** | ||
15 | + * 创建时间 | ||
16 | + */ | ||
17 | + private Date createTime; | ||
18 | +} |
1 | +package com.model; | ||
2 | + | ||
3 | +import lombok.Data; | ||
4 | + | ||
5 | +@Data | ||
6 | +public class DockerProjectModel { | ||
7 | + private int id; | ||
8 | + //项目名称 | ||
9 | + private String projectName; | ||
10 | + | ||
11 | + //项目类型 | ||
12 | + private String projectType; | ||
13 | + | ||
14 | + private String dockerProjectName; | ||
15 | + | ||
16 | + private String dockerGrayClusterId; | ||
17 | + private String dockerGrayNameSpace; | ||
18 | + | ||
19 | + private String dockerOnlineClusterId; | ||
20 | + private String dockerOnlineNameSpace; | ||
21 | + | ||
22 | +} |
monitor-service-mysql/src/main/java/com/monitor/mysql/mapper/DockerJenkinsRecordMapper.java
0 → 100644
1 | +package com.monitor.mysql.mapper; | ||
2 | + | ||
3 | +import com.model.DockerJenkinsRecord; | ||
4 | +import com.model.DockerProjectModel; | ||
5 | +import com.monitor.model.domain.PageBean; | ||
6 | +import org.apache.ibatis.annotations.Param; | ||
7 | + | ||
8 | +import java.util.List; | ||
9 | + | ||
10 | +/** | ||
11 | + * Created by craig.qin | ||
12 | + */ | ||
13 | +public interface DockerJenkinsRecordMapper { | ||
14 | + DockerJenkinsRecord selectById(String id); | ||
15 | + int insert(DockerJenkinsRecord dockerJenkinsRecord); | ||
16 | + int updateJob(@Param("id") String id ,@Param("jobId") String jobId,@Param("jobStatus")String jobStatus); | ||
17 | +} |
1 | +package com.monitor.mysql.mapper; | ||
2 | + | ||
3 | +import com.model.DockerProjectModel; | ||
4 | +import com.monitor.model.domain.PageBean; | ||
5 | +import org.apache.ibatis.annotations.Param; | ||
6 | + | ||
7 | +import java.util.List; | ||
8 | + | ||
9 | +/** | ||
10 | + * Created by craig.qin | ||
11 | + */ | ||
12 | +public interface DockerProjectMapper { | ||
13 | + int selectCount(); | ||
14 | + | ||
15 | + List<DockerProjectModel> selectByPage(PageBean page); | ||
16 | + | ||
17 | + DockerProjectModel selectById(int id); | ||
18 | + | ||
19 | + List<DockerProjectModel> selectByIdList(@Param("idList") List<Integer> idList); | ||
20 | + | ||
21 | + List<DockerProjectModel> selectByProjectType(@Param("projectType") String projectType); | ||
22 | +} |
1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | ||
3 | +<mapper namespace="com.monitor.mysql.mapper.DockerJenkinsRecordMapper" > | ||
4 | + <resultMap id="BaseResultMap" type="com.model.DockerJenkinsRecord" > | ||
5 | + <id column="id" property="id" jdbcType="VARCHAR" /> | ||
6 | + <result column="projectname" property="projectName" jdbcType="VARCHAR" /> | ||
7 | + <result column="jenkins_job_id" property="jenkinsJobId" jdbcType="VARCHAR" /> | ||
8 | + <result column="jenkins_build_status" property="jenkinsBuildStatus" jdbcType="VARCHAR" /> | ||
9 | + <result column="release_work_id" property="ReleaseWorkId" jdbcType="VARCHAR" /> | ||
10 | + <result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> | ||
11 | + </resultMap> | ||
12 | + | ||
13 | + <sql id="Base_Column_List" > | ||
14 | + id, projectname, jenkins_job_id,jenkins_build_status,release_work_id,create_time | ||
15 | + </sql> | ||
16 | + | ||
17 | + <insert id="insert" parameterType="com.model.DockerJenkinsRecord" > | ||
18 | + insert into docker_jenkins_record (id, projectname, release_work_id) | ||
19 | + values (#{id,jdbcType=VARCHAR}, #{projectName,jdbcType=VARCHAR}, #{ReleaseWorkId,jdbcType=VARCHAR}) | ||
20 | + </insert> | ||
21 | + | ||
22 | + <update id="updateJob" > | ||
23 | + update docker_jenkins_record | ||
24 | + set jenkins_job_id = #{jobId} ,jenkins_build_status = #{jobStatus} | ||
25 | + where id = #{id} | ||
26 | + </update> | ||
27 | + | ||
28 | + | ||
29 | + | ||
30 | +</mapper> |
1 | +<?xml version="1.0" encoding="UTF-8" ?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > | ||
3 | +<mapper namespace="com.monitor.mysql.mapper.DockerProjectMapper" > | ||
4 | + <resultMap id="BaseResultMap" type="com.model.DockerProjectModel" > | ||
5 | + <id column="id" property="id" jdbcType="INTEGER" /> | ||
6 | + <result column="projectname" property="projectName" jdbcType="VARCHAR" /> | ||
7 | + <result column="projecttype" property="projectType" jdbcType="VARCHAR" /> | ||
8 | + <result column="dockerprojectname" property="dockerProjectName" jdbcType="VARCHAR" /> | ||
9 | + <result column="dockergrayclusterid" property="dockerGrayClusterId" jdbcType="VARCHAR" /> | ||
10 | + <result column="dockergraynamespace" property="dockerGrayNameSpace" jdbcType="VARCHAR" /> | ||
11 | + <result column="dockeronlineclusterid" property="dockerOnlineClusterId" jdbcType="VARCHAR" /> | ||
12 | + <result column="dockeronlinenamespace" property="dockerOnlineNameSpace" jdbcType="VARCHAR" /> | ||
13 | + | ||
14 | + </resultMap> | ||
15 | + | ||
16 | + <sql id="Base_Column_List" > | ||
17 | + id, projectname,projecttype,dockerprojectName,dockergrayclusterid,dockergraynamespace,dockeronlineclusterid,dockeronlinenamespace | ||
18 | + </sql> | ||
19 | + | ||
20 | + <select id="selectCount" resultType="java.lang.Integer"> | ||
21 | + select | ||
22 | + count(1) | ||
23 | + from docker_project | ||
24 | + </select> | ||
25 | + | ||
26 | + <select id="selectByPage" resultMap="BaseResultMap"> | ||
27 | + select | ||
28 | + <include refid="Base_Column_List" /> | ||
29 | + from docker_project | ||
30 | + where 1=1 | ||
31 | + <if test="params.projectType != null" > | ||
32 | + and projecttype = #{params.projectType} | ||
33 | + </if> | ||
34 | + order by id desc | ||
35 | + limit #{startIndex},#{pageSize} | ||
36 | + </select> | ||
37 | + | ||
38 | + <select id="selectById" resultMap="BaseResultMap"> | ||
39 | + select | ||
40 | + <include refid="Base_Column_List" /> | ||
41 | + from docker_project | ||
42 | + where | ||
43 | + id = #{id} | ||
44 | + </select> | ||
45 | + | ||
46 | + <select id="selectByProjectType" resultMap="BaseResultMap"> | ||
47 | + select | ||
48 | + <include refid="Base_Column_List" /> | ||
49 | + from docker_project | ||
50 | + where 1=1 | ||
51 | + <choose> | ||
52 | + <when test="projectType != null && projectType !='' " > | ||
53 | + and projecttype = #{projectType} | ||
54 | + </when> | ||
55 | + <otherwise> | ||
56 | + and 1=2 | ||
57 | + </otherwise> | ||
58 | + </choose> | ||
59 | + </select> | ||
60 | + | ||
61 | + <select id="selectByIdList" resultMap="BaseResultMap"> | ||
62 | + select | ||
63 | + <include refid="Base_Column_List" /> | ||
64 | + from docker_project | ||
65 | + where 1=1 | ||
66 | + <choose> | ||
67 | + <when test="idList != null && idList.size > 0" > | ||
68 | + and | ||
69 | + <foreach open="(" close=")" item="item" index="index" collection="idList" separator="or"> | ||
70 | + id = #{item} | ||
71 | + </foreach> | ||
72 | + </when> | ||
73 | + <otherwise> | ||
74 | + and 1=2 | ||
75 | + </otherwise> | ||
76 | + </choose> | ||
77 | + </select> | ||
78 | + | ||
79 | +</mapper> |
1 | -package com.monitor.other.worksystem.dock; | 1 | +package com.monitor.other.worksystem.ctrl; |
2 | 2 | ||
3 | import com.alibaba.fastjson.JSONArray; | 3 | import com.alibaba.fastjson.JSONArray; |
4 | -import com.model.ReleaseWorkJob; | 4 | +import com.model.DockerProjectModel; |
5 | +import com.monitor.model.request.DockerJenkinsReq; | ||
5 | import com.monitor.model.response.BaseResponse; | 6 | import com.monitor.model.response.BaseResponse; |
6 | import com.monitor.other.worksystem.dock.qq.DockerServerDeployService; | 7 | import com.monitor.other.worksystem.dock.qq.DockerServerDeployService; |
7 | -import com.monitor.other.worksystem.service.ReleaseService; | 8 | +import com.monitor.other.worksystem.service.DockerProjectService; |
9 | +import org.apache.commons.lang.StringUtils; | ||
8 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
9 | import org.springframework.stereotype.Controller; | 11 | import org.springframework.stereotype.Controller; |
12 | +import org.springframework.web.bind.annotation.RequestBody; | ||
10 | import org.springframework.web.bind.annotation.RequestMapping; | 13 | import org.springframework.web.bind.annotation.RequestMapping; |
11 | import org.springframework.web.bind.annotation.ResponseBody; | 14 | import org.springframework.web.bind.annotation.ResponseBody; |
12 | 15 | ||
13 | -import java.util.HashMap; | 16 | +import java.util.ArrayList; |
17 | +import java.util.List; | ||
14 | import java.util.Map; | 18 | import java.util.Map; |
15 | 19 | ||
16 | @Controller | 20 | @Controller |
17 | -@RequestMapping("/work/docker") | ||
18 | -public class DockerServerDeployCtrl { | 21 | +@RequestMapping("/dockerProject") |
22 | +public class DockerProjectCtrl { | ||
23 | + | ||
19 | @Autowired | 24 | @Autowired |
20 | - private ReleaseService releaseService; | 25 | + private DockerProjectService dockerProjectService; |
26 | + | ||
21 | @Autowired | 27 | @Autowired |
22 | private DockerServerDeployService dockerServerDeployService; | 28 | private DockerServerDeployService dockerServerDeployService; |
23 | 29 | ||
30 | + /** | ||
31 | + * 查询docker项目 | ||
32 | + */ | ||
33 | + @RequestMapping("/getDockerProjectByType") | ||
34 | + @ResponseBody | ||
35 | + public BaseResponse<List<DockerProjectModel>> getDockerProjectByType(String projectType) { | ||
36 | + return new BaseResponse<>(dockerProjectService.selectByProjectType(projectType)); | ||
37 | + } | ||
38 | + | ||
39 | + /** | ||
40 | + * 查询docker项目 | ||
41 | + */ | ||
42 | + @RequestMapping("/getDockerProjectByIds") | ||
43 | + @ResponseBody | ||
44 | + public BaseResponse<List<DockerProjectModel>> getDockerProjectByIds(String ids) { | ||
45 | + List<Integer> idList=new ArrayList<>(); | ||
46 | + for(String id:ids.split(",")){ | ||
47 | + if(StringUtils.isNotBlank(id)){ | ||
48 | + idList.add(Integer.parseInt(id.trim())); | ||
49 | + } | ||
50 | + } | ||
51 | + return new BaseResponse<>(dockerProjectService.selectByIdList(idList)); | ||
52 | + } | ||
24 | 53 | ||
25 | /** | 54 | /** |
26 | * 发布工单_jenkins:发起镜像制作 | 55 | * 发布工单_jenkins:发起镜像制作 |
27 | */ | 56 | */ |
28 | @RequestMapping("/createMirror") | 57 | @RequestMapping("/createMirror") |
29 | @ResponseBody | 58 | @ResponseBody |
30 | - public BaseResponse createMirror() { | ||
31 | - ReleaseWorkJob releaseWorkJob=new ReleaseWorkJob(); | ||
32 | - int jobId=releaseService.jenkinsBuild(releaseWorkJob); | 59 | + public BaseResponse createMirror(@RequestBody DockerJenkinsReq dockerJenkinsReq) { |
60 | + String id=dockerProjectService.jenkinsBuild(dockerJenkinsReq); | ||
61 | + BaseResponse rnt=new BaseResponse(); | ||
62 | + if(id==null||id.length()<=0){ | ||
63 | + rnt.setCode(201); | ||
64 | + rnt.setMessage("请求镜像失败,返回jobId = " +id); | ||
65 | + }else{ | ||
66 | + rnt.setData(id); | ||
67 | + } | ||
68 | + return rnt; | ||
69 | + } | ||
70 | + | ||
71 | + /** | ||
72 | + * 发布工单_jenkins:更新镜像的状态 | ||
73 | + */ | ||
74 | + @RequestMapping("/updateJenkinsStatus") | ||
75 | + @ResponseBody | ||
76 | + public BaseResponse updateJenkinsStatus(String ticketID,String jobID,String status) { | ||
77 | + dockerProjectService.jenkinsStatusUpdate(ticketID,jobID,status); | ||
33 | BaseResponse rnt=new BaseResponse(); | 78 | BaseResponse rnt=new BaseResponse(); |
34 | - rnt.setData(jobId); | ||
35 | return rnt; | 79 | return rnt; |
36 | } | 80 | } |
37 | 81 | ||
38 | /** | 82 | /** |
83 | + * 发布工单_jenkins:更新镜像的状态 | ||
84 | + */ | ||
85 | + @RequestMapping("/queryJenkinsStatus") | ||
86 | + @ResponseBody | ||
87 | + public BaseResponse queryJenkinsStatus(String ticketID,String jobID,String status) { | ||
88 | + dockerProjectService.jenkinsStatusUpdate(ticketID,jobID,status); | ||
89 | + BaseResponse rnt=new BaseResponse(); | ||
90 | + return rnt; | ||
91 | + } | ||
92 | + | ||
93 | + | ||
94 | + /** | ||
39 | * 发布docker服务 | 95 | * 发布docker服务 |
40 | */ | 96 | */ |
41 | @RequestMapping("/deployMirror") | 97 | @RequestMapping("/deployMirror") |
1 | package com.monitor.other.worksystem.dock; | 1 | package com.monitor.other.worksystem.dock; |
2 | 2 | ||
3 | -import com.model.ReleaseWorkJob; | ||
4 | import com.monitor.model.response.BaseResponse; | 3 | import com.monitor.model.response.BaseResponse; |
5 | import com.monitor.other.worksystem.service.ReleaseService; | 4 | import com.monitor.other.worksystem.service.ReleaseService; |
6 | import org.springframework.beans.factory.annotation.Autowired; | 5 | import org.springframework.beans.factory.annotation.Autowired; |
@@ -14,15 +13,6 @@ public class JenkinsCtrl { | @@ -14,15 +13,6 @@ public class JenkinsCtrl { | ||
14 | @Autowired | 13 | @Autowired |
15 | private ReleaseService releaseService; | 14 | private ReleaseService releaseService; |
16 | 15 | ||
17 | - /** | ||
18 | - * 发布工单_jenkins:更新镜像的状态 | ||
19 | - */ | ||
20 | - @RequestMapping("/updateStatus") | ||
21 | - @ResponseBody | ||
22 | - public BaseResponse updateStatus(String ticketID,String status,String jobID) { | ||
23 | - BaseResponse rnt=new BaseResponse(); | ||
24 | - rnt.setData(releaseService.jenkinsStatusUpdate(ticketID,status,jobID)); | ||
25 | - return rnt; | ||
26 | - } | 16 | + |
27 | 17 | ||
28 | } | 18 | } |
monitor-service-other/src/main/java/com/monitor/other/worksystem/service/DockerProjectService.java
0 → 100644
1 | +package com.monitor.other.worksystem.service; | ||
2 | + | ||
3 | +import com.model.DockerProjectModel; | ||
4 | +import com.model.PendingJob; | ||
5 | +import com.monitor.model.request.DockerJenkinsReq; | ||
6 | +import com.monitor.model.request.WorkSystemReq; | ||
7 | +import com.monitor.model.response.PageResponse; | ||
8 | + | ||
9 | +import java.util.List; | ||
10 | + | ||
11 | +/** | ||
12 | + * Created by craig.qin | ||
13 | + */ | ||
14 | +public interface DockerProjectService { | ||
15 | + List<DockerProjectModel> selectByIdList(List<Integer> idList); | ||
16 | + | ||
17 | + List<DockerProjectModel> selectByProjectType(String projectType); | ||
18 | + | ||
19 | + String jenkinsBuild(DockerJenkinsReq dockerJenkinsReq); | ||
20 | + | ||
21 | + void jenkinsStatusUpdate(String ticketID,String jobID,String status); | ||
22 | + | ||
23 | + String queryJenkinsStatus(String id); | ||
24 | +} |
@@ -27,8 +27,4 @@ public interface ReleaseService { | @@ -27,8 +27,4 @@ public interface ReleaseService { | ||
27 | 27 | ||
28 | int updateByTestId(String testId, String testMessage); | 28 | int updateByTestId(String testId, String testMessage); |
29 | 29 | ||
30 | - int jenkinsBuild(ReleaseWorkJob releaseWorkJob); | ||
31 | - | ||
32 | - int jenkinsStatusUpdate(String ticketID,String status,String jobID); | ||
33 | - | ||
34 | } | 30 | } |
1 | +package com.monitor.other.worksystem.service.impl; | ||
2 | + | ||
3 | +import com.model.*; | ||
4 | +import com.monitor.common.service.MailService; | ||
5 | +import com.monitor.model.domain.Mail; | ||
6 | +import com.monitor.model.request.DockerJenkinsReq; | ||
7 | +import com.monitor.mysql.mapper.*; | ||
8 | +import com.monitor.other.worksystem.contants.HandleType; | ||
9 | +import com.monitor.other.worksystem.contants.HandlerRole; | ||
10 | +import com.monitor.other.worksystem.contants.WorkStatus; | ||
11 | +import com.monitor.other.worksystem.contants.WorkType; | ||
12 | +import com.monitor.other.worksystem.dock.FastJenkinsUtils; | ||
13 | +import com.monitor.other.worksystem.service.DBService; | ||
14 | +import com.monitor.other.worksystem.service.DockerProjectService; | ||
15 | +import org.apache.commons.lang.StringUtils; | ||
16 | +import org.slf4j.Logger; | ||
17 | +import org.slf4j.LoggerFactory; | ||
18 | +import org.springframework.beans.factory.annotation.Autowired; | ||
19 | +import org.springframework.stereotype.Service; | ||
20 | + | ||
21 | +import java.util.*; | ||
22 | + | ||
23 | +/** | ||
24 | + * Created by zhengyouwei on 2016/9/2. | ||
25 | + */ | ||
26 | +@Service | ||
27 | +public class DockerProjectServiceImpl implements DockerProjectService { | ||
28 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
29 | + | ||
30 | + @Autowired | ||
31 | + private DockerProjectMapper dockerProjectMapper; | ||
32 | + | ||
33 | + @Autowired | ||
34 | + private DockerJenkinsRecordMapper dockerJenkinsRecordMapper; | ||
35 | + | ||
36 | + public List<DockerProjectModel> selectByIdList(List<Integer> idList){ | ||
37 | + if(idList==null||idList.size()<=0){ | ||
38 | + return new ArrayList<>(); | ||
39 | + } | ||
40 | + return dockerProjectMapper.selectByIdList(idList); | ||
41 | + } | ||
42 | + | ||
43 | + public List<DockerProjectModel> selectByProjectType(String projectType){ | ||
44 | + if(StringUtils.isBlank(projectType)){ | ||
45 | + return new ArrayList<>(); | ||
46 | + } | ||
47 | + return dockerProjectMapper.selectByProjectType(projectType); | ||
48 | + } | ||
49 | + | ||
50 | + @Override | ||
51 | + public String jenkinsBuild(DockerJenkinsReq dockerJenkinsReq){ | ||
52 | + String appNames=dockerJenkinsReq.getAppNames(); | ||
53 | + String uuid = UUID.randomUUID().toString(); | ||
54 | + uuid=appNames+"-"+uuid.replace("-", ""); | ||
55 | + Map params= new HashMap(); | ||
56 | + params.put("ticketID", uuid); | ||
57 | + params.put("appNames",appNames); | ||
58 | + params.put("branch",dockerJenkinsReq.getBranch()); | ||
59 | + params.put("nodeEnv",dockerJenkinsReq.getNodeEnv()); | ||
60 | + params.put("userMail",dockerJenkinsReq.getUserMail()); | ||
61 | + try{ | ||
62 | + DockerJenkinsRecord record=new DockerJenkinsRecord(); | ||
63 | + record.setId(uuid); | ||
64 | + record.setProjectName(dockerJenkinsReq.getAppNames()); | ||
65 | + record.setReleaseWorkId(dockerJenkinsReq.getReleaseWorkId()); | ||
66 | + dockerJenkinsRecordMapper.insert(record); | ||
67 | + | ||
68 | + FastJenkinsUtils fastJenkinsUtils=new FastJenkinsUtils(); | ||
69 | + fastJenkinsUtils.createJob(FastJenkinsUtils.JENKINS_JOB_NODE,params); | ||
70 | + }catch (Exception e){ | ||
71 | + logger.error("jenkinsBuild error",e); | ||
72 | + return ""; | ||
73 | + } | ||
74 | + return uuid; | ||
75 | + } | ||
76 | + | ||
77 | + @Override | ||
78 | + public void jenkinsStatusUpdate(String ticketID,String jobID,String status){ | ||
79 | + dockerJenkinsRecordMapper.updateJob(ticketID,jobID,status); | ||
80 | + } | ||
81 | + | ||
82 | + @Override | ||
83 | + public String queryJenkinsStatus(String id){ | ||
84 | + dockerJenkinsRecordMapper.s | ||
85 | + } | ||
86 | + | ||
87 | +} |
@@ -15,16 +15,12 @@ import com.monitor.other.worksystem.contants.HandleType; | @@ -15,16 +15,12 @@ import com.monitor.other.worksystem.contants.HandleType; | ||
15 | import com.monitor.other.worksystem.contants.HandlerRole; | 15 | import com.monitor.other.worksystem.contants.HandlerRole; |
16 | import com.monitor.other.worksystem.contants.WorkStatus; | 16 | import com.monitor.other.worksystem.contants.WorkStatus; |
17 | import com.monitor.other.worksystem.contants.WorkType; | 17 | import com.monitor.other.worksystem.contants.WorkType; |
18 | -import com.monitor.other.worksystem.dock.FastJenkinsUtils; | ||
19 | import com.monitor.other.worksystem.service.ReleaseService; | 18 | import com.monitor.other.worksystem.service.ReleaseService; |
20 | import org.apache.commons.lang.StringUtils; | 19 | import org.apache.commons.lang.StringUtils; |
21 | import org.springframework.beans.factory.annotation.Autowired; | 20 | import org.springframework.beans.factory.annotation.Autowired; |
22 | import org.springframework.stereotype.Service; | 21 | import org.springframework.stereotype.Service; |
23 | 22 | ||
24 | -import java.util.HashMap; | ||
25 | import java.util.List; | 23 | import java.util.List; |
26 | -import java.util.Map; | ||
27 | -import java.util.UUID; | ||
28 | 24 | ||
29 | /** | 25 | /** |
30 | * Created by zhengyouwei on 2016/9/2. | 26 | * Created by zhengyouwei on 2016/9/2. |
@@ -267,35 +263,4 @@ public class ReleaseServiceImpl implements ReleaseService { | @@ -267,35 +263,4 @@ public class ReleaseServiceImpl implements ReleaseService { | ||
267 | public int updateByTestId(String testId, String testMessage) { | 263 | public int updateByTestId(String testId, String testMessage) { |
268 | return releaseWorkJobMapper.updateByTestId(testId, testMessage); | 264 | return releaseWorkJobMapper.updateByTestId(testId, testMessage); |
269 | } | 265 | } |
270 | - | ||
271 | - @Override | ||
272 | - public int jenkinsBuild(ReleaseWorkJob releaseWorkJob){ | ||
273 | - releaseWorkJob.setId("release0004377"); | ||
274 | - | ||
275 | - Map params= new HashMap(); | ||
276 | - params.put("appNames","yohoblk-wap"); | ||
277 | - params.put("branch","feature/docker"); | ||
278 | - params.put("nodeEnv","ONLINE-QCLOUD"); | ||
279 | - params.put("userMail","craig.qin@yoho.cn"); | ||
280 | - | ||
281 | - String uuid = UUID.randomUUID().toString(); | ||
282 | - uuid=params.get("appNames")+"-"+uuid.replace("-", ""); | ||
283 | - params.put("ticketID", uuid); | ||
284 | - | ||
285 | - //更新发布工单的jenkins_build_id | ||
286 | - releaseWorkJobMapper.updateJenkinsBuildId(releaseWorkJob); | ||
287 | - | ||
288 | - FastJenkinsUtils fastJenkinsUtils=new FastJenkinsUtils(); | ||
289 | - int jobId=fastJenkinsUtils.createJob(FastJenkinsUtils.JENKINS_JOB_NODE,params); | ||
290 | - return jobId; | ||
291 | - } | ||
292 | - | ||
293 | - @Override | ||
294 | - public int jenkinsStatusUpdate(String ticketID,String status,String jobID){ | ||
295 | - ReleaseWorkJob releaseWorkJob=new ReleaseWorkJob(); | ||
296 | - releaseWorkJob.setJenkinsBuildId(ticketID); | ||
297 | - releaseWorkJob.setJenkinsBuildStatus(status); | ||
298 | - releaseWorkJob.setJenkinsJobId(jobID); | ||
299 | - return releaseWorkJobMapper.updateJenkinsBuildStatus(releaseWorkJob); | ||
300 | - } | ||
301 | } | 266 | } |
-
Please register or login to post a comment