jbake icon indicating copy to clipboard operation
jbake copied to clipboard

Invalid header causes warning, not error, and site is published with broken link.

Open msgilligan opened this issue 7 years ago • 4 comments

I'm using JBake via Gradle and GitLab CI to auto-publish site updates. If something goes wrong with the bake Gradle task, I would like the build to fail and the site update not to be published.

Instead I get the following warning message and the site publishes with a broken link (404).

Error parsing meta data from header (missing type or status value) for file /builds/rivetz/developer-rivetz/src/jbake/content/start.adoc!
/builds/rivetz/developer-rivetz/src/jbake/content/start.adoc has an invalid header, it has been ignored!

Perhaps, for backward-compatibility reasons, there should be a config option to enable fail/abort on error.

Crawler.java could then have a configuration option to return an error or throw an exception when something goes wrong.

msgilligan avatar May 10 '18 15:05 msgilligan

I agree. Not beeing able to parse a header should be an error and not just a warning. The bake method should indicated if the process was unsuccessful. That way the gradle task could be able to detect the problem and fail which should interrupt the ci pipeline.

The Crawler is the only class which does not collect errors and propagate them to the Oven.

ancho avatar May 12 '18 09:05 ancho

You should be able to circumvent the error if you configure default.status and default.type.

See https://jbake.org/docs/2.6.1/#metadata_header

ancho avatar May 13 '18 09:05 ancho

Just to recap, if we add config option that causes content parsing warnings to throw an error instead of just being logged as a warning, and the option will be set to false for backwards compatibility. Everyone OK with this?

jonbullock avatar Jun 05 '18 11:06 jonbullock

just to add my 2 cents:

I get a lot of config.adoc has an invalid header, it has been ignored! warnings, because many of my files are just include files which have no header and thus it is ok that they are not rendered.

I think we should distinguish between "no header" and "invalid header"

rdmueller avatar Mar 11 '21 09:03 rdmueller