use of io.spring.concourse.releasescripts.artifactory.payload.BuildInfoResponse.Status in project spring-boot by spring-projects.
the class ArtifactoryService method isAlreadyPromoted.
private boolean isAlreadyPromoted(String buildName, String buildNumber, String targetRepo) {
try {
logger.debug("Checking if already promoted");
ResponseEntity<BuildInfoResponse> entity = this.restTemplate.getForEntity(BUILD_INFO_URL + buildName + "/" + buildNumber, BuildInfoResponse.class);
Status[] statuses = entity.getBody().getBuildInfo().getStatuses();
BuildInfoResponse.Status status = (statuses != null) ? statuses[0] : null;
if (status == null) {
logger.debug("Returned no status object");
return false;
}
logger.debug("Returned repository " + status.getRepository() + " expecting " + targetRepo);
return status.getRepository().equals(targetRepo);
} catch (HttpClientErrorException ex) {
logger.debug("Client error, assuming not promoted");
return false;
}
}
Aggregations