Search in sources :

Example 1 with BuildHistoryLog

use of io.jpom.model.log.BuildHistoryLog in project Jpom by dromara.

the class DbBuildHistoryLogService method updateResultDirFile.

// /**
// * 更新状态
// *
// * @param logId  记录id
// * @param status 状态
// */
// public void updateLog(String logId, BuildStatus status) {
// if (logId == null) {
// return;
// }
// BuildHistoryLog buildHistoryLog = new BuildHistoryLog();
// buildHistoryLog.setId(logId);
// buildHistoryLog.setStatus(status.getCode());
// if (status != BuildStatus.PubIng) {
// // 结束
// buildHistoryLog.setEndTime(SystemClock.now());
// }
// this.update(buildHistoryLog);
// }
/**
 * 更新状态
 *
 * @param logId         记录id
 * @param resultDirFile 构建产物目录
 */
public void updateResultDirFile(String logId, String resultDirFile) {
    if (logId == null || StrUtil.isEmpty(resultDirFile)) {
        return;
    }
    BuildHistoryLog buildHistoryLog = new BuildHistoryLog();
    buildHistoryLog.setId(logId);
    buildHistoryLog.setResultDirFile(resultDirFile);
    this.update(buildHistoryLog);
}
Also used : BuildHistoryLog(io.jpom.model.log.BuildHistoryLog)

Example 2 with BuildHistoryLog

use of io.jpom.model.log.BuildHistoryLog in project Jpom by dromara.

the class BuildInfoManageController method reRelease.

/**
 * 重新发布
 *
 * @param logId logId
 * @return json
 */
@RequestMapping(value = "/build/manage/reRelease", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
@Feature(method = MethodFeature.EXECUTE)
public String reRelease(@ValidatorConfig(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "没有数据")) String logId) {
    BuildHistoryLog buildHistoryLog = dbBuildHistoryLogService.getByKey(logId, getRequest());
    Objects.requireNonNull(buildHistoryLog, "没有对应构建记录.");
    BuildInfoModel item = buildInfoService.getByKey(buildHistoryLog.getBuildDataId());
    Objects.requireNonNull(item, "没有对应数据");
    String e = buildExecuteService.checkStatus(item.getStatus());
    Assert.isNull(e, () -> e);
    UserModel userModel = getUser();
    BuildExtraModule buildExtraModule = BuildExtraModule.build(buildHistoryLog);
    // new BuildExtraModule();
    // buildExtraModule.updateValue(buildHistoryLog);
    ReleaseManage manage = ReleaseManage.builder().buildExtraModule(buildExtraModule).logId(buildHistoryLog.getId()).userModel(userModel).buildId(buildHistoryLog.getBuildNumberId()).buildExecuteService(buildExecuteService).build();
    // ReleaseManage releaseManage = new ReleaseManage(buildHistoryLog, userModel);
    // 标记发布中
    // releaseManage.updateStatus(BuildStatus.PubIng);
    ThreadUtil.execute(manage);
    return JsonMessage.getString(200, "重新发布中");
}
Also used : UserModel(io.jpom.model.data.UserModel) BuildHistoryLog(io.jpom.model.log.BuildHistoryLog) ReleaseManage(io.jpom.build.ReleaseManage) BuildExtraModule(io.jpom.build.BuildExtraModule) BuildInfoModel(io.jpom.model.data.BuildInfoModel) Feature(io.jpom.permission.Feature) MethodFeature(io.jpom.permission.MethodFeature) ClassFeature(io.jpom.permission.ClassFeature) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with BuildHistoryLog

use of io.jpom.model.log.BuildHistoryLog in project Jpom by dromara.

the class BuildInfoHistoryController method downloadLog.

