Otrebor
Otrebor

Reputation: 508

Tekton, npm ci, and "npm ERR! EMFILE: too many open files, open '/root/.npm/_cacache/"

I'm using an incredibly simple pipeline to build my angular App. I run it on an openshift cluster.

these are the two tasks:

  tasks:
    - name: fetch-source
      params:
        - name: url
          value: $(params.repo-url)
        - name: revision
          value: feature/tekton
      taskRef:
        kind: ClusterTask
        name: git-clone
      workspaces:
        - name: output
          workspace: shared-data
    - name: build-push
      params:
        - name: IMAGE
          value: $(params.image-reference)
        - name: DOCKERFILE
          value: $(params.containerfile-path)
        - name: CONTEXT
          value: $(params.context-dir-path)
      runAfter:
        - fetch-source
      taskRef:
        kind: ClusterTask
        name: buildah
      workspaces:
        - name: source
          workspace: shared-data

I'm trying to build this container file:

FROM node:latest as builder

USER root
# Set the working directory
WORKDIR /usr/local/app

# Add the source code to app
COPY ./ /usr/local/app/

RUN chown -R root /usr/local/app

RUN npm ci

# Generate the build of the application
RUN npm run build

# Stage 2: Serve app with nginx server
FROM nginx:latest
[...]

The command npm ci fails with the error:

npm ERR! code EMFILE
npm ERR! syscall open
npm ERR! path /root/.npm/_cacache/index-v5/d8/c0/7503a3169361b6a2c8813bf0eddb92eed6417987f616accf18698f2b71f4
npm ERR! errno -24
npm ERR! EMFILE: too many open files, open '/root/.npm/_cacache/index-v5/d8/c0/7503a3169361b6a2c8813bf0eddb92eed6417987f616accf18698f2b71f4'

npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-03-27T13_42_33_018Z-debug-0.log
subprocess exited with status 232
subprocess exited with status 232
Error: building at STEP "RUN npm ci": exit status 232

In my understanding NPM tries to open too many files and hits the ulimit of the container (1024). The Build config that is doing the same operation has not problem and I don't know how that can be possible. I suspect the difference is that the build that is working is executed in a privileged context but i don't know if it's safe to do the same with tekton tasks.

Any idea on were the problem could be?

Upvotes: 1

Views: 228

Answers (0)

Related Questions