Search in sources :

Example 1 with Status

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;
    }
}
Also used : Status(io.spring.concourse.releasescripts.artifactory.payload.BuildInfoResponse.Status) HttpClientErrorException(org.springframework.web.client.HttpClientErrorException) Status(io.spring.concourse.releasescripts.artifactory.payload.BuildInfoResponse.Status) BuildInfoResponse(io.spring.concourse.releasescripts.artifactory.payload.BuildInfoResponse)

Aggregations

BuildInfoResponse (io.spring.concourse.releasescripts.artifactory.payload.BuildInfoResponse)1 Status (io.spring.concourse.releasescripts.artifactory.payload.BuildInfoResponse.Status)1 HttpClientErrorException (org.springframework.web.client.HttpClientErrorException)1