#GitHub actions

1 messages · Page 1 of 1 (latest)

lilac oxide
#

hiya,
wondering if I can get some extra eyes on this..
I have an example dagger pipeline running in GitHub, I have it working locally fine. The issues I am seeing when running within the GitHub action is a failure on during npm ci as it cannot make /src/node_modules within the GitHub action.

has anyone else seen this?

the dagger code is here
https://github.com/British-Oceanographic-Data-Centre/amrit-repos/blob/feautre/CU-8696kuv0g_Code-containerisation-typescript_Thomas-Garnder/dagger/src/amrit_repos/main.py

I cannot open up the error from GitHub actions, but i will include it here

13  : [5.0s] | │ Stderr:                                                                      │
13  : [5.0s] | │ (node:7) ExperimentalWarning: CommonJS module                                │
13  : [5.0s] | │ /usr/lib/node_modules/npm/node_modules/debug/src/node.js is loading ES       │
13  : [5.0s] | │ Module /usr/lib/node_modules/npm/node_modules/supports-color/index.js using  │
13  : [5.0s] | │ require().                                                                   │
13  : [5.0s] | │ Support for loading ES Module in require() is an experimental feature and    │
13  : [5.0s] | │ might change at any time                                                     │
13  : [5.0s] | │ (Use `node --trace-warnings ...` to show where the warning was created)      │
13  : [5.0s] | │ npm error code EACCES                                                        │
13  : [5.0s] | │ npm error syscall mkdir                                                      │
13  : [5.0s] | │ npm error path /src/node_modules                                             │
13  : [5.0s] | │ npm error errno -13                                                          │
13  : [5.0s] | │ npm error Error: EACCES: permission denied, mkdir '/src/node_modules'        │
torpid leaf
#

@lilac oxide just checked it out really quick and I'm also getting the same error locally:

 ): Container! 3.0s
 ✔ Container.from(address: "cgr.dev/chainguard/node"): Container! 1.0s
   ✔ resolving cgr.dev/chainguard/node:latest 1.0s
 ✘ Container.withExec(args: ["npm", "ci"]): Container! 0.9s
 ┃ (node:7) ExperimentalWarning: CommonJS module /usr/lib/node_modules/npm/node_modules/debug/src
 ┃ .js is loading ES Module /usr/lib/node_modules/npm/node_modules/supports-color/index.js using
 ┃ re().
 ┃ Support for loading ES Module in require() is an experimental feature and might change at any
 ┃ (Use `node --trace-warnings ...` to show where the warning was created)
 ┃ npm error code EACCES
 ┃ npm error syscall unlink
 ┃ npm error path /src/node_modules/.package-lock.json
 ┃ npm error errno -13
 ┃ npm error [Error: EACCES: permission denied, unlink '/src/node_modules/.package-lock.json'] {
 ┃ npm error   errno: -13,
 ┃ npm error   code: 'EACCES',
 ┃ npm error   syscall: 'unlink',
 ┃ npm error   path: '/src/node_modules/.package-lock.json'
 ┃ npm error }
 ┃ npm error
 ┃ npm error The operation was rejected by your operating system.
 ┃ npm error It is likely you do not have the permissions to access this file as the current user
 ┃ npm error
 ┃ npm error If you believe this might be a permissions issue, please double-check the
 ┃ npm error permissions of the file and its containing directories, or try running
 ┃ npm error the command again as root/Administrator.
 ┃ npm error A complete log of this run can be found in: /home/node/.npm/_logs/2024-11-13T16_09_3
#

the issue seems to be that chainguar'd node image default user doesn't have permissions to do anything outside /app

if you add owner="node" to your with_directory call, that should fix it.

i.e: .with_directory("/src", source, owner="node")

lilac oxide
#

Cheers for looking into this, so the fact that it is passing locally on my Windows 11 machine is maybe something to do with caching? i did early on have a different image other than chaingaurd.... i'll see again

