...
|
...
|
@@ -40,20 +40,23 @@ public class ReleaseRollBack { |
|
|
public void releaseRollBack() {
|
|
|
try {
|
|
|
List<ReleaseWorkJob> list = releaseWorkJobMapper.selectForTask();
|
|
|
for (ReleaseWorkJob releaseWorkJob : list){
|
|
|
if (!"JAVA".equals(releaseWorkJob.getPlatform())){
|
|
|
for (ReleaseWorkJob releaseWorkJob : list) {
|
|
|
if (!"JAVA".equals(releaseWorkJob.getPlatform())) {
|
|
|
continue;
|
|
|
}
|
|
|
String[] environments = releaseWorkJob.getEnvironment().split(",");
|
|
|
String[] projects = releaseWorkJob.getProject().split(",");
|
|
|
for (String environment : environments){
|
|
|
for (String project : projects){
|
|
|
for (String environment : environments) {
|
|
|
if ("qcloud_gray".equals(environment)) {
|
|
|
continue;
|
|
|
}
|
|
|
for (String project : projects) {
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
map.put("project", project);
|
|
|
map.put("environment", environment);
|
|
|
String rollbackJson = httpRestClientService.doGet(url+ "rollbackList", map);
|
|
|
if (rollbackJson != null && !"failed".equals(rollbackJson)){
|
|
|
List<String> rollbackList = JSONArray.parseArray(rollbackJson,String.class);
|
|
|
String rollbackJson = httpRestClientService.doGet(url + "rollbackList", map);
|
|
|
if (rollbackJson != null && !"failed".equals(rollbackJson)) {
|
|
|
List<String> rollbackList = JSONArray.parseArray(rollbackJson, String.class);
|
|
|
BuildRequest buildRequest = new BuildRequest();
|
|
|
buildRequest.setUser("aotoRollback");
|
|
|
buildRequest.setEnvironment(environment);
|
...
|
...
|
@@ -65,13 +68,14 @@ public class ReleaseRollBack { |
|
|
|
|
|
}
|
|
|
}
|
|
|
releaseWorkJob.setStatus(WorkStatus.AUTO_ROLLBACK);
|
|
|
releaseWorkJobMapper.updateRollback(releaseWorkJob);
|
|
|
workSystemSupport.workend(releaseWorkJob.getId(), WorkType.RELEASE_PROJECT,releaseWorkJob.getTitle(),WorkStatus.getCstatus(WorkStatus.AUTO_ROLLBACK));
|
|
|
|
|
|
if (!"qcloud_gray".equals(releaseWorkJob.getEnvironment())){
|
|
|
releaseWorkJob.setStatus(WorkStatus.AUTO_ROLLBACK);
|
|
|
releaseWorkJobMapper.updateRollback(releaseWorkJob);
|
|
|
workSystemSupport.workend(releaseWorkJob.getId(), WorkType.RELEASE_PROJECT, releaseWorkJob.getTitle(), WorkStatus.getCstatus(WorkStatus.AUTO_ROLLBACK));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}catch (Exception e){
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
...
|
...
|
|