Search in sources :

Example 11 with ApplicationVcsDO

use of com.orion.ops.entity.domain.ApplicationVcsDO in project orion-ops by lijiahangmax.

the class CleanVcsStatusRunner method checkFinished.

/**
 * 检查已初始化的数据
 */
private void checkFinished() {
    LambdaQueryWrapper<ApplicationVcsDO> wrapper = new LambdaQueryWrapper<ApplicationVcsDO>().eq(ApplicationVcsDO::getVcsStatus, VcsStatus.OK.getStatus());
    List<ApplicationVcsDO> vcsList = applicationVcsDAO.selectList(wrapper);
    for (ApplicationVcsDO vcs : vcsList) {
        // 检查是否存在
        Long id = vcs.getId();
        File clonePath = new File(Utils.getVcsEventDir(id));
        if (Files1.isDirectory(clonePath)) {
            continue;
        }
        // 更新状态
        ApplicationVcsDO update = new ApplicationVcsDO();
        update.setId(id);
        update.setVcsStatus(VcsStatus.UNINITIALIZED.getStatus());
        applicationVcsDAO.updateById(update);
        log.info("重置版本仓库状态-重置 id: {}, clonePath: {}", id, clonePath);
    }
}
Also used : ApplicationVcsDO(com.orion.ops.entity.domain.ApplicationVcsDO) File(java.io.File)

Aggregations

ApplicationVcsDO (com.orion.ops.entity.domain.ApplicationVcsDO)11 File (java.io.File)8 Gits (com.orion.vcs.git.Gits)3 Transactional (org.springframework.transaction.annotation.Transactional)2 LambdaQueryWrapper (com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)1 DataGrid (com.orion.lang.wrapper.DataGrid)1 Const (com.orion.ops.consts.Const)1 MessageConst (com.orion.ops.consts.MessageConst)1 VcsAuthType (com.orion.ops.consts.app.VcsAuthType)1 VcsStatus (com.orion.ops.consts.app.VcsStatus)1 VcsTokenType (com.orion.ops.consts.app.VcsTokenType)1 VcsType (com.orion.ops.consts.app.VcsType)1 EventKeys (com.orion.ops.consts.event.EventKeys)1 EventParamsHolder (com.orion.ops.consts.event.EventParamsHolder)1 SystemEnvAttr (com.orion.ops.consts.system.SystemEnvAttr)1 ApplicationBuildDAO (com.orion.ops.dao.ApplicationBuildDAO)1 ApplicationInfoDAO (com.orion.ops.dao.ApplicationInfoDAO)1 ApplicationVcsDAO (com.orion.ops.dao.ApplicationVcsDAO)1 ApplicationVcsRequest (com.orion.ops.entity.request.ApplicationVcsRequest)1 ApplicationVcsBranchVO (com.orion.ops.entity.vo.ApplicationVcsBranchVO)1