2

I am trying to run a cypress pipeline using GCB, but it crashes when running inside docker.

The fix for this issue, as described here, is to run the docker with --ipc=host.

But looking in the documentation, I couldn't find how I pass parameters to docker run in GCB.

Can anyone help me?

The pipeline is

steps:
# Install node_modules
- name: 'gcr.io/cloud-builders/yarn'
  args: ['install']
# Lint JS
- name: 'gcr.io/cloud-builders/yarn'
  args: ['lint']
# Unit tests
- name: 'gcr.io/cloud-builders/yarn'
  args: ['test:unit', '--coverage']
# E2E tests (cypress dependencies required, see https://github.com/GoogleCloudPlatform/cloud-builders-community/pull/485)
- name: 'gcr.io/$PROJECT_ID/cypress-dependencies'
  args: ['test:e2e', '--headless', '--config', 'video=false']

g_lasso
  • 141
  • 8

2 Answers2

1

You can try to do this. I don't know if it will work because your run a container in a container, but have a try on your latest step

  - name: gcr.io/cloud-builders/docker
    entrypoint: 'bash'
    args:
      - -c
      - |
         docker run --ipc=host gcr.io/$PROJECT_ID/cypress-dependencies \
            test:e2e --headless --config video=false
guillaume blaquiere
  • 66,369
  • 2
  • 47
  • 76
1
steps: 
  - name: gcr.io/cloud-builders/docker
      entrypoint: docker
      args:
        [
          run,
          --ipc=host,
          gcr.io/$PROJECT_ID/cypress-dependencies,
          test:e2e,
          --headless,
          "--config video=false"
        ]

I had the same problem but I solved it.

It's counter intuitive because you don't usually have to list an entrypoint for Docker in a cloudbuild.yaml but here it is required.

engineer-x
  • 2,173
  • 2
  • 12
  • 25