Skip to content

Commit 9cead4c

Browse files
committed
Merge branch '4.3.x'
2 parents 641939e + 1abb808 commit 9cead4c

2 files changed

Lines changed: 19 additions & 6 deletions

File tree

releaser-core/src/main/java/releaser/internal/Releaser.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ public ExecutionResult buildAntoraDocs(File project) {
119119
// docs-build branch being checked out
120120
if (currentBranch != null) {
121121
projectGitHandler.checkout(project, currentBranch);
122-
} else {
122+
}
123+
else {
123124
log.warn("Current branch is null cannot checkout original branch, this may impact subsequent tasks!");
124125
}
125126
}

releaser-core/src/main/java/releaser/internal/docs/CommercialAntoraDocsPublisher.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import com.google.cloud.storage.BlobInfo;
2929
import com.google.cloud.storage.transfermanager.ParallelUploadConfig;
3030
import com.google.cloud.storage.transfermanager.TransferManager;
31+
import com.google.cloud.storage.transfermanager.TransferStatus;
3132
import com.google.cloud.storage.transfermanager.UploadResult;
3233
import org.slf4j.Logger;
3334
import org.slf4j.LoggerFactory;
@@ -60,13 +61,15 @@ public CommercialAntoraDocsPublisher(TransferManager transferManager) {
6061
public void publish(File project, ReleaserProperties properties) throws IOException {
6162
checkAndLog();
6263
String antoraSite = project.getAbsolutePath() + "/target/antora/site";
63-
// This UploadBlobInfoFactory is used to alter the paths where the files will be uploaded in the bucket
64+
// This UploadBlobInfoFactory is used to alter the paths where the files will be
65+
// uploaded in the bucket
6466
ParallelUploadConfig.UploadBlobInfoFactory uploadBlobInfoFactory = (String bucketName, String fileName) -> {
6567
ProjectVersion version = new ProjectVersion(project);
66-
// The spring-cloud-release docs will be under the project spring-cloud-starter-build but we want
68+
// The spring-cloud-release docs will be under the project
69+
// spring-cloud-starter-build but we want
6770
// them uploaded under spring-cloud-release
68-
String projectName = "spring-cloud-starter-build".equals(version.projectName) ? "spring-cloud-release" :
69-
version.projectName;
71+
String projectName = "spring-cloud-starter-build".equals(version.projectName) ? "spring-cloud-release"
72+
: version.projectName;
7073
String blobLocation = projectName + "/reference" + fileName.substring(antoraSite.length());
7174
Optional<MediaType> mediaTypeOptional = MediaTypeFactory.getMediaType(blobLocation);
7275
BlobInfo.Builder blobInfoBuilder = BlobInfo.newBuilder(bucketName, blobLocation);
@@ -83,8 +86,17 @@ public void publish(File project, ReleaserProperties properties) throws IOExcept
8386
pathStream.filter(Files::isRegularFile).forEach(filePaths::add);
8487
}
8588
List<UploadResult> results = transferManager.uploadFiles(filePaths, parallelUploadConfig).getUploadResults();
89+
boolean failedToTransfer = false;
8690
for (UploadResult result : results) {
87-
log.info("Upload for {} completed with status {}", result.getInput().getName(), result.getStatus());
91+
TransferStatus status = result.getStatus();
92+
log.info("Upload for {} completed with status {}", result.getInput().getName(), status);
93+
if (status == TransferStatus.FAILED_TO_START || status == TransferStatus.FAILED_TO_FINISH) {
94+
log.warn("Transfer failed: {}", result.getException().getMessage());
95+
failedToTransfer = true;
96+
}
97+
}
98+
if (failedToTransfer) {
99+
throw new IllegalStateException("One or more file transfers to GCP bucket for docs failed.");
88100
}
89101
}
90102

0 commit comments

Comments
 (0)