Cypressをローカルで試したときはうまくいったが、GCP上のCloud Buildで動かそうとしたら失敗した
ログは以下
Step #1: Step #1: Running: sample.spec.js (1 of 1) Step #1: Step #1: Step #1: country Step #1: [428:0806/021104.473847:FATAL:memory.cc(22)] Out of memory. size=262144 Step #1: We detected that the Chromium Renderer process just crashed. Step #1: Step #1: Step #1: This is the equivalent to seeing the 'sad face' when Chrome dies. Step #1: Step #1: This can happen for a number of different reasons: Step #1: Step #1: - You wrote an endless loop and you must fix your own code Step #1: - There is a memory leak in Cypress (unlikely but possible) Step #1: - You are running Docker (there is an easy fix for this: see link below) Step #1: - You are running lots of tests on a memory intense application Step #1: - You are running in a memory starved VM environment Step #1: - There are problems with your GPU / GPU drivers Step #1: - There are browser bugs in Chromium Step #1: Step #1: You can learn more including how to fix Docker here: Step #1: Step #1: https://on.cypress.io/renderer-process-crashed Step #1: Step #1: We detected that the Chromium Renderer process just crashed. Step #1: Step #1: This is the equivalent to seeing the 'sad face' when Chrome dies. Step #1: Step #1: This can happen for a number of different reasons: Step #1: Step #1: - You wrote an endless loop and you must fix your own code Step #1: - There is a memory leak in Cypress (unlikely but possible) Step #1: - You are running Docker (there is an easy fix for this: see link below) Step #1: - You are running lots of tests on a memory intense application Step #1: - You are running in a memory starved VM environment Step #1: - There are problems with your GPU / GPU drivers Step #1: - There are browser bugs in Chromium Step #1: Step #1: You can learn more including how to fix Docker here: Step #1: Step #1: https://on.cypress.io/renderer-process-crashed Step #1:
ログにはこのエラーの原因がリストアップされていて、その中に「Docker上で動かすときは簡単な修正があるので次のリンクを参照してください」とあるので参照してみる
https://on.cypress.io/renderer-process-crashed
さらに、まだOPEN中のissueに促されるがよくわからない
https://github.com/cypress-io/cypress/issues/350
結果的に以下のstackoverflowに解決策が記載されていた
Dockerの下のChromeにはデフォルトで64MBの制限付きメモリがあるため、「メモリ不足」エラーが表示されとのことこの制限を増やすには、2つのパラメーターを指定してdockerを実行するとよいとのこと
docker run -it --ipc=host --shm-size=1024M
ただ、ローカルで実行した時のcloudbuild.yamlはdocker run
で実行していなかったのでcloudbuild.yamlの構成を変える必要がある
これは苦戦したので別の記事に書く
ちなみに、
cloudbuildのメモリの増やし方はマシンタイプに依存しており、以下の中から選択できる
https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#machinetype