donal
2018-04-07 f372cd7297c1e599bd31965fd0eaa392eac7e303
ADD ---
4 files added
1 files renamed
123 ■■■■■ changed files
docker/jenkins-slave-npm/.gitkeep patch | view | raw | blame | history
docker/jenkins-slave-npm/Dockerfile 22 ●●●●● patch | view | raw | blame | history
docker/jenkins-slave-npm/README.md 15 ●●●●● patch | view | raw | blame | history
params/jenkins-slave-npm 3 ●●●●● patch | view | raw | blame | history
templates/jenkins-slave-generic-template.yml 83 ●●●●● patch | view | raw | blame | history
docker/jenkins-slave-npm/.gitkeep
docker/jenkins-slave-npm/Dockerfile
New file
@@ -0,0 +1,22 @@
#invoke npm in jenkinsfile: sh "scl enable rh-nodejs6 'npm run build'"
FROM openshift/jenkins-slave-nodejs-rhel7:latest
USER root
ADD https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm google-chrome-stable_current_x86_64.rpm
RUN yum -y install redhat-lsb libXScrnSaver xdg-utils wget
RUN yum -y localinstall google-chrome-stable_current_x86_64.rpm
ENV CHROME_BIN /bin/google-chrome
RUN yum remove -y rh-nodejs4; \
    yum repolist > /dev/null && \
    INSTALL_PKGS="rh-nodejs8 rh-nodejs8-npm rh-nodejs8-nodejs-nodemon nss_wrapper" && \
    yum install -y --setopt=tsflags=nodocs \
      --enablerepo=rhel-server-rhscl-7-rpms \
      --enablerepo=rhel-7-server-optional-rpms \
      --enablerepo=rhel-7-server-optional-rpms \
      $INSTALL_PKGS && \
    rpm -V $INSTALL_PKGS && \
    yum clean all -y && \
    rm -rf /var/cache/yum
USER 1001
docker/jenkins-slave-npm/README.md
New file
@@ -0,0 +1,15 @@
# jenkins-slave-npm
Provides a docker image of the nodejs v6 runtime with npm for use as a Jenkins slave.
## Build
`docker build -t jenkins-slave-npm .`
## Run
For local running and experimentation run `docker run -i -t --rm jenkins-slave-npm /bin/bash` and have a play once inside the container.
## Jenkins Running
Add a new Kubernetes Container template called `jenkins-slave-npm` and specify this as the node when running builds.
```
scl enable rh-nodejs6 'npm install'
scl enable rh-nodejs6 'npm run build'
```
params/jenkins-slave-npm
New file
@@ -0,0 +1,3 @@
SOURCE_REPOSITORY_URL=<YOUR_ENABLEMENT_GIT_REPO>
SOURCE_CONTEXT_DIR=docker/jenkins-slave-npm
NAME=jenkins-slave-npm
templates/jenkins-slave-generic-template.yml
New file
@@ -0,0 +1,83 @@
---
kind: Template
apiVersion: v1
metadata:
  name: "${NAME}"
  annotations:
    openshift.io/display-name: Generic Build Pod
    description: "${NAME} build pod template pre-configured to use a jenkins slave in the
      same project/namespace"
objects:
- apiVersion: v1
  kind: ImageStream
  metadata:
    labels:
      build: "${NAME}"
      role: jenkins-slave
    name: "${NAME}"
- apiVersion: v1
  kind: BuildConfig
  metadata:
    labels:
      build: "${NAME}"
      type: image
    name: "${NAME}"
  spec:
    nodeSelector:
    output:
      to:
        kind: ImageStreamTag
        name: "${NAME}:${SLAVE_IMAGE_TAG}"
    postCommit: {}
    resources: {}
    runPolicy: Serial
    source:
      sourceSecret:
        name: "gitlab-auth"
      contextDir: "${SOURCE_CONTEXT_DIR}"
      git:
        ref: "${SOURCE_REPOSITORY_REF}"
        uri: "${SOURCE_REPOSITORY_URL}"
      type: Git
    strategy:
      dockerStrategy:
        env:
          - name: "GIT_SSL_NO_VERIFY"
            value: "true"
        from:
          kind: DockerImage
          name: "${BUILDER_IMAGE_NAME}"
      type: Docker
    triggers:
    - type: ConfigChange
    - type: ImageChange
parameters:
- name: NAME
  displayName: Name
  description: The name assigned to all objects and the resulting imagestream.
  required: true
- name: SOURCE_REPOSITORY_URL
  displayName: Git Repository URL
  description: The URL of the repository with your application source code.
  required: true
  value: https://github.com/redhat-cop/containers-quickstarts
- name: SOURCE_REPOSITORY_REF
  displayName: Git Reference
  description: Set this to a branch name, tag or other ref of your repository if you
    are not using the default (master) branch.
  value: master
- name: SOURCE_CONTEXT_DIR
  displayName: Git Context Directory
  description: Set this to the directory where the build information is (e.g. Dockerfile)
    if not using the default
- name: BUILDER_IMAGE_NAME
  displayName: Image name from which to build this pod
  description: The build image which this build pod will extend to create it's new
    build pod type.
  value: registry.access.redhat.com/openshift3/jenkins-slave-base-rhel7
- name: SLAVE_IMAGE_TAG
  displayName: Image tag for Jenkins slave.
  description: This is the image tag used for the Jenkins slave.
  value: latest
labels:
  template: build-pod-template