Repository: spark
Updated Branches:
  refs/heads/branch-2.0 5c56bc00c -> aa4690b1b


[SPARK-16555] Work around Jekyll error-handling bug which led to silent failures

If a custom Jekyll template tag throws Ruby's equivalent of a "file not found" 
exception, then Jekyll will stop the doc building process but will exit with a 
successful status, causing our doc publishing jobs to silently fail.

This is caused by https://github.com/jekyll/jekyll/issues/5104, a case of bad 
error-handling logic in Jekyll. This patch works around this by updating our 
`include_example.rb` plugin to catch the exception and exit rather than 
allowing it to bubble up and be ignored by Jekyll.

I tested this manually with

```
rm ./examples/src/main/scala/org/apache/spark/examples/sql/SparkSQLExample.scala
cd docs
SKIP_API=1 jekyll build
echo $?
```

Author: Josh Rosen <joshro...@databricks.com>

Closes #14209 from JoshRosen/fix-doc-building.

(cherry picked from commit 972673aca562b24c885801d2ac48e0df95cde9eb)
Signed-off-by: Reynold Xin <r...@databricks.com>


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/aa4690b1
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/aa4690b1
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/aa4690b1

Branch: refs/heads/branch-2.0
Commit: aa4690b1bbf86f5f927ca0038dc80dc17182b268
Parents: 5c56bc0
Author: Josh Rosen <joshro...@databricks.com>
Authored: Thu Jul 14 15:55:36 2016 -0700
Committer: Reynold Xin <r...@databricks.com>
Committed: Thu Jul 14 15:55:42 2016 -0700

----------------------------------------------------------------------
 docs/_plugins/include_example.rb | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/aa4690b1/docs/_plugins/include_example.rb
----------------------------------------------------------------------
diff --git a/docs/_plugins/include_example.rb b/docs/_plugins/include_example.rb
index 3068888..6ea1d43 100644
--- a/docs/_plugins/include_example.rb
+++ b/docs/_plugins/include_example.rb
@@ -45,7 +45,15 @@ module Jekyll
       @file = File.join(@code_dir, snippet_file)
       @lang = snippet_file.split('.').last
 
-      code = File.open(@file).read.encode("UTF-8")
+      begin
+        code = File.open(@file).read.encode("UTF-8")
+      rescue => e
+        # We need to explicitly exit on execptions here because Jekyll will 
silently swallow
+        # them, leading to silent build failures (see 
https://github.com/jekyll/jekyll/issues/5104)
+        puts(e)
+        puts(e.backtrace)
+        exit 1
+      end
       code = select_lines(code)
 
       rendered_code = Pygments.highlight(code, :lexer => @lang)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to