Not failing the build on template generation

This commit is contained in:
Marcin Grzejszczak
2018-10-23 16:03:45 +02:00
parent 96bd2c9efe
commit f82fce0e7c
5 changed files with 31 additions and 7 deletions

View File

@@ -289,6 +289,7 @@ The following properties are used for both meta release and a release of an indi
- `releaser.git.spring-project-branch` - Branch to check out for the documentation project. Defaults to `gh-pages`.
- `releaser.git.test-samples-project-url` - URL to the test samples to be checked against the given release train. Defaults to `https://github.com/spring-cloud/spring-cloud-core-tests`.
- `releaser.git.test-samples-project-branch` - Branch to check out for test samples. Defaults to `master`.
- `releaser.git.run-updated-samples` - If `true` then will update samples and run the the build. Defaults to `true`.
- `releaser.git.update-documentation-repo` - If `true` then will update documentation repository with the `current` URL. Defaults to `true`.
- `releaser.git.update-spring-guides` - If `true` then will update Spring Guides with the current release train. Defaults to `true`.
- `releaser.git.update-spring-project` - If `true` then will update Spring Project page with the current release train values. Defaults to `true`.

View File

@@ -139,7 +139,11 @@ public class Releaser {
return;
}
File email = this.templateGenerator.email();
log.info("\nSuccessfully created email template at location [{}]", email);
if (email != null) {
log.info("\nSuccessfully created email template at location [{}]", email);
} else {
log.warn("\nFailed to create an email template");
}
}
public void createBlog(ProjectVersion releaseVersion, Projects projects) {
@@ -148,7 +152,11 @@ public class Releaser {
return;
}
File blog = this.templateGenerator.blog(projects);
log.info("\nSuccessfully created blog template at location [{}]", blog);
if (blog != null) {
log.info("\nSuccessfully created blog template at location [{}]", blog);
} else {
log.warn("\nFailed to create a blog template");
}
}
@@ -166,8 +174,12 @@ public class Releaser {
log.info("\nWon't create tweet template for a SNAPSHOT version");
return;
}
File blog = this.templateGenerator.tweet();
log.info("\nSuccessfully created tweet template at location [{}]", blog);
File tweet = this.templateGenerator.tweet();
if (tweet != null) {
log.info("\nSuccessfully created tweet template at location [{}]", tweet);
} else {
log.warn("\nFailed to create a tweet template");
}
}
public void createReleaseNotes(ProjectVersion releaseVersion, Projects projects) {

View File

@@ -67,7 +67,8 @@ class BlogTemplateGenerator {
return this.blogOutput;
}
catch (IOException e) {
throw new IllegalStateException(e);
log.warn("Exception occurred while trying to create a blog entry", e);
return null;
}
}

View File

@@ -5,12 +5,16 @@ import java.io.IOException;
import java.nio.file.Files;
import com.github.jknack.handlebars.Template;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author Marcin Grzejszczak
*/
class EmailTemplateGenerator {
private static final Logger log = LoggerFactory.getLogger(EmailTemplateGenerator.class);
private final Template template;
private final String releaseVersion;
private final File emailOutput;
@@ -28,7 +32,8 @@ class EmailTemplateGenerator {
return this.emailOutput;
}
catch (IOException e) {
throw new IllegalStateException(e);
log.warn("Exception occurred while trying to generate an email template", e);
return null;
}
}
}

View File

@@ -2,6 +2,8 @@ package org.springframework.cloud.release.internal.template;
import com.github.jknack.handlebars.Template;
import com.google.common.collect.ImmutableMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
@@ -22,6 +24,8 @@ import org.springframework.util.StringUtils;
*/
class ReleaseNotesTemplateGenerator {
private static final Logger log = LoggerFactory.getLogger(ReleaseNotesTemplateGenerator.class);
private final Template template;
private final String releaseVersion;
private final File blogOutput;
@@ -49,7 +53,8 @@ class ReleaseNotesTemplateGenerator {
return this.blogOutput;
}
catch (IOException e) {
throw new IllegalStateException(e);
log.warn("Exception occurred while trying to generate release notes", e);
return null;
}
}