├── .gitignore ├── documentation └── logo.png ├── docker-images ├── master │ ├── executors.groovy │ ├── Dockerfile │ └── default-user.groovy ├── ssh-slave │ ├── entrypoint.sh │ └── Dockerfile └── slave │ ├── Dockerfile │ └── slave.py ├── Makefile ├── README.md └── LICENSE.txt /.gitignore: -------------------------------------------------------------------------------- 1 | jenkins_home/ 2 | .vagrant/ 3 | -------------------------------------------------------------------------------- /documentation/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/foxylion/docker-jenkins/HEAD/documentation/logo.png -------------------------------------------------------------------------------- /docker-images/master/executors.groovy: -------------------------------------------------------------------------------- 1 | import jenkins.model.* 2 | Jenkins.instance.setNumExecutors(0) 3 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | 2 | SHELL:=/bin/bash 3 | 4 | build: build-master build-slave 5 | 6 | build-master: 7 | cd docker-images/master && docker build -t foxylion/jenkins . 8 | 9 | build-slave: 10 | cd docker-images/slave && docker build -t foxylion/jenkins-slave . 11 | 12 | build-ssh-slave: 13 | cd docker-images/ssh-slave && docker build -t foxylion/jenkins-ssh-slave . 14 | -------------------------------------------------------------------------------- /docker-images/ssh-slave/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | if [[ -n "$SSH_KEY" ]]; then 5 | echo "INFO: Allowing key authentication." 6 | echo $SSH_KEY > /root/.ssh/authorized_keys 7 | else 8 | echo "INFO: Allowing password authentication." 9 | echo "root:$SSH_PASSWORD" | chpasswd 10 | fi 11 | 12 | echo "INFO: This slave's fingerprint is: `ssh-keygen -l -E md5 -f /etc/ssh/ssh_host_rsa_key`" 13 | 14 | echo "INFO: Running $@" 15 | exec $@ 16 | -------------------------------------------------------------------------------- /docker-images/master/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM jenkins/jenkins:latest 2 | 3 | RUN /usr/local/bin/install-plugins.sh git matrix-auth workflow-aggregator docker-workflow blueocean credentials-binding 4 | 5 | ENV JENKINS_USER admin 6 | ENV JENKINS_PASS admin 7 | 8 | # Skip initial setup 9 | ENV JAVA_OPTS -Djenkins.install.runSetupWizard=false 10 | 11 | COPY executors.groovy /usr/share/jenkins/ref/init.groovy.d/ 12 | COPY default-user.groovy /usr/share/jenkins/ref/init.groovy.d/ 13 | 14 | VOLUME /var/jenkins_home 15 | -------------------------------------------------------------------------------- /docker-images/master/default-user.groovy: -------------------------------------------------------------------------------- 1 | import jenkins.model.* 2 | import hudson.security.* 3 | 4 | def env = System.getenv() 5 | 6 | def jenkins = Jenkins.getInstance() 7 | if(!(jenkins.getSecurityRealm() instanceof HudsonPrivateSecurityRealm)) 8 | jenkins.setSecurityRealm(new HudsonPrivateSecurityRealm(false)) 9 | 10 | if(!(jenkins.getAuthorizationStrategy() instanceof GlobalMatrixAuthorizationStrategy)) 11 | jenkins.setAuthorizationStrategy(new GlobalMatrixAuthorizationStrategy()) 12 | 13 | def user = jenkins.getSecurityRealm().createAccount(env.JENKINS_USER, env.JENKINS_PASS) 14 | user.save() 15 | jenkins.getAuthorizationStrategy().add(Jenkins.ADMINISTER, env.JENKINS_USER) 16 | 17 | jenkins.save() 18 | -------------------------------------------------------------------------------- /docker-images/ssh-slave/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | # Install required dependencies for jenkins slave launch 4 | RUN apt-get update && apt-get install -y openssh-server openjdk-8-jre-headless 5 | 6 | # Install common binaries to support some generic functionality without an docker image 7 | RUN apt-get update && apt-get install -y git make curl 8 | 9 | # Install docker 10 | RUN apt-get update && apt-get install -y apt-transport-https ca-certificates software-properties-common 11 | RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - 12 | RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" 13 | RUN apt-get update && apt-get install -y docker-ce=18.03.1~ce-0~ubuntu 14 | 15 | RUN mkdir -p /root/.ssh 16 | RUN sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config 17 | ENV SSH_PASSWORD jenkins 18 | ENV SSH_KEY "" 19 | 20 | RUN mkdir /var/run/sshd 21 | 22 | ADD entrypoint.sh /entrypoint.sh 23 | ENTRYPOINT ["/entrypoint.sh"] 24 | 25 | CMD ["/usr/sbin/sshd", "-D"] 26 | -------------------------------------------------------------------------------- /docker-images/slave/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | # Install Docker CLI 4 | RUN apt-get update && apt-get install -y apt-transport-https ca-certificates 5 | RUN apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D 6 | RUN echo "deb https://apt.dockerproject.org/repo ubuntu-xenial main" > /etc/apt/sources.list.d/docker.list 7 | RUN apt-get update && apt-get install -y docker-engine 8 | 9 | RUN apt-get update && apt-get install -y openjdk-8-jre curl python python-pip git 10 | RUN pip install jenkins-webapi 11 | 12 | RUN mkdir -p /home/jenkins 13 | RUN mkdir -p /var/lib/jenkins 14 | 15 | ADD slave.py /var/lib/jenkins/slave.py 16 | 17 | WORKDIR /home/jenkins 18 | 19 | ENV JENKINS_URL "http://jenkins" 20 | ENV JENKINS_SLAVE_ADDRESS "" 21 | ENV JENKINS_USER "admin" 22 | ENV JENKINS_PASS "admin" 23 | ENV SLAVE_NAME "" 24 | ENV SLAVE_SECRET "" 25 | ENV SLAVE_EXECUTORS "1" 26 | ENV SLAVE_LABELS "docker" 27 | ENV SLAVE_WORING_DIR "" 28 | ENV CLEAN_WORKING_DIR "true" 29 | 30 | CMD [ "python", "-u", "/var/lib/jenkins/slave.py" ] 31 | -------------------------------------------------------------------------------- /docker-images/slave/slave.py: -------------------------------------------------------------------------------- 1 | from jenkins import Jenkins, JenkinsError, NodeLaunchMethod 2 | import os 3 | import signal 4 | import sys 5 | import urllib 6 | import subprocess 7 | import shutil 8 | 9 | slave_jar = '/var/lib/jenkins/slave.jar' 10 | slave_name = os.environ['SLAVE_NAME'] if os.environ['SLAVE_NAME'] != '' else 'docker-slave-' + os.environ['HOSTNAME'] 11 | jnlp_url = os.environ['JENKINS_URL'] + '/computer/' + slave_name + '/slave-agent.jnlp' 12 | process = None 13 | 14 | def clean_dir(dir): 15 | for root, dirs, files in os.walk(dir): 16 | for f in files: 17 | os.unlink(os.path.join(root, f)) 18 | for d in dirs: 19 | shutil.rmtree(os.path.join(root, d)) 20 | 21 | def slave_create(node_name, working_dir, executors, labels): 22 | j = Jenkins(os.environ['JENKINS_URL'], os.environ['JENKINS_USER'], os.environ['JENKINS_PASS']) 23 | j.node_create(node_name, working_dir, num_executors = int(executors), labels = labels, launcher = NodeLaunchMethod.JNLP) 24 | 25 | def slave_delete(node_name): 26 | j = Jenkins(os.environ['JENKINS_URL'], os.environ['JENKINS_USER'], os.environ['JENKINS_PASS']) 27 | j.node_delete(node_name) 28 | 29 | def slave_download(target): 30 | if os.path.isfile(slave_jar): 31 | os.remove(slave_jar) 32 | 33 | loader = urllib.URLopener() 34 | loader.retrieve(os.environ['JENKINS_URL'] + '/jnlpJars/slave.jar', '/var/lib/jenkins/slave.jar') 35 | 36 | def slave_run(slave_jar, jnlp_url): 37 | params = [ 'java', '-jar', slave_jar, '-jnlpUrl', jnlp_url ] 38 | if os.environ['JENKINS_SLAVE_ADDRESS'] != '': 39 | params.extend([ '-connectTo', os.environ['JENKINS_SLAVE_ADDRESS' ] ]) 40 | 41 | if os.environ['SLAVE_SECRET'] == '': 42 | params.extend([ '-jnlpCredentials', os.environ['JENKINS_USER'] + ':' + os.environ['JENKINS_PASS'] ]) 43 | else: 44 | params.extend([ '-secret', os.environ['SLAVE_SECRET'] ]) 45 | return subprocess.Popen(params, stdout=subprocess.PIPE) 46 | 47 | def signal_handler(sig, frame): 48 | if process != None: 49 | process.send_signal(signal.SIGINT) 50 | 51 | signal.signal(signal.SIGINT, signal_handler) 52 | signal.signal(signal.SIGTERM, signal_handler) 53 | 54 | slave_download(slave_jar) 55 | print 'Downloaded Jenkins slave jar.' 56 | 57 | if os.environ['SLAVE_WORING_DIR']: 58 | os.setcwd(os.environ['SLAVE_WORING_DIR']) 59 | 60 | if os.environ['CLEAN_WORKING_DIR'] == 'true': 61 | clean_dir(os.getcwd()) 62 | print "Cleaned up working directory." 63 | 64 | if os.environ['SLAVE_NAME'] == '': 65 | slave_create(slave_name, os.getcwd(), os.environ['SLAVE_EXECUTORS'], os.environ['SLAVE_LABELS']) 66 | print 'Created temporary Jenkins slave.' 67 | 68 | process = slave_run(slave_jar, jnlp_url) 69 | print 'Started Jenkins slave with name "' + slave_name + '" and labels [' + os.environ['SLAVE_LABELS'] + '].' 70 | process.wait() 71 | 72 | print 'Jenkins slave stopped.' 73 | if os.environ['SLAVE_NAME'] == '': 74 | slave_delete(slave_name) 75 | print 'Removed temporary Jenkins slave.' 76 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [docker-jenkins](https://github.com/foxylion/docker-jenkins#the-docker-images) 2 | 3 | This project aims to build a pre-configured Docker image for Jenkins 2. [Here you can find the manual.](https://github.com/foxylion/docker-jenkins#the-docker-images) 4 | 5 | ![Jenkins+Docker Logo](https://raw.githubusercontent.com/foxylion/docker-jenkins/master/documentation/logo.png) 6 | 7 | The image provides all required plugins to run a fully Docker enabled Jenkins 8 | with multiple docker based slaves and support for the Docker Pipeline plugin. 9 | 10 | ## The Docker Images 11 | 12 | There are three Docker images on Docker Hub, one is the Jenkins master and the 13 | other two to configure a Jenkins slave in different modes (JNLP vs. SSH). 14 | 15 | ### Jenkins Master [![Docker Stars](https://img.shields.io/docker/stars/foxylion/jenkins.svg?style=flat-square)](https://hub.docker.com/r/foxylion/jenkins/) [![Docker Pulls](https://img.shields.io/docker/pulls/foxylion/jenkins.svg?style=flat-square)](https://hub.docker.com/r/foxylion/jenkins/) 16 | 17 | ***The latest image can be found on [Docker Hub](https://hub.docker.com/r/foxylion/jenkins/).*** 18 | 19 | The Jenkins master image provides a preconfigured version of Jenkins 2 with all 20 | required plugins to run Docker based builds in a Pipeline. It also brings the new 21 | Blueocean pipeline view. 22 | 23 | A Jenkins master should expose the HTTP port and the slave communication port. 24 | 25 | ```bash 26 | docker run -d --name jenkins -p 80:8080 -p 50000:50000 \ 27 | -v /var/lib/jenkins:/var/jenkins_home \ 28 | foxylion/jenkins 29 | ``` 30 | 31 | - This will start a new Jenkins master 32 | - It will listen on Port 80 for any HTTP requests 33 | - Authentication is only possible using credentials (default: admin/admin) 34 | - Changing is password is only possible by using the `JENKINS_PASS` environment variable 35 | - All configuration will be saved into `/var/lib/jenkins` 36 | 37 | Removing the `-v` will prevent the Docker container from writing anything to 38 | the host file system but may result in data loss when the container is removed. 39 | 40 | ### Jenkins SSH Slave [![Docker Stars](https://img.shields.io/docker/stars/foxylion/jenkins-ssh-slave.svg?style=flat-square)](https://hub.docker.com/r/foxylion/jenkins-ssh-slave/) [![Docker Pulls](https://img.shields.io/docker/pulls/foxylion/jenkins-ssh-slave.svg?style=flat-square)](https://hub.docker.com/r/foxylion/jenkins-ssh-slave/) 41 | 42 | ***The latest image can be found on [Docker Hub](https://hub.docker.com/r/foxylion/jenkins-ssh-slave/).*** 43 | 44 | The Jenkins JNLP slave image is a lightweight solution to run a Jenkins slave with 45 | zero dependencies on any Docker enabled server. 46 | The idea behind this image is to run a container on your docker host which is 47 | exposing a ssh server where the Jenkins master is able to connect to. 48 | The image is configurable so that you can provide a SSH key which should be 49 | trusted. It is also possible to rely on password authentication. 50 | 51 | ``` 52 | docker run -d --name jenkins-slave --restart=unless-stopped \ 53 | -p 2222:22 \ 54 | -v /home/jenkins:/home/jenkins \ 55 | -v /var/run/docker.sock:/var/run/docker.sock \ 56 | -e SSH_KEY="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6CPOQDrq...faMvvidd+RVSfDBgJE1g3 jenkins@jenkins.company.tld" \ 57 | foxylion/jenkins-ssh-slave 58 | ``` 59 | 60 | Now it is possible to configure a new node on your Jenkins master. Note that you 61 | must configure some things for the new ssh slave node. 62 | 63 | - Use a custom port (in this example port 2222). You can configure this 64 | in the "Advanced..." options on the node configuration page. 65 | - The user Jenkins must use to authenticate against the slave is `root`. 66 | - The working directory is `/home/jenkins`. 67 | - You must select the "Manual trusted key Verification Strategy" and check 68 | "Require manual verification of initial connection". Otherwise you wouldn't be 69 | able to connect the master to the slave. 70 | - You can compare the provided fingerprint to the fingerprint of your slave. 71 | (Get it using `docker logs jenkins-slave`). 72 | 73 | There are some environment variables to customize the slave behavior. 74 | 75 | | ENV var | Description | Default | 76 | | ------- | ----------- | ------- | 77 | | `SSH_PASSWORD` | This is used to configure password authentication. | `jenkins` | 78 | | `SSH_KEY` | If this option is configured only authentication with this key is possible. | `-` | 79 | 80 | ### Jenkins JNLP Slave [![Docker Stars](https://img.shields.io/docker/stars/foxylion/jenkins-slave.svg?style=flat-square)](https://hub.docker.com/r/foxylion/jenkins-slave/) [![Docker Pulls](https://img.shields.io/docker/pulls/foxylion/jenkins-slave.svg?style=flat-square)](https://hub.docker.com/r/foxylion/jenkins-slave/) 81 | 82 | ***The latest image can be found on [Docker Hub](https://hub.docker.com/r/foxylion/jenkins-slave/).*** 83 | 84 | The Jenkins JNLP slave image provides a configurable version of the Jenkins slave. It 85 | supports authentication using credentials or the JNLP slave secret. It is also 86 | possible to create a slave nodes automatically when the slave container is 87 | started, the slave node will then automatically removed when the container is 88 | stopped. 89 | 90 | ```bash 91 | docker run -d --name jenkins-slave --restart=unless-stopped \ 92 | -v /home/jenkins:/home/jenkins \ 93 | -v /var/run/docker.sock:/var/run/docker.sock \ 94 | -e JENKINS_URL=https://jenkins.mycompany.com \ 95 | foxylion/jenkins-slave 96 | ``` 97 | 98 | By default the slave will automatically create a temporary Jenkins node. The name 99 | will consist of the prefix `docker-slave` and the container hostname. 100 | 101 | **Note: Using a JNLP slave does not provide any encryption when communicating 102 | with the master. In an untrusted network this is not recommended. Use instead 103 | the ssh slave image.** 104 | 105 | There are some environment variables to customize the slave behavior. 106 | 107 | | ENV var | Description | Default | 108 | | ------- | ----------- | ------- | 109 | | `JENKINS_URL` | The URL where your Jenkins can be reached via HTTP. | `http://jenkins` | 110 | | `JENKINS_SLAVE_ADDRESS` | An alternative address used to connect to the Jenkins server when starting the TCP connection, it will override the address provided by the Jenkins master. | `-` | 111 | | `JENKINS_USER` | The user used for authentication against Jenkins master. | `admin` | 112 | | `JENKINS_PASS` | The password used for authentication against Jenkins master. | `admin` | 113 | | `SLAVE_NAME` | The name of the Jenkins node (must match a existing node). When left empty, the slave name will be generated. | `-` | 114 | | `SLAVE_SECRET` | Will use the provided JNLP secret instead of user/password authentication. | `-` | 115 | | `SLAVE_EXECUTORS` | Defines how many executors the slave should provide. | `1` | 116 | | `SLAVE_LABELS`| Defines which labels the slave should have. Separete them using a space. | `docker` | 117 | | `SLAVE_WORING_DIR`| Define a custom working directory when it is not possible to use `-w` at `docker run` command. | `-` | 118 | | `CLEAN_WORKING_DIR` | When set to `true` the slave will clean the working directory on startup. This can help to prevent failed builds due to stored configuration in the working directory. | `true` | 119 | 120 | #### Temporary Slaves 121 | 122 | The temporary slaves feature is enabled when leaving the `SLAVE_NAME` environment 123 | variable empty. The slave will automatically create a new Jenkins node with a 124 | generated slave name. After the shutdown of the slave the Jenkins node will be 125 | deleted. If this behavior is unwanted use a persistent slave. 126 | 127 | #### Persistent Slaves 128 | 129 | Running a slave without automatically creating a Jenkins node, but using JNLP slave authentication. 130 | 131 | *Note:* It's important to set the *Remote root directory* of your slave to `/home/jenkins`. 132 | 133 | ```bash 134 | docker run -d \ 135 | -v /home/jenkins:/home/jenkins \ 136 | -v /var/run/docker.sock:/var/run/docker.sock \ 137 | -e JENKINS_URL=http://jenkins.mycompany.com \ 138 | -e SLAVE_NAME=docker-slave-028 \ 139 | foxylion/jenkins-slave 140 | ``` 141 | 142 | #### Varying *Remote root directory* 143 | 144 | By default the Jenkins slave requires `/home/jenkins` to be mounted with the 145 | equivalent directory on the Docker host. 146 | 147 | **Note:** A different directory path on the host will result in failing builds. 148 | [Read more (chapter: "Running build steps inside containers")](https://go.cloudbees.com/docs/cloudbees-documentation/cje-user-guide/chapter-docker-workflow.html) 149 | 150 | If you need to use a different directory on your Docker host you can pass that 151 | information when starting the Docker container. 152 | 153 | ```bash 154 | docker run -d \ 155 | -w /tmp/jenkins-slave 156 | -v /tmp/jenkins-slave:/tmp/jenkins-slave \ 157 | -v /var/run/docker.sock:/var/run/docker.sock \ 158 | -e JENKINS_URL=http://jenkins.mycompany.com \ 159 | foxylion/jenkins-slave 160 | ``` 161 | 162 | ## Read More 163 | 164 | There are some useful links to get started using Jenkins pipelines in combination 165 | with docker. 166 | 167 | - [First step with Jenkins pipelines. Includes steps, stages, stash, docker](https://dzone.com/refcardz/continuous-delivery-with-jenkins-workflow) 168 | - [Overview on Jenkins pipeline, including links to documentation, etc.](https://wilsonmar.github.io/jenkins2-pipeline/) 169 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | --------------------------------------------------------------------------------