Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workflow failing with EACCES: permission denied #446

Closed
raviteja83 opened this issue Oct 27, 2021 · 9 comments · Fixed by DouyinFE/semi-design#757
Closed

workflow failing with EACCES: permission denied #446

raviteja83 opened this issue Oct 27, 2021 · 9 comments · Fixed by DouyinFE/semi-design#757

Comments

@raviteja83
Copy link

This is the workflow that is run
image

It used to work till evening today. started failing from then. Am I missing something?

This is the error on workflow fail

image

cmorten added a commit to cmorten/cypress-web-vitals that referenced this issue Nov 2, 2021
cmorten added a commit to cmorten/cypress-web-vitals that referenced this issue Nov 2, 2021
* feat: node 16 + dep upgrades
* feat: cypress github action
* fix: line endings on windows
* fix: encountered cypress-io/github-action#446 guessing bug with docker image
* feat: up default timeout
* fix: catch if vitals namespace not setup
* feat: make the vitals reported timeout configurable as 10s is quite long
@Bran1304
Copy link

I am encountering the exact same error, started after updating to node 16

@realies
Copy link

realies commented Nov 14, 2021

Adding this after actions/cache@v2 and before cypress-io/github-action@v2 makes the workflow go through:

      - run: chown -R 1001:1001 /github/home/.cache && echo "pwn dat cache"

Cypress browsers images run as root, so actions/cache@v2 restores cache with a root:root owner, and cypress-io/github-action@v2 dislikes that.

@tconroy
Copy link

tconroy commented Nov 25, 2021

Also running into this issue.. Does not seem to be fixed for me with @realies chown example:

jobs:
  install:
    runs-on: ubuntu-latest
    container: cypress/browsers:node16.5.0-chrome94-ff93
    steps:
      # Checkout the branch.
      - name: Checkout
        uses: actions/checkout@v2

      - name: Reclaim cache directory
        run: chown -R 1001:1001 /github/home/.cache && echo "pwn dat cache"

      # install Cypress, run lint and build
      - name: Cypress install
        uses: cypress-io/github-action@v2  # <----- This is where mine fails, when cypress is installing
        with:
          runTests: false
      - run: yarn cypress info
      - run: node -p 'os.cpus()'
      - run: yarn lint
      - run: yarn build

      # Upload build artifacts
      - name: Save build folder
        uses: actions/upload-artifact@v2
        with:
          name: build
          if-no-files-found: error
          path: build

@hallettj
Copy link

hallettj commented Dec 6, 2021

I ran into this issue using a Cypress browser docker image with Node v16. I fixed the problem by running job as a non-root user according to the instructions in the action readme. (The instructions in the readme tell you to do this to make Firefox work, but the same fix seems to solve this permissions issue.) It looks like the home directory in the Cypress images is owned by user ID 1001, so I configured my job to run with the same ID.

Here is my setup job:

  setup-for-frontend-integration-tests:
    name: Set up for frontend tests
    runs-on: ubuntu-latest
    container:
      image: cypress/browsers:node16.5.0-chrome94-ff93
      options: --user 1001  # ← THIS IS THE IMPORTANT LINE!
    steps:
      - uses: actions/checkout@v2

      - name: Persist Next.js build cache
        uses: actions/cache@v2
        with:
          path: ${{ github.workspace }}/.next/cache
          # Generate a new cache whenever packages or source files change.
          key: ${{ runner.os }}-nextjs-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
          # If source files changed but packages didn't, rebuild from a prior cache.
          restore-keys: |
            ${{ runner.os }}-nextjs-${{ hashFiles('yarn.lock') }}-

      - name: Install and cache Cypress and npm dependencies, and build frontend server
        uses: cypress-io/github-action@v2
        with:
          # Don't run tests; we're only using the install and build steps here
          runTests: false
          build: yarn build

      - name: Save built frontend server
        uses: actions/upload-artifact@v2
        with:
          name: frontend-server
          path: .next
          if-no-files-found: error

@stalmok
Copy link

stalmok commented Dec 23, 2021

Documentation in README.md actually mentions similar issue under Firefox:

In order to run Firefox, you need to use non-root user (Firefox security restriction).
Note: the magical user id 1001 works because it matches permissions settings on the home folder

Even though I'm running Chrome image the permission issue was still happening during the build step and adding options: --user 1001 solved it for me.

kawamataryo added a commit to kawamataryo/chikamichi that referenced this issue Feb 25, 2022
diff --git a/.github/workflows/cypress-test.yaml b/.github/workflows/cypress-test.yaml
index 3accbd4..83002c4 100644
--- a/.github/workflows/cypress-test.yaml
+++ b/.github/workflows/cypress-test.yaml
@@ -10,6 +10,8 @@ jobs:
       image: cypress/browsers:node16.5.0-chrome97-ff96
       # @see cypress-io/github-action#446 (comment)
       options: --user 1001
