Mark
Mark

Reputation: 1551

Why Cypress service is failing?

Below is my pipeline on which I'm trying to get Cypress job to run tests against Nginx service (which points to the main app) which is built at the build stage The below is based on official template from here https://gitlab.com/cypress-io/cypress-example-docker-gitlab/-/blob/master/.gitlab-ci.yml :

image: docker:stable

services: 
   - docker:dind

stages: 
   - build
   - test

cache:
   key: ${CI_COMMIT_REF_SLUG}
   paths:      
      - .npm    
      - cache/Cypress                                      
      - node_modules                                                             

job:                              
   stage: build                                           
   script:                                                                      
     - export REACT_APP_USERS_SERVICE_URL=http://127.0.0.1
     - apk add --update --no-cache gcc g++ make python2 python2-dev py-pip python3-dev docker-compose npm
     - docker-compose up -d --build

e2e:                                                                           
   image: cypress/included:9.1.1                                                
   stage: test
   script:
      - export CYPRESS_VIDEO=false            
      - export CYPRESS_baseUrl=http://nginx:80                                   
      - npm i randomstring
      - $(npm bin)/cypress run -t -v $PWD/e2e -w /e2e -e CYPRESS_VIDEO -e CYPRESS_baseUrl --network testdriven_default
      - docker-compose down

Error output:

Cypress encountered an error while parsing the argument config
You passed: if [ -x /usr/local/bin/bash ]; then
    exec /usr/local/bin/bash 
elif [ -x /usr/bin/bash ]; then
    exec /usr/bin/bash 
elif [ -x /bin/bash ]; then
    exec /bin/bash 
elif [ -x /usr/local/bin/sh ]; then
    exec /usr/local/bin/sh 
elif [ -x /usr/bin/sh ]; then
    exec /usr/bin/sh 
elif [ -x /bin/sh ]; then
    exec /bin/sh 
elif [ -x /busybox/sh ]; then
    exec /busybox/sh 
else
    echo shell not found
    exit 1
fi
The error was: Cannot read properties of undefined (reading 'split')

What is wrong with this set up ?

Upvotes: 7

Views: 1372

Answers (1)

PotatoesMaster
PotatoesMaster

Reputation: 183

From @jparkrr on GitHub : https://github.com/cypress-io/cypress-docker-images/issues/300#issuecomment-626324350

I had the same problem. You can specify entrypoint: [""] for the image in .gitlab-ci.yml.

Read more about it here: https://docs.gitlab.com/ee/ci/docker/using_docker_images.html#overriding-the-entrypoint-of-an-image

In your case :

e2e:
   image:
      name: cypress/included:9.1.1
      entrypoint: [""]

Upvotes: 6

Related Questions