Skip to content

Commit

Permalink
add pipeline template
Browse files Browse the repository at this point in the history
  • Loading branch information
gitlawr committed Dec 20, 2017
1 parent 51cb5f0 commit 3c6424e
Show file tree
Hide file tree
Showing 5 changed files with 180 additions and 0 deletions.
40 changes: 40 additions & 0 deletions infra-templates/pipeline/0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Rancher Pipeline

Easier to use, Easier to integrate CI/CD with Rancher.

## Description

This template deploys Rancher Pipeline, the continuous integration service powered by Jenkins.

It will be set up as an infrastructure stack in the Rancher environment.

## Prerequisite

Minimum system requirement of 2 core, 4 GB memory.

## Features

- Configure and manage your CI jobs in native Rancher UI.
- Simple to use, container based continuous integration system.
- multiple trigger types supported.
- Flexible CI flow control(stop, rerun, timeout, parallel/serial run, approve/deny, etc. ).

## Parameters

- `# of slaves`: The number of Jenkins slave to set up. Please set at least one slave. You can also do scaling of slaves after installation.
- `# of executors`: The number of executors on each Jenkins slave. The maximum number of concurrent builds that Jenkins may perform on a agent. A good value to start with would be the number of CPU cores on the machine. Setting a higher value would cause each build to take longer, but could increase the overall throughput. For example, one build might be CPU-bound, while a second build running at the same time might be I/O-bound — so the second build could take advantage of the spare I/O capacity at that moment. Agents must have at least one executor.


- `Host with Label to put pipeline components on`: This parameter specify the host labels to use. Pipeline components will be scheduled to dedicated hosts matching these host labels.

## Usage:

Select the template from the catalog.

Configure the parameters according to your workload and resource.

Click `Launch`.

After service is up, access Pipeline UI on top navigation bar of Rancher UI.

See [Pipeline documentation](https://github.com/rancher/pipeline) for detail information.
82 changes: 82 additions & 0 deletions infra-templates/pipeline/0/docker-compose.yml.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{{- $jenkinsMasterImage:="jenkins/jenkins:2.60.2-alpine"}}
{{- $jenkinsBootImage:="rancher/jenkins-boot:v0.1.1"}}
{{- $jenkinsSlaveImage:="rancher/pipeline-jenkins-slave:v0.1.0"}}
{{- $pipelineServerImage:="rancher/pipeline:v0.1.0"}}
{{- $pipelineUIImage:="rancher/pipeline-ui:v0.1.0"}}

version: '2'
services:
jenkins-master:
image: {{$jenkinsMasterImage}}
restart: always
environment:
- JENKINS_SLAVE_AGENT_PORT=50000
- JENKINS_HOME=/var/jenkins_home
volumes_from:
- jenkins-boot
volumes:
- /var/run/docker.sock:/var/run/docker.sock
labels:
io.rancher.sidekicks: jenkins-boot
io.rancher.container.create_agent: true
io.rancher.container.agent.role: environmentAdmin
{{- if ne .Values.HOST_LABEL "" }}
io.rancher.scheduler.affinity:host_label: ${HOST_LABEL}
{{- end }}
jenkins-boot:
image: {{$jenkinsBootImage}}
volumes:
- jenkins_home:/var/jenkins_home
labels:
io.rancher.container.start_once: true
jenkins-slave:
image: {{$jenkinsSlaveImage}}
restart: always
links:
- jenkins-master
environment:
- SLAVE_EXECUTORS=${EXECUTORS}
- JENKINS_MASTER=http://jenkins-master:8080
- JENKINS_USERNAME=admin
- JENKINS_PASSWORD=admin
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /var/jenkins_home
labels:
io.rancher.scheduler.affinity:container_label_soft_ne: io.rancher.stack_service.name=$${stack_name}/$${service_name}
io.rancher.container.create_agent: true
io.rancher.container.agent.role: environmentAdmin
io.rancher.container.pull_image: always
{{- if ne .Values.HOST_LABEL "" }}
io.rancher.scheduler.affinity:host_label: ${HOST_LABEL}
{{- end }}
pipeline-server:
image: {{$pipelineServerImage}}
restart: always
links:
- jenkins-master
environment:
- JENKINS_ADDRESS=http://jenkins-master:8080
- JENKINS_USER=admin
- JENKINS_TOKEN=admin
labels:
io.rancher.container.create_agent: true
io.rancher.container.agent.role: environmentAdmin
io.rancher.container.pull_image: always
{{- if ne .Values.HOST_LABEL "" }}
io.rancher.scheduler.affinity:host_label: ${HOST_LABEL}
{{- end }}
pipeline-ui:
image: {{$pipelineUIImage}}
restart: always
labels:
io.rancher.container.create_agent: true
io.rancher.container.agent.role: environment
io.rancher.container.pull_image: always
io.rancher.service.ui_link.label: "{\"en-us\":\"PIPELINE\",\"zh-hans\":\"流水线\"}"
{{- if ne .Values.HOST_LABEL "" }}
io.rancher.scheduler.affinity:host_label: ${HOST_LABEL}
{{- end }}
volumes:
jenkins_home:
driver: "local"
28 changes: 28 additions & 0 deletions infra-templates/pipeline/0/rancher-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: '2'
catalog:
name: Pipeline
version: v0.1.0
minimum_rancher_version: 1.6.13-rc2
description: "Rancher Pipeline"
questions:
- variable: SLAVES
type: "int"
default: "1"
label: "# of slaves"
description: "How many jenkins slaves to run ci tasks. At least 1."
- variable: EXECUTORS
type: "int"
default: "2"
label: "# of executors"
description: "How many executors on a jenkins slave"
- variable: HOST_LABEL
label: "Host with Label to put pipeline components on"
description: |
Run pipeline components on Host with specific labels.
Example: 'pipeline=true'
required: false
default: ""
type: "string"
services:
jenkins-slave:
scale: ${SLAVES}
23 changes: 23 additions & 0 deletions infra-templates/pipeline/catalogIcon-CICD.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions infra-templates/pipeline/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name: Rancher Pipeline
description: Rancher CI service
version: v0.1.0
category: Continuous Integration
labels:
io.rancher.certified: Experimental
io.rancher.orchestration.supported: 'cattle'

0 comments on commit 3c6424e

Please sign in to comment.