Issue with-- Jest preset plugin


(vibhaak) #1

I used Jest preset plugin to run jest -puppeteer tests in a docker container. Worked fine locally. However when running through remote jenkins, it fails to start docker container?

Jenkins cannot start docker container

Followed the instructions on the page …tests run fine in docker only locally https://www.npmjs.com/package/jest-puppeteer-docker. Below is the error…

14:48:20 Successfully built 05a128b6706e 14:48:20 Successfully tagged docker_chromium:latest 14:48:20 14:48:20 Building chromium 14:48:20 14:48:20 Docker Chromium: Successfully built Docker image 14:48:20 Docker Chromium: Starting Docker container… 14:48:20 Error: Docker Chromium: Failed to start Docker container 14:48:20 14:48:20 Internal Error: 14:48:20 14:48:20 Error: Command failed: docker-compose -f “/data/jenkins/workspace/MadService_automation_test_run/node_modules/docker-chromium/docker/docker-compose.yml” up -d chromium 14:48:20 Creating docker_chromium_1 … 14:48:20 Creating docker_chromium_1 14:48:20 e[1Ae[2K Creating docker_chromium_1 … e[31merrore[0m e[1B 14:48:20 ERROR: for docker_chromium_1 Cannot create container for service chromium: invalid port specification: “None” 14:48:20 14:48:20 ERROR: for chromium Cannot create container for service chromium: invalid port specification: “None” 14:48:20 Encountered errors while bringing up the project. 14:48:20 14:48:20 at dockerUp (/data/jenkins/workspace/MadService_automation_test_run/node_modules/docker-chromium/lib/index.js:82:15) 14:48:20 at <anonymous> 14:48:20 npm ERR! code ELIFECYCLE 14:48:20 npm ERR! errno 1 14:48:20 npm ERR! mad-service@1.0.0 test-automation: jest --verbose --config=automation/config/jest.config.js 14:48:20 npm ERR! Exit status 1 14:48:20 npm ERR!
Hi! Thanks for taking the time to file a bug report!

Details

Platform Info

$ npm --versions

5.6.0

$ node -p process.platform
darwin

(vibhaak) #2

Cannot understand this error


(John Gee) #3

I think the error is coming from this command, but I am not sure why:

docker-compose -f "/data/jenkins/workspace/MadService_automation_test_run/node_modules/docker-chromium/docker/docker-compose.ym"” up -d chromium

This older issue describes interaction between docker-compose and python versions with similar error: https://github.com/docker/compose/issues/4729


(vibhaak) #4

out of the 2 solution,

  • downgrade python
  • downgrade docker-compose
    I want to try for ‘downgrade docker-compose’ one as I am not using python at all. As I am using the image from https://github.com/alpeware/chrome-headless-trunk I do not know how I could downgrade docker compose to use with jenkins.Locally downgrading the docker-compose still works. But issue is how to achieve the same on remote jenkins. Also the error ’ Cannot create container for service chromium: invalid port specification: “None”’ is about invalid port. ow I can change that when image is being downloaded dynamically in jenkins Please help

(John Gee) #5

It looks like a problem with docker-compose on a Jenkins server, so help in this npm forum will be limited! I don’t know if downgrading docker-compose will help.

I can explain how I think the port number error occurs. jest-puppeteer-docker depends on docker-chromium, which has a docker-compose.yml with port number specified like:

    ports:
      - '9222:9222'

For some reason this format is not recognised by the docker-compose on your Jenkins server.


(vibhaak) #6

Is there another way ports: can be specified?