Skip to content

Commit

Permalink
Allow a limited number of pages to fail.
Browse files Browse the repository at this point in the history
Otherwise, even one failing page will inhibit deployment.
  • Loading branch information
thvitt committed Mar 13, 2016
1 parent 7f79013 commit 7576d9b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<properties>
<project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
<upload.url>beta.faustedition.net:/var/www/dev</upload.url>
<faust.diplo.allowedFailures>10</faust.diplo.allowedFailures>
</properties>

<repositories>
Expand Down Expand Up @@ -210,6 +211,7 @@
<argument>-classpath</argument>
<classpath/>
<argument>-Dphantomjs.binary=${phantomjs.binary}</argument>
<argument>-Dfaust.diplo.allowedFailures=${faust.diplo.allowedFailures}</argument>
<argument>net.faustedition.gen.DiplomaticConversion</argument>
</arguments>
</configuration>
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/net/faustedition/gen/DiplomaticConversion.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,13 @@ public static void main(final String[] args) throws IOException {
if (failedConversions.length > 0) {
logger.log(Level.SEVERE, MessageFormat.format("Conversion of the following {0} pages failed:\n {1}",
failedConversions.length, Joiner.on("\n ").join(failedConversions)));
System.exit(1);
int allowedFailures = Integer.parseUnsignedInt(System.getProperty("faust.diplo.allowedFailures", "0"));
if (failedConversions.length > allowedFailures) {
logger.log(Level.SEVERE, MessageFormat.format("These are more than the {0} tolerated failures.", allowedFailures));
System.exit(1);
} else {
logger.log(Level.INFO, MessageFormat.format("Up to {0} failures are tolerated.", allowedFailures));
}
}
} finally {
webServer.stop();
Expand Down

0 comments on commit 7576d9b

Please sign in to comment.