use of com.netflix.spinnaker.halyard.core.registry.v1.Versions in project halyard by spinnaker.
the class ListVersionCommand method executeThis.
@Override
protected void executeThis() {
String version = new OperationHandler<String>().setOperation(Daemon.getVersion(getCurrentDeployment(), false)).setFailureMesssage("Failed to load your version of Spinnaker.").get();
Versions versions = new OperationHandler<Versions>().setOperation(Daemon.getVersions()).setFailureMesssage("Failed to load available Spinnaker versions.").setSuccessMessage("You are on version \"" + version + "\", and the following are available:").setFormat(AnsiFormatUtils.Format.STRING).setUserFormatted(true).get();
}
use of com.netflix.spinnaker.halyard.core.registry.v1.Versions in project halyard by spinnaker.
the class ArtifactService method publishLatestSpinnaker.
public void publishLatestSpinnaker(String latestSpinnaker) {
if (googleWriteableProfileRegistry == null) {
throw new HalException(new ConfigProblemBuilder(FATAL, "You need to set the \"spinnaker.config.input.writerEnabled\" property to \"true\" to modify BOM contents.").build());
}
Versions versionsCollection = versionsService.getVersions();
boolean hasLatest = versionsCollection.getVersions().stream().anyMatch(v -> v.getVersion().equals(latestSpinnaker));
if (!hasLatest) {
throw new HalException(FATAL, "Version " + latestSpinnaker + " does not exist in the list of published versions");
}
versionsCollection.setLatestSpinnaker(latestSpinnaker);
googleWriteableProfileRegistry.writeVersions(yamlParser.dump(relaxedObjectMapper.convertValue(versionsCollection, Map.class)));
}
use of com.netflix.spinnaker.halyard.core.registry.v1.Versions in project halyard by spinnaker.
the class ArtifactService method publishLatestHalyard.
public void publishLatestHalyard(String latestHalyard) {
if (googleWriteableProfileRegistry == null) {
throw new HalException(new ConfigProblemBuilder(FATAL, "You need to set the \"spinnaker.config.input.writerEnabled\" property to \"true\" to modify BOM contents.").build());
}
Versions versionsCollection = versionsService.getVersions();
versionsCollection.setLatestHalyard(latestHalyard);
googleWriteableProfileRegistry.writeVersions(yamlParser.dump(relaxedObjectMapper.convertValue(versionsCollection, Map.class)));
}
use of com.netflix.spinnaker.halyard.core.registry.v1.Versions in project halyard by spinnaker.
the class ArtifactService method deprecateVersion.
public void deprecateVersion(Version version, String illegalReason) {
if (googleWriteableProfileRegistry == null) {
throw new HalException(new ConfigProblemBuilder(FATAL, "You need to set the \"spinnaker.config.input.writerEnabled\" property to \"true\" to modify your halconfig bucket contents.").build());
}
Versions versionsCollection = versionsService.getVersions();
deleteVersion(versionsCollection, version.getVersion());
if (!StringUtils.isEmpty(illegalReason)) {
List<Versions.IllegalVersion> illegalVersions = versionsCollection.getIllegalVersions();
if (illegalVersions == null) {
illegalVersions = new ArrayList<>();
}
illegalVersions.add(new Versions.IllegalVersion().setVersion(version.getVersion()).setReason(illegalReason));
versionsCollection.setIllegalVersions(illegalVersions);
}
googleWriteableProfileRegistry.writeVersions(yamlParser.dump(relaxedObjectMapper.convertValue(versionsCollection, Map.class)));
}
use of com.netflix.spinnaker.halyard.core.registry.v1.Versions in project halyard by spinnaker.
the class ArtifactService method publishVersion.
public void publishVersion(Version version) {
if (googleWriteableProfileRegistry == null) {
throw new HalException(new ConfigProblemBuilder(FATAL, "You need to set the \"spinnaker.config.input.writerEnabled\" property to \"true\" to modify your halconfig bucket contents.").build());
}
Versions versionsCollection = versionsService.getVersions();
deleteVersion(versionsCollection, version.getVersion());
versionsCollection.getVersions().add(version);
googleWriteableProfileRegistry.writeVersions(yamlParser.dump(relaxedObjectMapper.convertValue(versionsCollection, Map.class)));
}
Aggregations