Page MenuHomePhabricator

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

Description

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

Details

Related Gerrit Patches:

Event Timeline

From some paste research, that seems to be an issue with the plugin: https://github.com/eirslett/frontend-maven-plugin/issues/560

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

https://gerrit.wikimedia.org/r/410169

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

https://gerrit.wikimedia.org/r/410169

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

https://gerrit.wikimedia.org/r/414731

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

https://gerrit.wikimedia.org/r/414731

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

https://gerrit.wikimedia.org/r/414772

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

https://gerrit.wikimedia.org/r/414772

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