use of io.spring.concourse.releasescripts.artifactory.payload.PromotionRequest in project spring-boot by spring-projects.
the class ArtifactoryService method promote.
/**
* Move artifacts to a target repository in Artifactory.
* @param targetRepo the targetRepo
* @param releaseInfo the release information
*/
public void promote(String targetRepo, ReleaseInfo releaseInfo) {
PromotionRequest request = getPromotionRequest(targetRepo);
String buildName = releaseInfo.getBuildName();
String buildNumber = releaseInfo.getBuildNumber();
logger.info("Promoting " + buildName + "/" + buildNumber + " to " + request.getTargetRepo());
RequestEntity<PromotionRequest> requestEntity = RequestEntity.post(URI.create(PROMOTION_URL + buildName + "/" + buildNumber)).contentType(MediaType.APPLICATION_JSON).body(request);
try {
this.restTemplate.exchange(requestEntity, String.class);
logger.debug("Promotion complete");
} catch (HttpClientErrorException ex) {
boolean isAlreadyPromoted = isAlreadyPromoted(buildName, buildNumber, request.getTargetRepo());
if (isAlreadyPromoted) {
logger.info("Already promoted.");
} else {
logger.info("Promotion failed.");
throw ex;
}
}
}
Aggregations