@RequestMapping(value = "/build/history/download_log.html", method = RequestMethod.GET)
@ResponseBody
@Feature(method = MethodFeature.DOWNLOAD)
public void downloadLog(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "没有数据") String logId) throws IOException {
    BuildHistoryLog buildHistoryLog = dbBuildHistoryLogService.getByKey(logId);
    Objects.requireNonNull(buildHistoryLog);
    BuildInfoModel item = buildInfoService.getByKey(buildHistoryLog.getBuildDataId());
    Objects.requireNonNull(item);
    File logFile = BuildUtil.getLogFile(item.getId(), buildHistoryLog.getBuildNumberId());
    if (!FileUtil.exist(logFile)) {
        return;
    }
    if (logFile.isFile()) {
        ServletUtil.write(getResponse(), logFile);
    }
}
Also used : BuildHistoryLog(io.jpom.model.log.BuildHistoryLog) File(java.io.File) BuildInfoModel(io.jpom.model.data.BuildInfoModel) ClassFeature(io.jpom.permission.ClassFeature) Feature(io.jpom.permission.Feature) MethodFeature(io.jpom.permission.MethodFeature) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 4 with BuildHistoryLog

use of io.jpom.model.log.BuildHistoryLog in project Jpom by dromara.

the class BuildInfoHistoryController method historyList.

@RequestMapping(value = "/build/history/history_list.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
@Feature(method = MethodFeature.LIST)
public String historyList() {
    PageResultDto<BuildHistoryLog> pageResultTemp = dbBuildHistoryLogService.listPage(getRequest());
    pageResultTemp.each(buildHistoryLog -> {
        File file = BuildUtil.getHistoryPackageFile(buildHistoryLog.getBuildDataId(), buildHistoryLog.getBuildNumberId(), buildHistoryLog.getResultDirFile());
        buildHistoryLog.setHashFile(FileUtil.exist(file));
        // 
        File logFile = BuildUtil.getLogFile(buildHistoryLog.getBuildDataId(), buildHistoryLog.getBuildNumberId());
        buildHistoryLog.setHasLog(FileUtil.exist(logFile));
    });
    return JsonMessage.getString(200, "获取成功", pageResultTemp);
}
Also used : BuildHistoryLog(io.jpom.model.log.BuildHistoryLog) File(java.io.File) ClassFeature(io.jpom.permission.ClassFeature) Feature(io.jpom.permission.Feature) MethodFeature(io.jpom.permission.MethodFeature) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 5 with BuildHistoryLog

use of io.jpom.model.log.BuildHistoryLog in project Jpom by dromara.

the class BuildInfoHistoryController method delete.

/**
 * 构建
 *
 * @param logId id
 * @return json
 */
@RequestMapping(value = "/build/history/delete_log.json", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
@Feature(method = MethodFeature.DEL)
public String delete(@ValidatorConfig(@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "没有数据")) String logId) {
    BuildHistoryLog buildHistoryLog = dbBuildHistoryLogService.getByKey(logId, getRequest());
    Objects.requireNonNull(buildHistoryLog);
    JsonMessage<String> jsonMessage = dbBuildHistoryLogService.deleteLogAndFile(buildHistoryLog);
    return jsonMessage.toString();
}
Also used : BuildHistoryLog(io.jpom.model.log.BuildHistoryLog) ClassFeature(io.jpom.permission.ClassFeature) Feature(io.jpom.permission.Feature) MethodFeature(io.jpom.permission.MethodFeature) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

BuildHistoryLog (io.jpom.model.log.BuildHistoryLog)9 ClassFeature (io.jpom.permission.ClassFeature)6 Feature (io.jpom.permission.Feature)6 MethodFeature (io.jpom.permission.MethodFeature)6 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)6 BuildInfoModel (io.jpom.model.data.BuildInfoModel)5 File (java.io.File)4 JSONObject (com.alibaba.fastjson.JSONObject)1 BuildExtraModule (io.jpom.build.BuildExtraModule)1 ReleaseManage (io.jpom.build.ReleaseManage)1 UserModel (io.jpom.model.data.UserModel)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1