private DeploymentState getDeploymentStateFromStatusInfo(Info info) { switch (info.getStatus().getStatusCode()) { case FAILED: return DeploymentState.failed; case DELETED: return DeploymentState.undeployed; case UNKNOWN: return DeploymentState.unknown; case DEPLOYED: return DeploymentState.deployed; } return DeploymentState.unknown; }
private void updateInstallComplete(Release release) { Status status = new Status(); status.setStatusCode(StatusCode.DEPLOYED); release.getInfo().setStatus(status); release.getInfo().setDescription("Install complete"); }
/** * Create a new Info instance with the given description, first deployed and last deployed dates * set to the current date-time, and StatusCode.UNKNOWN. * @param description a string describing the general info status at a level finer than StatusCode * @return a new Info object */ public static Info createNewInfo(String description) { Info info = new Info(); info.setFirstDeployed(new Date()); info.setLastDeployed(new Date()); Status status = new Status(); status.setStatusCode(StatusCode.UNKNOWN); info.setStatus(status); info.setDescription(description); return info; } }
if (checkInfo(info)) { boolean isNewApp = (info.getLastDeployed().getTime() > (now - 120000)); log.debug("Considering updating state for {}-v{}", release.getName(), release.getVersion()); log.debug("fullPoll = {}, isNewApp = {}", fullPoll, isNewApp); try { release = releaseManager.status(release); log.debug("New Release state {} {}", release.getName(), release.getInfo().getStatus(), release.getInfo().getStatus() != null ? release.getInfo().getStatus().getPlatformStatusPrettyPrint() : ""); this.releaseRepository.save(release);
@ShellMethod(key = "release status", value = "Status for a last known release version.") public Object status( @ShellOption(help = "release name") @NotNull String releaseName, @ShellOption(help = "the specific release version.", defaultValue = NULL) Integer releaseVersion) { Info info; try { if (releaseVersion == null) { info = this.skipperClient.status(releaseName); } else { info = this.skipperClient.status(releaseName, releaseVersion); } } catch (ReleaseNotFoundException e) { return "Release with name '" + e.getReleaseName() + "' not found"; } Object[][] data = new Object[3][]; data[0] = new Object[] { "Last Deployed", info.getFirstDeployed() }; data[1] = new Object[] { "Status", info.getStatus().getStatusCode().toString() }; DeploymentState aggregateState = aggregateState(info.getStatus().getDeploymentStateList()); StringBuilder sb = new StringBuilder(); sb.append(DeploymentStateDisplay.fromKey(aggregateState.name()).getDescription() + "\n"); sb.append(info.getStatus().getPlatformStatusPrettyPrint()); data[2] = new Object[] { "Platform Status", sb.toString() }; TableModel model = new ArrayTableModel(data); TableBuilder tableBuilder = new TableBuilder(model); TableUtils.applyStyleNoHeader(tableBuilder); return tableBuilder.build(); }
protected Info createNewInfo() { return Info.createNewInfo("Initial install underway"); }
private boolean checkInfo(Info info) { if (info == null) { throw new IllegalStateException("Info can not be null."); } if (info.getLastDeployed() == null) { throw new IllegalStateException("Info.LastDeployed can not be null."); } return true; }
if (checkInfo(info)) { boolean isNewApp = (info.getLastDeployed().getTime() > (now - 120000)); log.debug("Considering updating state for {}-v{}", release.getName(), release.getVersion()); log.debug("fullPoll = {}, isNewApp = {}", fullPoll, isNewApp); try { release = releaseManager.status(release); log.debug("New Release state {} {}", release.getName(), release.getInfo().getStatus(), release.getInfo().getStatus() != null ? release.getInfo().getStatus().getPlatformStatusPrettyPrint() : ""); this.releaseRepository.save(release);
protected Info createNewInfo() { return Info.createNewInfo("Initial install underway"); }
private boolean checkInfo(Info info) { if (info == null) { throw new IllegalStateException("Info can not be null."); } if (info.getLastDeployed() == null) { throw new IllegalStateException("Info.LastDeployed can not be null."); } return true; }
private void updateInstallComplete(Release release) { Status status = new Status(); status.setStatusCode(StatusCode.DEPLOYED); release.getInfo().setStatus(status); release.getInfo().setDescription("Install complete"); }
private DeploymentState getDeploymentStateFromStatusInfo(Info info) { switch (info.getStatus().getStatusCode()) { case FAILED: return DeploymentState.failed; case DELETED: return DeploymentState.undeployed; case UNKNOWN: return DeploymentState.unknown; case DEPLOYED: return DeploymentState.deployed; } return DeploymentState.unknown; }
/** * Create a new Info instance with the given description, first deployed and last deployed dates * set to the current date-time, and StatusCode.UNKNOWN. * @param description a string describing the general info status at a level finer than StatusCode * @return a new Info object */ public static Info createNewInfo(String description) { Info info = new Info(); info.setFirstDeployed(new Date()); info.setLastDeployed(new Date()); Status status = new Status(); status.setStatusCode(StatusCode.UNKNOWN); info.setStatus(status); info.setDescription(description); return info; } }
private Release createReleaseForUpgrade(PackageMetadata packageMetadata, Integer newVersion, UpgradeProperties upgradeProperties, String platformName, RollbackRequest rollbackRequest) { Assert.notNull(upgradeProperties, "Upgrade Properties can not be null"); Package packageToInstall = this.packageService.downloadPackage(packageMetadata); Release release = new Release(); release.setName(upgradeProperties.getReleaseName()); release.setPlatformName(platformName); release.setConfigValues(upgradeProperties.getConfigValues()); release.setPkg(packageToInstall); release.setVersion(newVersion); // we simply differentiate between upgrade/rollback if we know there is a rollback request Info info = Info .createNewInfo(rollbackRequest == null ? "Upgrade install underway" : "Rollback install underway"); release.setInfo(info); return release; }
private void updateInstallComplete(Release release) { Status status = new Status(); status.setStatusCode(StatusCode.DEPLOYED); release.getInfo().setStatus(status); release.getInfo().setDescription("Install complete"); }
private List<AppStatus> skipperStatus(String streamName) { List<AppStatus> appStatuses = new ArrayList<>(); try { Info info = this.skipperClient.status(streamName); appStatuses.addAll(info.getStatus().getAppStatusList()); } catch (Exception e) { // ignore as we query status for all the streams. } return appStatuses; }
private Release createReleaseForUpgrade(PackageMetadata packageMetadata, Integer newVersion, UpgradeProperties upgradeProperties, String platformName, RollbackRequest rollbackRequest) { Assert.notNull(upgradeProperties, "Upgrade Properties can not be null"); Package packageToInstall = this.packageService.downloadPackage(packageMetadata); Release release = new Release(); release.setName(upgradeProperties.getReleaseName()); release.setPlatformName(platformName); release.setConfigValues(upgradeProperties.getConfigValues()); release.setPkg(packageToInstall); release.setVersion(newVersion); // we simply differentiate between upgrade/rollback if we know there is a rollback request Info info = Info .createNewInfo(rollbackRequest == null ? "Upgrade install underway" : "Rollback install underway"); release.setInfo(info); return release; }
private void updateReplacingReleaseState(Release replacingRelease, boolean rollback) { // Update Status in DB Status status = new Status(); status.setStatusCode(StatusCode.DEPLOYED); replacingRelease.getInfo().setStatus(status); replacingRelease.getInfo().setDescription(rollback ? "Rollback complete" : "Upgrade complete"); this.releaseRepository.save(replacingRelease); logger.info("Release {}-v{} has been DEPLOYED", replacingRelease.getName(), replacingRelease.getVersion()); logger.info("Apps in release {}-v{} are healthy.", replacingRelease.getName(), replacingRelease.getVersion()); }
private void updateStatus(StringBuilder sb, Release release) { sb.append("Release Status: " + release.getInfo().getStatus().getStatusCode() + "\n"); if (StringUtils.hasText(release.getInfo().getStatus().getPlatformStatus())) { sb.append("Platform Status: " + release.getInfo().getStatus().getPlatformStatusPrettyPrint()); } else { sb.append("Platform Status: unknown"); } }
@Transactional public List<String> deployApps(Release existingRelease, Release replacingRelease, ReleaseAnalysisReport releaseAnalysisReport) { List<String> applicationNamesToUpgrade = new ArrayList<>(); try { applicationNamesToUpgrade = releaseAnalysisReport.getApplicationNamesToUpgrade(); deployCFApp(replacingRelease); } catch (DataAccessException e) { throw e; } catch (Exception e) { Status status = new Status(); status.setStatusCode(StatusCode.FAILED); replacingRelease.getInfo().setStatus(status); replacingRelease.getInfo().setStatus(status); replacingRelease.getInfo().setDescription("Could not deploy app."); this.releaseRepository.save(replacingRelease); } return applicationNamesToUpgrade; }