cypress-io / github-action

GitHub Action for running Cypress end-to-end & component tests
https://on.cypress.io/guides/continuous-integration/github-actions
MIT License
1.37k stars 345 forks source link

This machine is sending different environment parameters than the first machine that started this parallel run. #602

Closed sean-hill closed 1 year ago

sean-hill commented 2 years ago

Hey there! I'm receiving this error just recently in my Github Actions that run multiple tests in parallel:

/opt/hostedtoolcache/node/14.20.1/x64/bin/npx cypress cache list
┌─────────┬───────────────────┐
│ version │ last used         │
├─────────┼───────────────────┤
│ 10.3.0  │ a few seconds ago │
└─────────┴───────────────────┘
[2200:1004/193837.782206:ERROR:sandbox_linux.cc(377)] InitializeSandbox() called with multiple threads in process gpu-process.
[2200:1004/193837.793000:ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.
Missing baseUrl in compilerOptions. tsconfig-paths will be skipped
You passed the --parallel flag, but we do not parallelize tests across different environments.

This machine is sending different environment parameters than the first machine that started this parallel run.

The existing run is: https://dashboard.cypress.io/projects/<:)>/runs

In order to run in parallel mode each machine must send identical environment parameters such as:

 - specs
 - osName
 - osVersion
 - browserName
 - browserVersion (major)

This machine sent the following parameters:

{
  "osName": "linux",
  "osVersion": "Ubuntu - 20.04",
  "browserName": "Chrome",
  "browserVersion": "106.0.5249.91",
  "specs": [
    ...
  ]
}

https://on.cypress.io/parallel-group-params-mismatch
Test run failed, code 1
More information might be available above
Cypress module has returned the following error message:
Could not find Cypress test run results
Error: Could not find Cypress test run results

I can confirm that a view of the jobs are running Chrome 105 and other Chrome 106. Here is my workflow configuration:

jobs:
  transact:
    name: Transact
    runs-on: ubuntu-latest
    strategy:
      # when one test fails, DO NOT cancel the other
      # containers, because this will kill Cypress processes
      # leaving the Dashboard hanging ...
      # https://github.com/cypress-io/github-action/issues/48
      fail-fast: false
      matrix:
        # Specifies the concurrency of tests to run
        container: [1, 2, 3, 4, 5]
    steps:
      - name: Run Cypress tests
        id: e2e-tests
        uses: cypress-io/github-action@v4
        with:
          browser: chrome
          record: true
          parallel: true
          group: 'Transact'
          config: baseUrl=${{ github.event.inputs.baseUrl }}
          env: apiHost=${{ github.event.inputs.apiHost }}
        env:
          CYPRESS_RECORD_KEY: ${{ secrets.TRANSACT_CYPRESS_RECORD_KEY }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Is Github using different versions of chrome on their ubuntu-latest image? 🤔

MaximeHeckel commented 2 years ago

Same here, happens every few weeks 🤷‍♂️

phishy commented 2 years ago

I'm so done with Cypress.

phishy commented 2 years ago

I've pinned both the ubuntu versions and the actions version. Nada.

openam commented 2 years ago

I see different caches in the logs. I may need to try specifying a custom cache key https://github.com/cypress-io/github-action#custom-cache-key

/opt/hostedtoolcache/node/14.20.0/x64/bin/npx cypress cache list

vs

/opt/hostedtoolcache/node/14.20.1/x64/bin/npx cypress cache list

Edit: setting cache-key does not help.

jonkoops commented 2 years ago

This has started happening for us on our repo as well: https://github.com/keycloak/keycloak-ui

jonkoops commented 2 years ago

@openam cache-key has nothing to do with this I think. That is the key used to cache dependencies.

nicolasvienot commented 2 years ago

Hello! We are experiencing the same issue with parallel Cypress tests in our GitHub CI. It has already happened a few times in the past, but it was rare. Since the start of the week, it happens a lot, and more than half of our test job fails. We also seem to see a different version of Chrome over the different job runs (Chrome 105 & Chrome 106).

phishy commented 2 years ago

@bahmutov Has informed me, that even when pinning Ubuntu versions, GitHub will upgrade the browser and Cypress will complain. The advice is that it is best to use a cypress docker container in order to pin the browser version.

jonkoops commented 2 years ago

Yeah, I figured that would be the reason why. I guess this is not a bug on the side of the action, but perhaps a better error message could be shown to point users to this solution.

bahmutov commented 2 years ago

One could also maybe control how exactly the browser versions are matched? I doubt that chrome update X.Y.Z.101 to X.Y.Z.105 would matter much

Sent from my iPhone

On Oct 5, 2022, at 18:12, Jon Koops @.***> wrote:

 Yeah, I figured that would be the reason why. I guess this is not a bug on the side if the action, but perhaps a better error message could be shown to point users to this solution.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.

jonkoops commented 2 years ago

My main problem with the error message is that I'd like to see what the actual difference is between the environment parameters. It would make it a lot easier to identify the exact parameter that causes the issue.

beamery-tomht commented 1 year ago

Any updates on this? It happens for us almost monthly and seems to be whenever chrome updates! I agree that the check against browser matching for environments could be configured to solve for this issue and be less strict

orizens commented 1 year ago

i'm trying to use https://github.com/marketplace/actions/setup-chrome to setup a chrome version - but seems like the cypress-io/github-action@v4 action is picking up a different version. is there anyway to set the chrome binary to cypress-io action?

beamery-tomht commented 1 year ago

Have got this working with setup-chrome after finding this comment https://github.com/cypress-io/github-action/issues/518#issuecomment-1210979047

As we use a custom command, had to specify --browser ${{ env. BROWSER_PATH }} in that command

orizens commented 1 year ago

thanks @beamery-tomht it works well!

chinanderm commented 1 year ago

Been happening all day today so far.

MikeMcC399 commented 1 year ago

@chinanderm

Been happening all day today so far.

Do you have some more config info?

chinanderm commented 1 year ago

@MikeMcC399 We run our tests parallelized across four instances. Ran on GitHub actions without Docker container as it has given us issues in the past with our monorepo setup.

This seems to happen every few months or so. Likely due to us not specifying a Chrome version. New releases going out and the various machines this runs on haven't all been updated?

Here is the relevant parts of the workflow .yml setup:

ui-chrome-tests:
    runs-on: ubuntu-latest
    needs: install
    strategy:
      fail-fast: false
      matrix:
        # run copies of the current job in parallel
        containers: [1, 2, 3, 4]
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 16

      - name: Download the build folders
        uses: actions/download-artifact@v3
        with:
          name: build
          path: path/to/app/build

      # Install parent package.json run dependencies
      - run: npm install

      - name: Cypress run
        uses: cypress-io/github-action@v4
        with:
          # we have already installed all dependencies above
          install: false
          start: npm run start:test
          working-directory: path/to/app
          wait-on: http://localhost:3000
          browser: chrome
          record: true
          parallel: true
        env:
          CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}

Error results:

You passed the --parallel flag, but we do not parallelize tests across different environments.

This machine is sending different environment parameters than the first machine that started this parallel run.

The existing run is: https://cloud.cypress.io/projects/th3fzw/runs

In order to run in parallel mode each machine must send identical environment parameters such as:

 - specs
 - osName
 - osVersion
 - browserName
 - browserVersion (major)

This machine sent the following parameters:

{
  "osName": "linux",
  "osVersion": "Ubuntu - ",
  "browserName": "Chrome",
  "browserVersion": "111.0.5563.146.... (Expected: 112)",
  "specs": [
    ...
  ]
}
bahmutov commented 1 year ago

This is GitHub actions rolling new virtual machines with updates chrome browser. It takes time so some containers get version X, others X+1Sent from my iPhoneOn Apr 12, 2023, at 12:15, Matt Chinander @.***> wrote: @MikeMcC399 We run our tests parallelized across four instances. Ran on GitHub actions without Docker container as it has given us issues in the past with our monorepo setup. This seems to happen every few months or so. Likely due to us not specifying a Chrome version. New releases going out and the various machines this runs on haven't all been updated?

GitHub runner OS: ubuntu Self-hosted runner: No Docker container, if used: Not used Browser: Chrome Cypress version: 12.2.0 github-action version: @.***

Here is the relevant parts of the workflow .yml setup: ui-chrome-tests: runs-on: ubuntu-latest needs: install strategy: fail-fast: false matrix:

run copies of the current job in parallel

    containers: [1, 2, 3, 4]
steps:
  - uses: ***@***.***
  - uses: ***@***.***
    with:
      node-version: 16

  - name: Download the build folders
    uses: ***@***.***
    with:
      name: build
      path: path/to/app/build

  # Install parent package.json run dependencies
  - run: npm install

  - name: Cypress run
    uses: ***@***.***
    with:
      # we have already installed all dependencies above
      install: false
      start: npm run start:test
      working-directory: path/to/app
      wait-on: http://localhost:3000
      browser: chrome
      record: true
      parallel: true
    env:
      CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}

