Browse Source

[skip travis] update Jenkins support with pre-built images

pull/50/head
Nicolas Massé 7 years ago
parent
commit
d22bbac62c
  1. 23
      support/jenkins/Dockerfile
  2. 9
      support/jenkins/README.md
  3. 89
      support/jenkins/jenkins-slave-template-centos.yaml
  4. 3
      support/jenkins/jenkins-slave-template-rhel.yaml

23
support/jenkins/Dockerfile

@ -0,0 +1,23 @@
FROM openshift/jenkins-slave-base-centos7:v3.11
MAINTAINER Nicolas Masse <nmasse@redhat.com>
# Labels consumed by Red Hat build service
LABEL name="openshift3/jenkins-agent-ansible-26-centos7" \
version="v3.11" \
architecture="x86_64" \
io.k8s.display-name="Jenkins Agent Ansible" \
io.k8s.description="The jenkins agent ansible image has the Ansible engine on top of the jenkins slave base image." \
io.openshift.tags="openshift,jenkins,agent,ansible"
USER root
RUN yum install -y epel-release && \
yum install -y 'ansible >= 2.6' && \
yum install -y python27-python-pip && \
scl enable python27 "pip install --install-option='--install-purelib=/usr/lib/python2.7/site-packages/' jinja2" && \
yum clean all && \
rm -rf /var/cache/yum && \
chown -R 1001:0 $HOME && \
chmod -R g+rw $HOME
USER 1001

9
support/jenkins/README.md

@ -16,8 +16,8 @@ To use this role from Jenkins, you will need to:
You can create the Jenkins Slave image for Ansible by executing the following command **in the same project as your Jenkins master**: You can create the Jenkins Slave image for Ansible by executing the following command **in the same project as your Jenkins master**:
```sh ```sh
oc create -f https://raw.githubusercontent.com/nmasse-itix/threescale-cicd/master/support/jenkins/jenkins-slave-template-centos.yaml oc import-image jenkins-ansible-slave:master --from=docker.io/nmasse-itix/threescale-cicd:master --confirm
oc new-app --template=jenkins-ansible-slave oc annotate is jenkins-ansible-slave role=jenkins-slave --overwrite
``` ```
Alternatively, if you are a Red Hat customer, you can build your images based on RHEL with the following commands: Alternatively, if you are a Red Hat customer, you can build your images based on RHEL with the following commands:
@ -25,11 +25,6 @@ Alternatively, if you are a Red Hat customer, you can build your images based on
```sh ```sh
oc create -f https://raw.githubusercontent.com/nmasse-itix/threescale-cicd/master/support/jenkins/jenkins-slave-template-rhel.yaml oc create -f https://raw.githubusercontent.com/nmasse-itix/threescale-cicd/master/support/jenkins/jenkins-slave-template-rhel.yaml
oc new-app --template=jenkins-ansible-slave oc new-app --template=jenkins-ansible-slave
```
Wait for the build to finish:
```sh
oc logs -f bc/jenkins-ansible-slave oc logs -f bc/jenkins-ansible-slave
``` ```

89
support/jenkins/jenkins-slave-template-centos.yaml

@ -1,89 +0,0 @@
apiVersion: v1
kind: Template
labels:
template: jenkins-ansible-slave
metadata:
annotations:
description: |-
A Jenkins slave that embeds Ansible 2.6 on CentOS
openshift.io/display-name: Jenkins Slave for Ansible
tags: jenkins
template.openshift.io/documentation-url: https://github.com/nmasse-itix/threescale-cicd
template.openshift.io/long-description:
template.openshift.io/provider-display-name: Nicolas Massé
template.openshift.io/support-url: https://github.com/nmasse-itix/threescale-cicd/issues
name: jenkins-ansible-slave
parameters:
- name: OPENSHIFT_VERSION
value: v3.11
required: true
objects:
- apiVersion: v1
kind: ImageStream
metadata:
annotations:
openshift.io/display-name: Jenkins Slave for Ansible
name: jenkins-ansible-slave
spec:
tags:
- name: latest
annotations:
role: jenkins-slave
- apiVersion: v1
kind: ImageStream
metadata:
name: jenkins-slave-base
spec:
tags:
- name: ${OPENSHIFT_VERSION}
referencePolicy:
type: Local
from:
kind: DockerImage
name: docker.io/openshift/jenkins-slave-base-centos7:${OPENSHIFT_VERSION}
importPolicy:
scheduled: true
- apiVersion: v1
kind: BuildConfig
metadata:
name: jenkins-ansible-slave
spec:
output:
to:
kind: ImageStreamTag
name: jenkins-ansible-slave:latest
runPolicy: Serial
source:
dockerfile: |-
FROM openshift/jenkins-slave-base-centos7:${OPENSHIFT_VERSION}
MAINTAINER Nicolas Masse <nmasse@redhat.com>
# Labels consumed by Red Hat build service
LABEL name="openshift3/jenkins-agent-ansible-26-centos7" \
version="${OPENSHIFT_VERSION}" \
architecture="x86_64" \
io.k8s.display-name="Jenkins Agent Ansible" \
io.k8s.description="The jenkins agent ansible image has the Ansible engine on top of the jenkins slave base image." \
io.openshift.tags="openshift,jenkins,agent,ansible"
USER root
RUN yum install -y ansible && \
yum install -y python27-python-pip && \
scl enable python27 "pip install --install-option='--install-purelib=/usr/lib/python2.7/site-packages/' jinja2" && \
yum clean all && \
rm -rf /var/cache/yum && \
chown -R 1001:0 $HOME && \
chmod -R g+rw $HOME
USER 1001
type: Dockerfile
strategy:
dockerStrategy:
from:
kind: ImageStreamTag
name: jenkins-slave-base:${OPENSHIFT_VERSION}
type: Docker
triggers:
- type: ConfigChange
- type: ImageChange

3
support/jenkins/jenkins-slave-template-rhel.yaml

@ -70,7 +70,7 @@ objects:
io.openshift.tags="openshift,jenkins,agent,ansible" io.openshift.tags="openshift,jenkins,agent,ansible"
USER root USER root
RUN yum install -y --enablerepo=rhel-7-server-ansible-2.6-rpms ansible && \ RUN yum install -y --enablerepo=rhel-7-server-ansible-2.6-rpms 'ansible >= 2.6' && \
yum install -y --enablerepo=rhel-server-rhscl-7-rpms python27-python-pip && \ yum install -y --enablerepo=rhel-server-rhscl-7-rpms python27-python-pip && \
scl enable python27 "pip install --install-option='--install-purelib=/usr/lib/python2.7/site-packages/' jinja2" && \ scl enable python27 "pip install --install-option='--install-purelib=/usr/lib/python2.7/site-packages/' jinja2" && \
yum clean all && \ yum clean all && \
@ -82,6 +82,7 @@ objects:
type: Dockerfile type: Dockerfile
strategy: strategy:
dockerStrategy: dockerStrategy:
noCache: true
from: from:
kind: ImageStreamTag kind: ImageStreamTag
name: jenkins-slave-base:${OPENSHIFT_VERSION} name: jenkins-slave-base:${OPENSHIFT_VERSION}

Loading…
Cancel
Save