+      volumes:
+       - /tmp/videos:/__w/chikamichi/chikamichi/cypress/videos
     steps:
       - uses: actions/checkout@v2
       - name: Cache pnpm modules
@@ -50,4 +52,4 @@ jobs:
         if: failure()
         with:
           name: cypress-videos
-          path: cypress/videos
\ No newline at end of file
+          path: /tmp/videos
\ No newline at end of file
kawamataryo added a commit to kawamataryo/chikamichi that referenced this issue Feb 25, 2022
diff --git a/.github/workflows/cypress-test.yaml b/.github/workflows/cypress-test.yaml
index 4bac268..c7b937b 100644
--- a/.github/workflows/cypress-test.yaml
+++ b/.github/workflows/cypress-test.yaml
@@ -11,7 +11,7 @@ jobs:
       # @see cypress-io/github-action#446 (comment)
       options: --user 1001
       volumes:
-       - /tmp/videos:/__w/chikamichi/chikamichi/cypress/videos
+       - cypress/videos:/__w/chikamichi/chikamichi/cypress/videos
     steps:
       - uses: actions/checkout@v2
       - name: Cache pnpm modules
@@ -51,4 +51,4 @@ jobs:
       - uses: actions/upload-artifact@v2
         with:
           name: cypress-videos
-          path: /tmp/videos
\ No newline at end of file
+          path: cypress/videos
\ No newline at end of file
kawamataryo added a commit to kawamataryo/chikamichi that referenced this issue Feb 25, 2022
diff --git a/.github/workflows/cypress-test.yaml b/.github/workflows/cypress-test.yaml
index c7b937b..67891b0 100644
--- a/.github/workflows/cypress-test.yaml
+++ b/.github/workflows/cypress-test.yaml
@@ -11,7 +11,7 @@ jobs:
       # @see cypress-io/github-action#446 (comment)
       options: --user 1001
       volumes:
-       - cypress/videos:/__w/chikamichi/chikamichi/cypress/videos
+       - /home/runner/work/cypress:/__w/chikamichi/chikamichi/cypress
     steps:
       - uses: actions/checkout@v2
       - name: Cache pnpm modules
kawamataryo added a commit to kawamataryo/chikamichi that referenced this issue Feb 25, 2022
diff --git a/.github/workflows/cypress-test.yaml b/.github/workflows/cypress-test.yaml
index 67891b0..dc9dddf 100644
--- a/.github/workflows/cypress-test.yaml
+++ b/.github/workflows/cypress-test.yaml
@@ -11,7 +11,7 @@ jobs:
       # @see cypress-io/github-action#446 (comment)
       options: --user 1001
       volumes:
-       - /home/runner/work/cypress:/__w/chikamichi/chikamichi/cypress
+       - /home/runner/work/cypress:/__w/cypress
     steps:
       - uses: actions/checkout@v2
       - name: Cache pnpm modules
@@ -40,6 +40,7 @@ jobs:
           start: pnpm run serve
           wait-on: 'http://localhost:3000'
           browser: chrome
+          config: videosFolder=/__w/cypress/videos
       - name: Cypress run on Firefox
         uses: cypress-io/github-action@v2
         with:
@@ -47,8 +48,9 @@ jobs:
           start: pnpm run serve
           wait-on: 'http://localhost:3000'
           browser: firefox
+          config: videosFolder=/__w/cypress/videos
       # upload artifact
       - uses: actions/upload-artifact@v2
         with:
           name: cypress-videos
-          path: cypress/videos
\ No newline at end of file
+          path: /home/runner/work/cypress/videos
\ No newline at end of file
kawamataryo added a commit to kawamataryo/chikamichi that referenced this issue Feb 25, 2022
diff --git a/.github/workflows/cypress-test.yaml b/.github/workflows/cypress-test.yaml
index dc9dddf..155577a 100644
--- a/.github/workflows/cypress-test.yaml
+++ b/.github/workflows/cypress-test.yaml
@@ -11,7 +11,7 @@ jobs:
       # @see cypress-io/github-action#446 (comment)
       options: --user 1001
       volumes:
-       - /home/runner/work/cypress:/__w/cypress
+       - /home/runner/work/cypress/videos:/__w/cypress/videos
     steps:
       - uses: actions/checkout@v2
       - name: Cache pnpm modules
kawamataryo added a commit to kawamataryo/chikamichi that referenced this issue Feb 25, 2022
diff --git a/.github/workflows/cypress-test.yaml b/.github/workflows/cypress-test.yaml
index 155577a..d9d9dbd 100644
--- a/.github/workflows/cypress-test.yaml
+++ b/.github/workflows/cypress-test.yaml
@@ -10,8 +10,6 @@ jobs:
       image: cypress/browsers:node16.5.0-chrome97-ff96
       # @see cypress-io/github-action#446 (comment)
       options: --user 1001
-      volumes:
-       - /home/runner/work/cypress/videos:/__w/cypress/videos
     steps:
       - uses: actions/checkout@v2
       - name: Cache pnpm modules
