Skip to content

Commit

Permalink
Move node.js to RHOAR and fix permissions
Browse files Browse the repository at this point in the history
* Remove scl_enable

* Fixed an issue with NPM and NodeJS install packages

* Added note about RHOAR repositories

* Fixed jenkins home dir permissions

* Remove sonar-scanner command

Running sonar-scanner was intended to pre-cache some settings, but since java is not in the PATH until AFTER the first start we have to remove it.
  • Loading branch information
InfoSec812 authored and sherl0cks committed Mar 26, 2019
1 parent 9ccc44b commit 5f9bceb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 3 additions & 1 deletion jenkins-slaves/jenkins-slave-npm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ RUN INSTALL_PKGS="nodejs redhat-lsb libXScrnSaver xdg-utils liberation-fonts" &&
yum clean all -y && \
rm -rf /var/cache/yum && \
npm install --unsafe-perm -g npm-audit-html npm-audit-ci-wrapper sonar-scanner || cat /home/jenkins/.npm/_logs/*-debug.log && \
sonar-scanner || echo
chown root:root /home/jenkins -R && \
chmod 775 /home/jenkins/.config -R && \
chmod 775 /home/jenkins/.npm -R

USER 1001
11 changes: 6 additions & 5 deletions jenkins-slaves/jenkins-slave-npm/Dockerfile.rhel7
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#invoke npm in jenkinsfile: sh "scl enable rh-nodejs6 'npm run build'"
FROM openshift3/jenkins-slave-base-rhel7:v3.11
FROM registry.access.redhat.com/openshift3/jenkins-slave-base-rhel7:v3.11

LABEL com.redhat.component="jenkins-slave-nodejs-rhel7-docker" \
name="openshift3/jenkins-slave-nodejs-rhel7" \
Expand All @@ -15,10 +15,9 @@ ENV NODEJS_VERSION=10 \
PATH=$HOME/node_modules/.bin/:$HOME/.npm-global/bin/:$PATH \
CHROME_BIN=/bin/google-chrome

COPY contrib/bin/scl_enable /usr/local/bin/scl_enable
ADD src/google-chrome.repo /etc/yum.repos.d/

RUN INSTALL_PKGS="rh-nodejs${NODEJS_VERSION} rh-nodejs${NODEJS_VERSION}-npm rh-nodejs${NODEJS_VERSION}-nodejs-nodemon nss_wrapper redhat-lsb libXScrnSaver xdg-utils google-chrome-stable" && \
RUN INSTALL_PKGS="npm nss_wrapper redhat-lsb libXScrnSaver xdg-utils google-chrome-stable" && \
yum install -y --setopt=tsflags=nodocs \
--disablerepo=* \
--enablerepo=rhel-7-server-rpms \
Expand All @@ -29,7 +28,9 @@ RUN INSTALL_PKGS="rh-nodejs${NODEJS_VERSION} rh-nodejs${NODEJS_VERSION}-npm rh-n
$INSTALL_PKGS && \
yum clean all -y && \
rm -rf /var/cache/yum && \
npm install -g npm-audit-html npm-audit-ci-wrapper sonar-scanner && \
sonar-scanner || echo
npm install --unsafe-perm -g npm-audit-html npm-audit-ci-wrapper sonar-scanner && \
chown root:root /home/jenkins -R && \
chmod 775 /home/jenkins/.config -R && \
chmod 775 /home/jenkins/.npm -R

USER 1001
6 changes: 6 additions & 0 deletions jenkins-slaves/jenkins-slave-npm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Provides a docker image of the nodejs v8 runtime with npm for use as a Jenkins s
## Build local
`docker build -t jenkins-slave-npm .`

Or for Red Hat Enterprise Linux:

`docker build -t jenkins-slave-npm -f Dockerfile.rhel7 .`

### NOTE: To build the RHEL image you will need to have access to the `rhel-7-server-rhoar-nodejs-10-rpms` repository

## Run local
For local running and experimentation run `docker run -i -t jenkins-slave-npm /bin/bash` and have a play once inside the container.

Expand Down

0 comments on commit 5f9bceb

Please sign in to comment.