redhat-cop / containers-quickstarts

Images & templates for deploying software to OpenShift
Apache License 2.0
249 stars 270 forks source link

jenkins-slave-npm Permission Issues #190

Closed philipdouble closed 5 years ago

philipdouble commented 5 years ago

I am having difficulty updating my pipeline to utilize the quick start version of 'jenkins-slave-npm'. Upon deploying the same project that had worked with the https://github.com/openshift/jenkins version, I get permission errors firing when I run npm commands from my project's jenkinsfile. When the pipleine attempts to run

+npm install

it results in the following error:

npm WARN locking Error: EACCES: permission denied, open '/home/jenkins/.npm/_locks/staging-6edf2455c6d48b38.lock' npm WARN locking /home/jenkins/.npm/_locks/staging-6edf2455c6d48b38.lock failed { [Error: EACCES: permission denied, open '/home/jenkins/.npm/_locks/staging-6edf2455c6d48b38.lock'] npm WARN locking stack: npm WARN locking 'Error: EACCES: permission denied, open \'/home/jenkins/.npm/_locks/staging-6edf2455c6d48b38.lock\'', npm WARN locking errno: -13, npm WARN locking code: 'EACCES', npm WARN locking syscall: 'open', npm WARN locking path: '/home/jenkins/.npm/_locks/staging-6edf2455c6d48b38.lock' } npm ERR! path /home/jenkins/.npm/_locks/staging-6edf2455c6d48b38.lock npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall open npm ERR! Error: EACCES: permission denied, open '/home/jenkins/.npm/_locks/staging-6edf2455c6d48b38.lock' npm ERR! { [Error: EACCES: permission denied, open '/home/jenkins/.npm/_locks/staging-6edf2455c6d48b38.lock'] npm ERR! stack: npm ERR! 'Error: EACCES: permission denied, open \'/home/jenkins/.npm/_locks/staging-6edf2455c6d48b38.lock\'', npm ERR! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'open', npm ERR! path: '/home/jenkins/.npm/_locks/staging-6edf2455c6d48b38.lock' } npm ERR! npm ERR! The operation was rejected by your operating system. npm ERR! It is likely you do not have the permissions to access this file as the current user npm ERR! npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator (though this is not recommended).

I updated the labs-ci-cd/params/jenkins-slaves/npm file to point from the old location to the new: OLD

SOURCE_REPOSITORY_URL=https://github.com/openshift/jenkins SOURCE_CONTEXT_DIR=agent-nodejs-8 BUILDER_IMAGE_NAME=openshift/jenkins-slave-base-centos7 NAME=jenkins-slave-npm SOURCE_REPOSITORY_REF=master

to look like this:

SOURCE_REPOSITORY_URL=https://github.com/redhat-cop/containers-quickstarts.git SOURCE_CONTEXT_DIR=jenkins-slaves/jenkins-slave-npm BUILDER_IMAGE_NAME=openshift/jenkins-slave-base-centos7:v3.11 NAME=jenkins-slave-npm SOURCE_REPOSITORY_REF=v1.7 DOCKERFILE_PATH=Dockerfile

I've also tried setting the REF to 1.6 - in that case, npm call is not found.

I am attempting to use this in conjunction with: https://github.com/rht-labs/labs-ci-cd and the vue-frontend-pipeline from: https://github.com/cognizen/container-pipelines

philipdouble commented 5 years ago

When I run this as:

SOURCE_REPOSITORY_REF=v1.3

It works - npm installs and the pipeline runs BUT the e2e tests won't run...

When I run this as:

SOURCE_REPOSITORY_REF=v1.4

The entire pipeline runs including the e2e tests. I believe that v1.4 is still node 8 though.

philipdouble commented 5 years ago

When I run

SOURCE_REPOSITORY_REF=v1.5

AND

SOURCE_REPOSITORY_REF=v1.6

I get the following error:

+ npm install /tmp/workspace/sandbox-pd-ci-cd/sandbox-pd-ci-cd-vue-frontend-scaffold-pipeline/vue-frontend-pipeline@tmp/durable-1f129f37/script.sh: line 1: npm: command not found

From what I can tell - the jenkins-slave-npm has been broken since this commit: https://github.com/redhat-cop/containers-quickstarts/commit/d8b36ac1653ffd0a6b0546cf82939b924c871687#diff-3089926e109843ad8dd79a540a08f71b

It requires a full fresh install of the labs-ci-cd pipeline to see this...

InfoSec812 commented 5 years ago

All of this is being addressed in #191 & #192. @haithamshahin333 and I have been addressing these issues back and forth.

philipdouble commented 5 years ago

@InfoSec812 & @haithamshahin333 Thank you for chasing this down!

philipdouble commented 5 years ago

I'm closing this out - Deven has this covered under #191