@@ -53,4 +51,4 @@ jobs:
       - uses: actions/upload-artifact@v2
         with:
           name: cypress-videos
-          path: /home/runner/work/cypress/videos
\ No newline at end of file
+          path: chikamichi/chikamichi/cypress/videos
\ No newline at end of file
kawamataryo added a commit to kawamataryo/chikamichi that referenced this issue Feb 25, 2022
diff --git a/.github/workflows/cypress-test.yaml b/.github/workflows/cypress-test.yaml
index c80ac37..8626403 100644
--- a/.github/workflows/cypress-test.yaml
+++ b/.github/workflows/cypress-test.yaml
@@ -6,10 +6,6 @@ on:
 jobs:
   cypress-run:
     runs-on: ubuntu-latest
-    container:
-      image: cypress/browsers:node16.5.0-chrome97-ff96
-      # @see cypress-io/github-action#446 (comment)
-      options: --user 1001
     steps:
       - uses: actions/checkout@v2
       - name: Cache pnpm modules
@@ -30,18 +26,20 @@ jobs:
           cache: "pnpm"
       - name: Build extension
         run: pnpm build
-      # tests multiple browser
       - name: Cypress run on Chrome
         uses: cypress-io/github-action@v2
         with:
           install: false
           start: pnpm run serve
           wait-on: 'http://localhost:3000'
-          browser: chrome
-      - name: Cypress run on Firefox
-        uses: cypress-io/github-action@v2
+      - uses: actions/upload-artifact@v2
+        if: failure()
         with:
-          install: false
-          start: pnpm run serve
-          wait-on: 'http://localhost:3000'
-          browser: firefox
\ No newline at end of file
+          name: cypress-screenshots
+          path: cypress/screenshots
+      # Test run video was always captured, so this action uses "always()" condition
+      - uses: actions/upload-artifact@v2
+        if: always()
+        with:
+          name: cypress-videos
+          path: cypress/videos
\ No newline at end of file
diff --git a/cypress/integration/e2e.ts b/cypress/integration/e2e.ts
index bceba02..e396346 100644
--- a/cypress/integration/e2e.ts
+++ b/cypress/integration/e2e.ts
@@ -113,7 +113,7 @@ describe("App", () => {
     cy.window().its("close").should("be.called");
   });

-  it.skip("TODO: on Enter key", () => {
+  it.only("TODO: on Enter key", () => {
     cy.get("[data-cy=search-input]").type("history-item");
     cy.get("[data-cy=search-result-0]").should("have.class", "selected-item");
     cy.get("[data-cy=search-input]").type("{enter}");
diff --git a/cypress/support/support.ts b/cypress/support/support.ts
index 5af019e..f518131 100644
--- a/cypress/support/support.ts
+++ b/cypress/support/support.ts
@@ -21,8 +21,9 @@ export const setupExtensionEnvironment = ({
       addListener: cy.stub(),
     } as any,
     onConnect: {
-      addListener: cy.stub(),
+      addListener: cy.stub().as("onConnect"),
     } as any,
+    connect: cy.stub().as("connect").returns(cy.stub())
   };
   (win.chrome.history as Partial<typeof chrome.history>) = {
     search: ((_: any, callback: (data: any[]) => void) => {
Delawen added a commit to Delawen/kaoto-ui that referenced this issue Apr 6, 2022
meili-bors bot added a commit to meilisearch/demo-movies that referenced this issue Jun 8, 2022
263: Add option to cypress container r=mdubus a=mdubus

Workflow were failing. See: https://github.com/meilisearch/demo-movies/runs/6792136755?check_suite_focus=true

Fix suggestion here: cypress-io/github-action#446

Co-authored-by: Morgane Dubus <[email protected]>
@gkatsanos
Copy link

Unfortunately the fix doesnt handle creation of directories, for example for storing screenshots and videos of test recordings.

@geryit
Copy link

geryit commented Mar 15, 2023

Had the same issue. This fixed it

@MikeMcC399
Copy link
Collaborator

@geryit

Had the same issue. This fixed it

Thanks for your feedback!

It's no longer necessary to run cypress-io/github-action in a container to get access to the regular browsers if you are using GitHub-hosted runners, since they already have browsers installed. See for instance ubuntu-22.04 browsers.

@MikeMcC399
Copy link
Collaborator

Closing, since this is an old issue using versions which are no longer supported.

If this issue is still occurring with current versions, then please open a new issue.

@MikeMcC399 MikeMcC399 closed this as not planned Won't fix, can't repro, duplicate, stale Nov 7, 2023
kaiserkernel added a commit to kaiserkernel/movies-gem-nextjs that referenced this issue Sep 18, 2024
263: Add option to cypress container r=mdubus a=mdubus

Workflow were failing. See: https://github.com/meilisearch/demo-movies/runs/6792136755?check_suite_focus=true

Fix suggestion here: cypress-io/github-action#446

Co-authored-by: Morgane Dubus <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants