Page MenuHomePhabricator

Running mvn on wikidata/query/rdf fails with: /bin/sh: 1: npm: not found
Closed, ResolvedPublic


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] 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:

Under the hood, the job uses the Docker container

$ docker pull

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= \
    --env ZUUL_PROJECT=wikidata/query/rdf \
    --env ZUUL_COMMIT=master \
    --env ZUUL_REF=master \
    --volume /"$(pwd)"/cache://cache \
    --volume /"$(pwd)"/log://log \ clean verify


Related Gerrit Patches:

Event Timeline

From some paste research, that seems to be an issue with the plugin:

Seems the pom.xml would need to configure the plugin with some <npmVersion>?

Change 410169 had a related patch set uploaded (by Hashar; owner: Hashar):
[integration/config@master] Experimental docker job wikidata-query-rdf-maven

hashar updated the task description. (Show Details)Feb 26 2018, 6:07 PM

Change 410169 merged by jenkins-bot:
[integration/config@master] Experimental docker job wikidata-query-rdf-maven

Change 414731 had a related patch set uploaded (by Hashar; owner: Hashar):
[wikidata/query/rdf@master] Set npm version for frontend-maven-plugin

Change 414731 merged by jenkins-bot:
[wikidata/query/rdf@master] Set npm version for frontend-maven-plugin

I went for dinner and magically @Gehel and @Smalyshev reviewed the change \o/

Change 414772 had a related patch set uploaded (by Hashar; owner: Hashar):
[integration/config@master] Migrate wikidata-query-rdf-maven job to Docker

Change 414772 merged by jenkins-bot:
[integration/config@master] Migrate wikidata-query-rdf-maven job to Docker

hashar closed this task as Resolved.Feb 26 2018, 8:39 PM
Restricted Application added a project: Wikidata. · View Herald TranscriptJan 7 2020, 10:21 AM