use of com.ctrip.framework.apollo.common.dto.ReleaseDTO in project apollo by ctripcorp.
the class NamespaceBranchService method merge.
public ReleaseDTO merge(String appId, Env env, String clusterName, String namespaceName, String branchName, String title, String comment, boolean isEmergencyPublish, boolean deleteBranch) {
ItemChangeSets changeSets = calculateBranchChangeSet(appId, env, clusterName, namespaceName, branchName);
ReleaseDTO mergedResult = releaseService.updateAndPublish(appId, env, clusterName, namespaceName, title, comment, branchName, isEmergencyPublish, deleteBranch, changeSets);
Tracer.logEvent(TracerEventType.MERGE_GRAY_RELEASE, String.format("%s+%s+%s+%s", appId, env, clusterName, namespaceName));
return mergedResult;
}
use of com.ctrip.framework.apollo.common.dto.ReleaseDTO in project apollo by ctripcorp.
the class ReleaseHistoryService method findNamespaceReleaseHistory.
public List<ReleaseHistoryBO> findNamespaceReleaseHistory(String appId, Env env, String clusterName, String namespaceName, int page, int size) {
PageDTO<ReleaseHistoryDTO> result = releaseHistoryAPI.findReleaseHistoriesByNamespace(appId, env, clusterName, namespaceName, page, size);
if (result == null || !result.hasContent()) {
return Collections.emptyList();
}
List<ReleaseHistoryDTO> content = result.getContent();
Set<Long> releaseIds = new HashSet<>();
for (ReleaseHistoryDTO releaseHistoryDTO : content) {
long releaseId = releaseHistoryDTO.getReleaseId();
if (releaseId != 0) {
releaseIds.add(releaseId);
}
}
List<ReleaseDTO> releases = releaseService.findReleaseByIds(env, releaseIds);
return transformReleaseHistoryDTO2BO(content, releases);
}
use of com.ctrip.framework.apollo.common.dto.ReleaseDTO in project apollo by ctripcorp.
the class ReleaseHistoryService method findLatestByReleaseIdAndOperation.
public ReleaseHistoryBO findLatestByReleaseIdAndOperation(Env env, long releaseId, int operation) {
PageDTO<ReleaseHistoryDTO> pageDTO = releaseHistoryAPI.findByReleaseIdAndOperation(env, releaseId, operation, 0, 1);
if (pageDTO != null && pageDTO.hasContent()) {
ReleaseHistoryDTO releaseHistory = pageDTO.getContent().get(0);
ReleaseDTO release = releaseService.findReleaseById(env, releaseHistory.getReleaseId());
return transformReleaseHistoryDTO2BO(releaseHistory, release);
}
return null;
}
use of com.ctrip.framework.apollo.common.dto.ReleaseDTO in project apollo by ctripcorp.
the class ReleaseService method publish.
public ReleaseDTO publish(NamespaceReleaseModel model) {
Env env = model.getEnv();
boolean isEmergencyPublish = model.isEmergencyPublish();
String appId = model.getAppId();
String clusterName = model.getClusterName();
String namespaceName = model.getNamespaceName();
String releaseBy = StringUtils.isEmpty(model.getReleasedBy()) ? userInfoHolder.getUser().getUserId() : model.getReleasedBy();
ReleaseDTO releaseDTO = releaseAPI.createRelease(appId, env, clusterName, namespaceName, model.getReleaseTitle(), model.getReleaseComment(), releaseBy, isEmergencyPublish);
Tracer.logEvent(TracerEventType.RELEASE_NAMESPACE, String.format("%s+%s+%s+%s", appId, env, clusterName, namespaceName));
return releaseDTO;
}
use of com.ctrip.framework.apollo.common.dto.ReleaseDTO in project apollo by ctripcorp.
the class ConfigPublishEmailBuilder method getReleaseCompareResult.
private ReleaseCompareResult getReleaseCompareResult(Env env, ReleaseHistoryBO releaseHistory) {
if (releaseHistory.getOperation() == ReleaseOperation.GRAY_RELEASE && releaseHistory.getPreviousReleaseId() == 0) {
ReleaseDTO masterLatestActiveRelease = releaseService.loadLatestRelease(releaseHistory.getAppId(), env, releaseHistory.getClusterName(), releaseHistory.getNamespaceName());
ReleaseDTO branchLatestActiveRelease = releaseService.findReleaseById(env, releaseHistory.getReleaseId());
return releaseService.compare(masterLatestActiveRelease, branchLatestActiveRelease);
}
return releaseService.compare(env, releaseHistory.getPreviousReleaseId(), releaseHistory.getReleaseId());
}
Aggregations