Skip to content

Commit

Permalink
Add jenkins slave-python & sonarqube
Browse files Browse the repository at this point in the history
  • Loading branch information
pabrahamsson committed Dec 30, 2017
1 parent a8082f0 commit 449d2f9
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 6 deletions.
67 changes: 67 additions & 0 deletions basic-python-flask/files/builds/jenkins-slave-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
apiVersion: v1
kind: Template
labels:
template: jenkins-slave
metadata:
annotations:
description: Template for Jenkins slave
iconClass: icon-jenkins
tags: instant-app,jenkins
name: jenkins-slave
objects:
- kind: BuildConfig
apiVersion: v1
metadata:
labels:
application: ${SLAVE_NAME}
name: ${SLAVE_NAME}
namespace: ${NAMESPACE}
spec:
output:
to:
kind: ImageStreamTag
name: ${SLAVE_NAME}:latest
source:
type: Git
git:
uri: ${SOURCE_REPOSITORY_URL}
ref: ${SOURCE_REPOSITORY_REF}
contextDir: ${CONTEXT_DIR}
strategy:
dockerStrategy:
from:
kind: DockerImage
name: ${JENKINS_IMAGE}
triggers:
- type: ConfigChange
- apiVersion: v1
kind: ImageStream
metadata:
annotations:
slave-label: python
labels:
application: ${SLAVE_NAME}
role: jenkins-slave
name: ${SLAVE_NAME}
namespace: ${NAMESPACE}
parameters:
- description: The name for the application.
name: SLAVE_NAME
required: true
- description: The namespace to deploy into
name: NAMESPACE
required: true
- description: Git source URL for application
name: SOURCE_REPOSITORY_URL
required: true
value: https://github.com/pabrahamsson/jenkins.git
- description: Git branch/tag reference
name: SOURCE_REPOSITORY_REF
value: master
- description: Path within Git repository to build; empty for root of repository
name: CONTEXT_DIR
value:
- description: The Jenkins source image
name: JENKINS_IMAGE
required: true
value: openshift/jenkins-slave-base-centos7
4 changes: 4 additions & 0 deletions basic-python-flask/files/builds/jenkins-slave/params
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SLAVE_NAME=slave-python
NAMESPACE=basic-python-flask-build
CONTEXT_DIR=slave-python
SOURCE_REPOSITORY_REF=slave-python
7 changes: 5 additions & 2 deletions basic-python-flask/files/builds/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,11 @@ objects:
kind: ImageStreamTag
name: ${APPLICATION_NAME}:latest
source:
binary: {}
type: Binary
type: Git
git:
uri: ${SOURCE_REPOSITORY_URL}
ref: ${SOURCE_REPOSITORY_REF}
contextDir: ${CONTEXT_DIR}
strategy:
sourceStrategy:
from:
Expand Down
2 changes: 1 addition & 1 deletion basic-python-flask/files/deployments/build/params
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
INSTALL_PLUGINS=cobertura:1.12
INSTALL_PLUGINS=cobertura:1.12,sonar:2.6.1
MEMORY_LIMIT=512Mi
4 changes: 4 additions & 0 deletions basic-python-flask/files/deployments/postgresql/params
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
POSTGRESQL_DATABASE=sonar
VOLUME_CAPACITY=5
POSTGRESQL_PASSWORD=sonar
POSTGRESQL_USER=sonar
9 changes: 9 additions & 0 deletions basic-python-flask/files/deployments/sonar/params
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MEMORY_LIMIT=1Gi
VOLUME_CAPACITY=2Gi
MEMORY_LIMIT=2Gi
CPU_LIMIT=1
JDBC_URL=jdbc:postgresql://postgresql:5432/sonar
JDBC_USER=sonar
JDBC_PASSWORD=sonar
SOURCE_REPOSITORY_URL=https://github.com/rht-labs/labs-ci-cd
SOURCE_REPOSITORY_CONTEXT_DIR=docker/sonarqube
14 changes: 11 additions & 3 deletions basic-python-flask/inventory/group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,21 @@ openshift_cluster_content:
- name: basic-python-flask-spaces
file: "{{ inventory_dir }}/../files/projects/projects.yml"
file_action: create
- object: imagestream
- object: builds
content:
- name: jenkins-slave-python
file: "{{ inventory_dir }}/../files/imagestreams/imagestreams.yml"
namespace: basic-python-flask-build
template: "{{ inventory_dir }}/../files/builds/jenkins-slave-template.yml"
params: "{{ inventory_dir }}/../files/builds/jenkins-slave/params"
- object: deployments
content:
- name: postgresql
namespace: basic-python-flask-build
template: openshift//postgresql-persistent
params: "{{ inventory_dir }}/../files/deployments/postgresql/params"
- name: sonarqube
namespace: basic-python-flask-build
template: https://raw.githubusercontent.com/rht-labs/labs-ci-cd/master/openshift-templates/sonarqube/template.json
params: "{{ inventory_dir }}/../files/deployments/sonar/params"
- name: jenkins
namespace: basic-python-flask-build
template: "{{ inventory_dir }}/../files/deployments/jenkins.yml"
Expand Down

0 comments on commit 449d2f9

Please sign in to comment.