open-lms-open-source/moodle-plugin-ci

Mustache liniting: "WARNING: Problem calling HTML validator"

Closed this issue · 4 comments

If your plugin ci test started reporting the error similar to:

/home/travis/moodle/theme/mytheme/templates/header.mustache - WARNING: Problem calling HTML validator - please report bug to integration team.

for every mustache file in your plugin, you are in big trouble!

Haha, joking. Have a look at build system information at the top of Travis build log, it will be something like:

Build system information
Build language: php
Build group: stable
Build dist: xenial

This mean that Travis started using Ubuntu Xenial on VM, and this is where the problem is coming from.

Before getting into more details, here is a quick fix. Unless there is a specific reason you need Xenial, just pin Travis to use Ubuntu Trusty instead (in fact if the problem came out of blue, check system information on last successful CI run, I bet Trusty was used there) by adding this line to your .travis.yml:

--- a/.travis.yml
+++ b/.travis.yml
@@ -1,3 +1,5 @@
+dist: trusty
+
 language: php
 
 sudo: required

OK, now more details on root cause. The issue is realated to version of java, validator used in moodle-local-ci and the way how validator output is handled in moodle-local-ci. Although, we requre openjdk-8-jre-headless package in .travis.yml, it apparently has no effect for Xenial, which comes with openjdk10 and openjdk11 installed. By default java there is referring to openjdk11:

travis@travis-job-d5d214f7-f40c-4cb6-8289-5bff56fde2e8:~/build/moodleworkplace/moodle-theme_workplace$ whereis java
java: /usr/bin/java /usr/share/java /usr/local/lib/jvm/openjdk11/bin/java /usr/share/man/man1/java.1.gz

We know that mustache linting works fine with openjdk8. But there is no obvious way of swithing java version to 8 as part of build, as update-alternatives does not see openjdk10 and 11 (they are not coming from apt packages):

travis@travis-job-d5d214f7-f40c-4cb6-8289-5bff56fde2e8:~/build/moodleworkplace/moodle-theme_workplace$ update-alternatives --config java
There is only one alternative in link group java (providing /usr/bin/java): /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
Nothing to configure.

This has been acknowleged by travis already, and if you need to run Xenial with openjdk8 for some reason, you may try adding this hack to your before_install script (did not test).

What is actually happening during linting is reported to moodle-local-ci maintainers (MDLSITE-5739).

I am not sure if this requires a PR for now, or we can keep this ticket open for reference and discussion.

Thanks for researching this - just noticed it's failing for this project.

Looks like the fix is to update our version of https://github.com/moodlehq/moodle-local_ci - any idea what we do with packages?

addons:
  apt:
    packages:
      - openjdk-8-jre-headless

Looks like it was removed from the moodlehq project... that makes me a little nervous - should we at least pin it to java 11 or something?

This should be fixed in master now. Still blocked on releasing due to Chrome/Behat problems.

Looks like the fix is to update our version of https://github.com/moodlehq/moodle-local_ci - any idea what we do with packages?

Correct, it has been fixed in https://tracker.moodle.org/browse/MDLSITE-5739

You don't need explicitly specify openjdk-8-jre-headless (or any other java package) if used with xenial (might be good idea to pin dist: xenial in fact)