Error results: You passed the --parallel flag, but we do not parallelize tests across different environments.

This machine is sending different environment parameters than the first machine that started this parallel run.

The existing run is: https://cloud.cypress.io/projects/th3fzw/runs

In order to run in parallel mode each machine must send identical environment parameters such as:

This machine sent the following parameters:

{ "osName": "linux", "osVersion": "Ubuntu - ", "browserName": "Chrome", "browserVersion": "111.0.5563.146.... (Expected: 112)", "specs": [ ... ] }

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

MikeMcC399 commented 1 year ago

@chinanderm

Thanks for your details! That ties in with the current ubuntu-22.04 rollout according to https://github.com/actions/runner-images

image

Image version Chrome version
20230409.1 112.0.5615.49
20230402.1 111.0.5563.146

so currently GitHub is 79% on Chrome 111 and 21% on Chrome 112.

It seems the only workaround right now is to use a Docker container which ties to a specific version of Chrome.

This isn't something which can be solved by the github-action.

Perhaps there is scope here for a feature request to Cypress Cloud to allow adjacent major versions like 111 and 112 to be accepted? I don't know if that is technically feasible however. It seems like a reasonable request, since runs-on: is just specifying ubuntu-latest with no control about the exact Chrome version which GitHub is providing.

nagash77 commented 1 year ago