#
 AmritRepos.lint(
    source: ✔ ModuleSource@xxh3:6846e9ab36762412.resolveDirectoryFromCaller(path: "typescript-demo"): Directory! = xxh3:72ebf55f13b13a33 0.0s
  ): String! = xxh3:8a5d09b8aebc21ba 5.5s
  ✔ exec /runtime 5.4s
  ✔ cacheVolume(key: "node"): CacheVolume! = xxh3:1d99b4ec409801b0 0.0s
  ✔ Container.from(address: "cgr.dev/chainguard/node"): Container! = xxh3:eba6d01af6e6b4dc 1.6s
   ....
    ✔ Container.from(address: "cgr.dev/chainguard/node:latest@sha256:0a4bb19cd6e501b8910080df02ab2faf1d87a83b5776f1a60b8a221b477d250e"): Container! = xxh3:0379be184093175c 0.0s
      ✔ resolving cgr.dev/chainguard/node:latest@sha256:0a4bb19cd6e501b8910080df02ab2faf1d87a83b5776f1a60b8a221b477d250e 0.0s
  ✔ Container@xxh3:6934f6e558023746.withDirectory(
      directory: ✔ ModuleSource@xxh3:6846e9ab36762412.resolveDirectoryFromCaller(path: "typescript-demo"): Directory! = xxh3:72ebf55f13b13a33 0.0s
      path: "/src"
    ): Container! = xxh3:9de27abc37a2f0cf 0.1s
    ✔ cache request: pull cgr.dev/chainguard/node:latest@sha256:0a4bb19cd6e501b8910080df02ab2faf1d87a83b5776f1a60b8a221b477d250e 0.1s
  ✔ Container@xxh3:0379be184093175c.withMountedCache(
      cache: ✔ cacheVolume(key: "node"): CacheVolume! = xxh3:1d99b4ec409801b0 0.0s
      path: "/root/.npm"
    ): Container! = xxh3:8104749b8efce2a8 0.1s
  ✔ Container@xxh3:9de27abc37a2f0cf.withWorkdir(path: "/src"): Container! = xxh3:3a3ee2a7285bd802 0.1s
  ✔ Container@xxh3:8104749b8efce2a8.withExec(args: ["npm", "ci"]): Container! = xxh3:d6062d9c4cf6bf87 0.1s
  ✔ Container@xxh3:3a3ee2a7285bd802.withExec(args: ["npm", "run", "lint"]): Container! = xxh3:cef9c93ec454d559 0.1s
    ✔ load cache: exec npm run lint 0.0s
  ✔ Container@xxh3:d6062d9c4cf6bf87.stdout: String! = xxh3:f52c3cd38ca4d18c 0.1s

Setup tracing at https://dagger.cloud/traces/setup. To hide: export GOAWAY=1


> typescript-demo@0.1.0 lint
> next lint

....

✔ No ESLint warnings or errors
lilac oxide
#

umm I guess that maybe it might be the with_monted_cache then, as the logs seem to show it bring in the chainguard image ... is there somewhy i can run dagger with a clean cache?

torpid leaf
lilac oxide
#

so that stilled worked 🪟
docker desktop stopped and delete the engine container
reran the command
dagger call lint --source=typescript-demo

#
✔ AmritRepos.lint(
    source: ✔ ModuleSource.resolveDirectoryFromCaller(path: "typescript-demo"): Directory! 0.0s
  ): String! 1m20.5s

Setup tracing at https://dagger.cloud/traces/setup. To hide: export STOPIT=1


> typescript-demo@0.1.0 lint
> next lint
torpid leaf
#

just cloned the repo and ran the command on a new engine and I'm effectively getting the error.

│ npm error     at async CI.exec                                               │
│ (/usr/lib/node_modules/npm/lib/commands/ci.js💯5)                            │
│ npm error     at async Npm.exec (/usr/lib/node_modules/npm/lib/npm.js:207:9) │
│ npm error     at async module.exports                                        │
│ (/usr/lib/node_modules/npm/lib/cli/entry.js:74:5) {                          │
│ npm error   errno: -13,                                                      │
│ npm error   code: 'EACCES',                                                  │
│ npm error   syscall: 'mkdir',                                                │
│ npm error   path: '/src/node_modules'                                        │
│ npm error }                                                                  │
│ npm error                                                                    │
│ npm error The operation was rejected by your operating system.               │
│ npm error It is likely you do not have the permissions to access this file   │
│ as the current user                                                          │
│ npm error                                                                    │
#

just to make sure, you're not running this in WSL don't you?

lilac oxide
#

ooo i am yes, sorry that should have been mention before

torpid leaf
#

@lilac oxide just to verify, did the owner change fixed it GHA?

lilac oxide
#

ah ok, I will try that as well. so I have pushed it, now it has moved on to a different error 🙂 so that is process