diff --git a/infra-templates/pipeline/0/README.md b/infra-templates/pipeline/0/README.md new file mode 100644 index 0000000..defbaa0 --- /dev/null +++ b/infra-templates/pipeline/0/README.md @@ -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. diff --git a/infra-templates/pipeline/0/docker-compose.yml.tpl b/infra-templates/pipeline/0/docker-compose.yml.tpl new file mode 100644 index 0000000..b8b22c7 --- /dev/null +++ b/infra-templates/pipeline/0/docker-compose.yml.tpl @@ -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" diff --git a/infra-templates/pipeline/0/rancher-compose.yml b/infra-templates/pipeline/0/rancher-compose.yml new file mode 100644 index 0000000..93e17bb --- /dev/null +++ b/infra-templates/pipeline/0/rancher-compose.yml @@ -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} diff --git a/infra-templates/pipeline/catalogIcon-CICD.svg b/infra-templates/pipeline/catalogIcon-CICD.svg new file mode 100644 index 0000000..8517547 --- /dev/null +++ b/infra-templates/pipeline/catalogIcon-CICD.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + diff --git a/infra-templates/pipeline/config.yml b/infra-templates/pipeline/config.yml new file mode 100644 index 0000000..f34b4f7 --- /dev/null +++ b/infra-templates/pipeline/config.yml @@ -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'