This is not something that can be controlled by the github-action. I am going to close this issue.

MikeMcC399 commented 1 year ago
MikeMcC399 commented 1 year ago

@chinanderm

    strategy:
      fail-fast: false
      matrix:
        # run copies of the current job in parallel
        containers: [1, 2, 3, 4]

If I were a productive and impacted user, I would consider submitting a concrete issue in https://github.com/actions/runner/issues, however I am only an observer (and I couldn't reproduce the issue) so I restricted myself to opening a discussion item (see above).

image

MikeMcC399 commented 1 year ago

@bahmutov

This is GitHub actions rolling new virtual machines with updates chrome browser. It takes time so some containers get version X, others X+1

Thanks for your confirmation about the root cause. Do you know if this has ever been discussed with GitHub? Are they able to stop it happening?

bahmutov commented 1 year ago

Hehehe they won’t stop rolling new versions. It is up to cypress to not freak out when chrome updates from 111 to 112 as if it is the end of the world Sent from my iPhoneOn Apr 13, 2023, at 06:58, Mike McCready @.***> wrote: @bahmutov

This is GitHub actions rolling new virtual machines with updates chrome browser. It takes time so some containers get version X, others X+1

Thanks for your confirmation about the root cause. Do you know if this has ever been discussed with GitHub? Are they able to stop it happening?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

MikeMcC399 commented 1 year ago

@bahmutov

Do you know if this has ever been discussed with GitHub? Are they able to stop it happening?

Hehehe they won’t stop rolling new versions. It is up to cypress to not freak out when chrome updates from 111 to 112 as if it is the end of the world 

I meant to ask if it had been discussed for GitHub not to use different image versions in the same job and same matrix, despite a rollout being in progress. I was not suggesting that GitHub stop rolling out new versions. I was just suggesting that they might control the image usage better during a rollout.

bahmutov commented 1 year ago

I don’t think it was ever discussed. Sent from my iPhoneOn Apr 13, 2023, at 07:44, Mike McCready @.***> wrote: @bahmutov

Do you know if this has ever been discussed with GitHub? Are they able to stop it happening?

Hehehe they won’t stop rolling new versions. It is up to cypress to not freak out when chrome updates from 111 to 112 as if it is the end of the world 

I meant to ask if it had been discussed for GitHub not to use different image versions in the same job and same matrix, despite a rollout being in progress. I was not suggesting that GitHub stop rolling out new versions. I was just suggesting that they might control the image usage better during a rollout.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

sgronblo commented 1 year ago

@MikeMcC399 Thanks for trying to bring up the issue with Github.

We are currently seeing failures due to this exact issue. Instead of asking everyone who uses --parallel with GH Actions to set up the Chrome version manually through additional actions or docker containers, could we not just have a simple setting for Cypress to specify how many major versions of drift we are ready to accept. Or a way to temporarily disable the check while the rollout is going on.

sgronblo commented 1 year ago

Am I understanding correctly from this that if I want to use one of Cypress's official Docker images here: https://github.com/cypress-io/cypress-docker-images/tree/master/browsers I am limited to Chrome 107 as the latest version?

MikeMcC399 commented 1 year ago

@sgronblo

Am I understanding correctly from this that if I want to use one of Cypress's official Docker images here: https://github.com/cypress-io/cypress-docker-images/tree/master/browsers I am limited to Chrome 107 as the latest version?

The list you refer to is incomplete. See https://hub.docker.com/r/cypress/browsers/tags/ instead. (The current latest Chrome version available in the Docker images in this category is 113.)

MikeMcC399 commented 1 year ago

@sgronblo

We are currently seeing failures due to this exact issue. Instead of asking everyone who uses --parallel with GH Actions to set up the Chrome version manually through additional actions or docker containers, could we not just have a simple setting for Cypress to specify how many major versions of drift we are ready to accept. Or a way to temporarily disable the check while the rollout is going on.