0

I have a Jekyll website running on Gitlab Pages, and one of my pages contained an error. This error is found and reported by Jekyll, but the website is still deployed, just without that page.

In Gitlab's job output I see the following:

$ jekyll build -d public
...
Bundle complete! 5 Gemfile dependencies, 29 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux-musl]
Configuration file: /builds/TheOddler/mjb/_config.yml
            Source: /builds/TheOddler/mjb
       Destination: /builds/TheOddler/mjb/public
 Incremental build: disabled. Enable with --incremental
      Generating... 
             Error: YAML Exception reading /builds/TheOddler/mjb/_work/immaculate.md: (<unknown>): did not find expected key while parsing a block mapping at line 2 column 1
       Jekyll Feed: Generating feed for posts
                    done in 1.104 seconds.
 Auto-regeneration: disabled. Use --watch to enable.
Uploading artifacts for successful job 00:09
Uploading artifacts...

So it shows Error: YAML Exception ... but then still continues as if everything is OK.

The job in my .gitlab-ci.yml file looks like this:

build-jekyll:
  stage: build
  image: jekyll/jekyll:4.2.0
  script:
  - jekyll build -d public
  artifacts:
    paths:
    - public
  only:
  - master

Why does this happen? And is there a way to make the process fail, or at least report this as a warning so I know something went wrong?

Thanks!

7
  • The answer to "Why does this happen?" is probably that Jekyll, dispite the error in the output, returns with exit code 0. Commented Jul 30, 2021 at 14:04
  • @slauth That would make sense. Only strange that Jekyll does that. Commented Jul 30, 2021 at 14:29
  • I agree. Others seem to have strumbled upon this as well. Commented Jul 30, 2021 at 14:32
  • @slauth Interesting. A real shame how that thread went down though. Might need to report a similar issue again now then. Tanks! Commented Jul 30, 2021 at 14:44
  • 1
    I just by accident read about a Jekyll option --strict_front_matter. You could try that. Commented Jul 30, 2021 at 18:33

1 Answer 1

1

This happens because Jekyll, dispite the error in the output, returns with exit code 0. You could try to add the --strict_front_matter option to let Jekyll return a non-zero exit code.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.