I am trying to migrate`wikidata/query/rdf` CI jobs to use a Docker container having just java8/maven. It eventually fails when and it eventually fails to find npm:
[INFO] --- frontend-maven-plugin:1.6:npm (npm test) @ gui --- [INFO] Running 'npm test' in /src/gui ... [INFO] Running "clean:deploy" (clean) task [INFO] >> 0 paths cleaned. [INFO] [INFO] Running "auto_install:local" (auto_install) task [ERROR] /bin/sh: 1: npm: not found [INFO] running npm install on /src/gui...x [INFO] Warning: Command failed: npm install [INFO] /bin/sh: 1: npm: not found ... [INFO] WDQS - Frontend .................................... FAILURE [02:07 min]
That seems to be because npm is installed by the frontend-maven-plugin but it is not added to the PATH. Hence when package.json has a command like 'npm run-script foo' it fails to find npm :(
Note that the maven plugin does install node/npm:
[INFO] --- frontend-maven-plugin:1.6:install-node-and-npm (install node and npm) @ gui --- [INFO] Installing node version v6.12.3 [INFO] Unpacking /cache/maven/com/github/eirslett/node/6.12.3/node-6.12.3-linux-x64.tar.gz into /src/gui/target/node/tmp [INFO] Copying node binary from /src/gui/target/node/tmp/node-v6.12.3-linux-x64/bin/node to /src/gui/target/node/node [INFO] Extracting NPM [INFO] Installed node locally.
A way to reproduce is to send a patch to Gerrit and comment check experimental. That will trigger the job: https://integration.wikimedia.org/ci/job/wikidata-query-rdf-maven-java8-docker/
Under the hood, the job uses the Docker container docker-registry.wikimedia.org/releng/java8-wikidata-query-rdf:
$ docker pull docker-registry.wikimedia.org/releng/java8-wikidata-query-rdf
It runs as the nobody user and has an entry point that takes a few parameters to fetch and checkout a patch. An example usage:
$ install --mode 2777 --directory cache $ install --mode 2777 --directory log $ docker run \ --rm --tty \ --env JENKINS_URL=1 \ --env ZUUL_URL=https://gerrit.wikimedia.org/r \ --env ZUUL_PROJECT=wikidata/query/rdf \ --env ZUUL_COMMIT=master \ --env ZUUL_REF=master \ --volume /"$(pwd)"/cache://cache \ --volume /"$(pwd)"/log://log \ docker-registry.wikimedia.org/releng/java8-wikidata-query-rdf clean verify