Jenkins

来自开放百科 - 灰狐
(版本间的差异)
跳转到: 导航, 搜索
(安装)
(用户)
 
(未显示1个用户的90个中间版本)
第2行: 第2行:
  
 
Jenkins CI 基于 [[Hudson]] 构建,MIT许可协议。
 
Jenkins CI 基于 [[Hudson]] 构建,MIT许可协议。
 +
 +
==简介==
 +
 +
==功能==
  
 
==安装==
 
==安装==
下载 [http://download.huihoo.com/jenkins/jenkins.war war] 文件,然后自执行,java -jar jenkins.war
 
  
Debian
+
===体验===
 +
快速体验Jenkins
 +
docker volume create --name=m2repo
 +
sudo chmod a+rw $(docker volume inspect -f '{{.Mountpoint}}' m2repo)
 +
docker run --rm -p 127.0.0.1:2222:2222 -p 127.0.0.1:8080:8080 -p 127.0.0.1:8081:8081 -p 127.0.0.1:9418:9418 -ti -v m2repo:/m2repo jenkinsci/workflow-demo
 +
http://localhost:8080/
 +
http://localhost:8080/blue
 +
 
 +
===流水线===
 +
Jenkins 长期使用嵌入式 [[Groovy]] 引擎来为管理员和用户提供高级脚本功能。另外, Jenkins 流水线的实现者发现 Groovy是构建现在成为脚本式流水线 DSL 的坚实基础。
 +
 
 +
声明式流水线、脚本式流水线是一种基于 [[Groovy]] 的[[Domain-specific language|领域特定语言(DSL)]],大多数 Groovy 语法都可以无需修改,直接在脚本式流水线中使用。
 +
*[https://www.jenkins.io/doc/book/pipeline/ Jenkins Pipeline]
 +
*[https://github.com/jenkinsci/JenkinsPipelineUnit Jenkins Pipeline Unit testing framework]
 +
*[https://marketplace.eclipse.org/content/jenkins-editor Eclipse Jenkins 编辑器]
 +
*[https://github.com/hoto/jenkinsfile-examples Jenkinsfiles Examples] [https://medium.com/@AndrzejRehmann/creating-a-jenkinsfile-pipeline-7aefc89b8c67 Creating a Jenkinsfile pipeline]
 +
 
 +
===macOS===
 +
下载macOS版本安装后,开关机会自动启动Jenkins。
 +
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
 +
 
 +
===War文件===
 +
下载 [https://www.jenkins.io/download/ war] 文件,然后运行,
 +
java -jar jenkins.war
 +
java -jar jenkins.war --httpPort=8081
 +
java -jar jenkins.war --httpPort=8081 --ajp13Port=8010
 +
java -jar jenkins.war --prefix=jenkins
 +
java -jar jenkins.war --controlPort=8001 // embedded Winstone application server
 +
 
 +
===Decker===
 +
docker pull jenkins/jenkins
 +
docker run -p 8080:8080 -p 50000:50000 jenkins/jenkins:lts
 +
http://0.0.0.0:8080/
 +
密码在容器的 /var/jenkins_home/secrets/initialAdminPassword如:1b14ff23c69248f6a3347ab66ede0259
 +
 
 +
===Debian===
 
  wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | apt-key add -
 
  wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | apt-key add -
 
  vim  /etc/apt/sources.list
 
  vim  /etc/apt/sources.list
第17行: 第55行:
 
和 chown -R jenkins:adm /var/lib/jenkins
 
和 chown -R jenkins:adm /var/lib/jenkins
  
Jetty
+
==Apache Server==
 +
LoadModule proxy_module modules/mod_proxy.so
 +
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
 +
 
 +
ProxyPass /jenkins http://localhost:8081/jenkins
 +
ProxyPassReverse /jenkins http://localhost:8081/jenkins
 +
ProxyRequests Off
 +
 
 +
===Jetty===
 
*https://wiki.jenkins-ci.org/display/JENKINS/Jetty
 
*https://wiki.jenkins-ci.org/display/JENKINS/Jetty
  
Nginx
+
===Nginx===
 
*[https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu Setting up an Nginx Proxy for port 80 -> 8080]
 
*[https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu Setting up an Nginx Proxy for port 80 -> 8080]
  
第28行: 第74行:
 
  java -jar jenkins-cli.jar -s http://localhost:8080/ help
 
  java -jar jenkins-cli.jar -s http://localhost:8080/ help
 
  java -jar jenkins-cli.jar -s http://localhost:8080/ version
 
  java -jar jenkins-cli.jar -s http://localhost:8080/ version
 +
 +
==iOS==
 +
*[https://wiki.jenkins-ci.org/display/JENKINS/Plugins#Plugins-iOSdevelopment Plugins for iOS development]
 +
 +
==Android==
 +
*[https://wiki.jenkins-ci.org/display/JENKINS/Plugins#Plugins-Androiddevelopment Plugins for Android development]
 +
*[http://vitorbaptista.com/continuous-integration-for-android-apps-with-jenkins-and-maven3/ Continuous Integration for Android Apps with Jenkins and Maven3]
 +
*[http://docs.huihoo.com/jenkins/conference/juc2011/jenkins-xml-api-and-mobile-devices.pdf Jenkins XML API and Mobile Devices]
 +
 +
==Jenkins DSL==
 +
*[https://github.com/sheehan/job-dsl-playground/ Jenkins Job DSL Playground]
 +
*[http://docs.huihoo.com/jenkins/conference/juc2014/unmasking-the-jenkins-dsl.pdf Unmasking the Jenkins DSL]
 +
*[http://docs.huihoo.com/jenkins/conference/juc2014/the-groovy-way-to-write-jenkins-plugin.pdf Jenkins user plugin: This time it's Groovy]
 +
*[http://docs.huihoo.com/jenkins/conference/juc2013/configuration-as-code-adoption-of-the-job-dsl-plugin-at-netflix.pdf Configuration as Code Adoption of the Job DSL Plugin at Netflix]
 +
*[http://docs.huihoo.com/jenkins/conference/juc2014/configuration-as-code-the-job-dsl-plugin.pdf Configuration as Code The Job DSL Plugin]
 +
 +
==Groovy==
 +
*[https://wilsonmar.github.io/jenkins2-pipeline/ Jenkins2 Pipeline jobs using Groovy code in Jenkinsfile]
 +
*[https://github.com/jenkinsci/jenkins-scripts jenkins-scripts] Scripts in [[Groovy]], shell, Ruby, Python, whatever for managing/interacting with Jenkins
 +
 +
==JavaScript==
 +
*[https://github.com/guard/guard-jasmine guard-jasmine]、[http://edspencer.net/2013/07/28/jasmine-and-jenkins-continuous-integration/ Jasmine and Jenkins Continuous Integration]
 +
 +
==PHP==
 +
*[https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+and+PHP Jenkins and PHP]
 +
*[http://jenkins-php.org/ Template for Jenkins jobs for PHP projects]
 +
*[https://wiki.jenkins-ci.org/display/JENKINS/Drupal+Development Drupal Development]
 +
 +
==Python==
 +
*[https://github.com/pycontribs/jenkinsapi jenkinsapi]
 +
 +
==Ruby==
 +
*[https://wiki.jenkins-ci.org/display/JENKINS/Plugins#Plugins-Rubydevelopment Plugins for Ruby development]
 +
*[http://docs.huihoo.com/jenkins/conference/juc2011/ruby-plugins-you-have-come-a-long-way-baby.pdf Ruby Plugins]
 +
*[http://docs.huihoo.com/jenkins/conference/juc2014/ruby-ci-with-github-jenkins-and-ec2-spot-instances.pdf Ruby CI with Github, Jenkins, and EC2 Spot Instances]
 +
*[http://docs.huihoo.com/jenkins/conference/juc2012/graduating-to-jenkins-ci-for-ruby-on-rails-teams.pdf Graduating To Jenkins CI For Ruby on Rails Teams]
 +
 +
==.NET==
 +
*[https://wiki.jenkins-ci.org/display/JENKINS/Plugins#Plugins-.NETdevelopment Plugins for .NET development]
 +
 +
==Plugins==
 +
*[https://wiki.jenkins-ci.org/display/JENKINS/Gravatar+plugin Gravatar Plugin]
 +
*[https://wiki.jenkins-ci.org/display/JENKINS/Github+Plugin GitHub Plugin]
 +
*[https://wiki.jenkins-ci.org/display/JENKINS/Debian+Package+Builder+Plugin Debian Package Builder Plugin]
 +
*[https://wiki.jenkins-ci.org/display/JENKINS/sbt+plugin sbt plugin]
 +
*[https://wiki.jenkins-ci.org/display/JENKINS/Redmine+Plugin Redmine Plugin]
 +
若将Debian近30000个软件包的构建可视化,是多么伟大的工程 :)
 +
 +
==GitHub==
 +
cd ~/.ssh
 +
ssh-keygen -t rsa -C "[email protected]"
 +
cp ~/.ssh/id_rsa* /var/lib/jenkins/.ssh/
 +
在gitHub里单击账户设置。点击SSH 公钥 ,点击添加另一个公钥。
 +
粘贴前面生成的id_rsa.pub 文件内容。
 +
 +
若验证成功,会显示类似信息:
 +
Hi openweb! You've successfully authenticated :)
 +
git config --global user.name "username"
 +
git config --global user.email "email"
 +
git config --list
 +
参考:
 +
*[http://blog.csdn.net/banxi1988/article/details/6555293 GitHub使用指南!(ubuntu)]
 +
*[https://confluence.atlassian.com/display/BITBUCKET/Set+up+SSH+for+Git Set up SSH for Git]
 +
 +
总是这个错误:stderr: Permission denied (publickey).
 +
windows下解决:在jenkins中,把git的设置由git.exe改成git.cmd即可?
 +
linux下:
 +
 +
==[[Gerrit]]==
 +
*[https://wiki.jenkins-ci.org/display/JENKINS/Gerrit+Trigger Gerrit Trigger]
 +
*[https://wiki.jenkins-ci.org/display/JENKINS/Gerrit+Plugin Gerrit Plugin]
 +
*[http://www.infoq.com/cn/articles/Gerrit-jenkins-hudson Git、Gerrit与Jenkins/Hudson CI服务器]
 +
 +
==[[Phabricator]]==
 +
*[http://www.dctrwatson.com/2013/01/jenkins-and-phabricator/ Jenkins and Phabricator sitting in a tree]
  
 
==PostgreSQL==
 
==PostgreSQL==
第38行: 第159行:
 
==Distributed Builds==
 
==Distributed Builds==
 
*[https://wiki.jenkins-ci.org/display/JENKINS/Distributed+builds Running Multiple Slaves on the Same Machine]
 
*[https://wiki.jenkins-ci.org/display/JENKINS/Distributed+builds Running Multiple Slaves on the Same Machine]
 +
*[https://wiki.jenkins-ci.org/display/JENKINS/Plugins#Plugins-Clustermanagementanddistributedbuild Cluster management and distributed build plugins]
  
==PHP==
+
==[[Puppet]]==
*[https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+and+PHP Jenkins and PHP]
+
*[https://github.com/jenkinsci/infra-puppet Puppet manifests for managing the Jenkins project infrastructure]
 +
*[https://github.com/jenkinsci/puppet-jenkins Puppet module for Jenkins]
 +
 
 +
==Docker==
 +
docker pull zaiste/jenkins
 +
docker run -d -p 49001:8080 -v $PWD/jenkins:/var/lib/jenkins -t zaiste/jenkins
 +
http://localhost:8080
 +
*[https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+with+Docker Installing Jenkins with Docker]
 +
*[http://continuousdev.com/2015/09/jenkins-master-and-docker-slaves/ Jenkins master and Docker slaves]
  
 
==问题==
 
==问题==
 +
*与[[GitHub]]的整合,总报这个错误:stderr: Permission denied (publickey).
 +
https://help.github.com/articles/error-permission-denied-publickey
  
 
==用户==
 
==用户==
 +
*[https://ci.jenkins-ci.org Jenkins]
 
*[https://builds.apache.org/ Apache public build and test server]
 
*[https://builds.apache.org/ Apache public build and test server]
 
*[http://ci.cloudfoundry.org/ CloudFoundry.org ]
 
*[http://ci.cloudfoundry.org/ CloudFoundry.org ]
 
*[https://jenkins.openstack.org OpenStack]
 
*[https://jenkins.openstack.org OpenStack]
 +
*[https://ci.swift.org/ Apple Swift]
 +
*[https://ci.libreoffice.org/ LibreOffice]
 +
*[http://docs.huihoo.com/jenkins/conference/juc2012/how-jenkins-builds-the-netflix-global-streaming-service.pdf How Jenkins Builds the Netflix Global Streaming Service]
 +
*[http://docs.huihoo.com/jenkins/conference/juc2011/continuous-integration-at-yahoo.pptx Yahoo!持续集成]、[http://docs.huihoo.com/jenkins/conference/juc2013/implementing-continuous-delivery-at-yahoo.pptx Yahoo!持续交付]
 +
*[http://docs.huihoo.com/jenkins/conference/juc2011/how-liferay-is-improving-quality-using-hundreds-of-jenkins-servers.pdf Liferay]
 +
*[https://ci.eclipse.org/ Eclipse]
 +
*[https://build.ros.org/ ROS Build]
 +
 +
==文档==
 +
*[http://docs.huihoo.com/redhat/summit/2015/12193_continuous-integration-continuous-delivery-via-containers.pdf Jenkins for continuous delivery of infrastructure via Docker]
 +
*[http://docs.huihoo.com/eclipse/eclipsecon/europe2015/Empower-DevOps-with-Hudson-Instance-Per-Project-HIPP.odp Empower DevOps with Hudson Instance Per Project (HIPP)]
 +
*[http://docs.huihoo.com/jenkins/conference/juc2014/jenkins-state-of-union.pdf Jenkins State of Union]
 +
*[http://docs.huihoo.com/javaone/2014/CON11237-Building-a-Continuous-Delivery-Pipeline-with-Gradle-and-Jenkins.pdf Building a Continuous Delivery Pipeline with Gradle and Jenkins]
 +
*[http://docs.huihoo.com/jenkins/conference/juc2014/lightweight-paas-for-jenkins-ci-environments-with-docker.pdf Lightweight PaaS for Jenkins CI Environments with Docker]
 +
*[http://docs.huihoo.com/jenkins/conference/juc2014/multi-stage-ci-with-jenkins-in-an-embedded-world.pdf Multi-Stage-CI System with Jenkins in an Embedded World]
 +
*[http://docs.huihoo.com/jenkins/conference/juc2014/building-testing-deploying-android-apps-with-jenkins.pdf Building, Testing & Deploying Android Apps with Jenkins]
 +
*[http://docs.huihoo.com/jenkins/conference/juc2014/ruby-ci-with-github-jenkins-and-ec2-spot-instances.pdf Ruby CI with Github, Jenkins, and EC2 Spot Instances]
 +
*[http://docs.huihoo.com/jenkins/conference/juc2014/jenkins-gitlab-rabbitmq-symfony2-rhing.pdf Jenkins + Gitlab + RabbitMQ + Symfony2 + Phing]
 +
 +
[http://docs.huihoo.com/jenkins/conference 更多文档 >>>]
 +
 +
==图集==
 +
<gallery>
 +
image:jenkins-and-docker.jpg
 +
image:jinkins-on-openshift.png|OpenShift部署
 +
image:jenkins-on-dcos.png|Jenkins on DC/OS
 +
image:JDOS-2.0-container-engine-platform-02.png|京东容器平台JDOS
 +
image:realworld-pipeline-flow.png|Pipeline
 +
image:jenkins-blue-ocean-pipeline.png|Blue Ocean
 +
image:jenkins-pipeline-steps.png|Pipeline Steps
 +
</gallery>
  
 
==链接==
 
==链接==
第54行: 第218行:
 
*[http://www.cloudbees.com/ CloudBees]: Cloud Platform as a Service for Java Web Apps, Supported Jenkins/Hudson and Jenkins/Hudson in the Cloud
 
*[http://www.cloudbees.com/ CloudBees]: Cloud Platform as a Service for Java Web Apps, Supported Jenkins/Hudson and Jenkins/Hudson in the Cloud
 
*[http://www.ibm.com/developerworks/cn/java/j-lo-jenkins/index.html 基于 Jenkins 快速搭建持续集成环境]
 
*[http://www.ibm.com/developerworks/cn/java/j-lo-jenkins/index.html 基于 Jenkins 快速搭建持续集成环境]
 +
*[http://www.ibm.com/developerworks/cn/java/j-lo-jenkinsintegrate/index.html 使用 Jenkins 实现软件开发的持续集成]
 +
*[http://docs.huihoo.com/jenkins/enterprise/14/ Jenkins Enterprise by CloudBees]
  
 
[[category:continuous integration]]
 
[[category:continuous integration]]
[[category:java]]
+
[[category:continuous delivery]]
 +
[[category:DevOps]]
 +
[[category:build automation]]
 
[[category:software testing]]
 
[[category:software testing]]
 +
[[category:java]]

2021年9月8日 (三) 15:50的最后版本

Wikipedia-35x35.png 您可以在Wikipedia上了解到此条目的英文信息 Jenkins Thanks, Wikipedia.

Jenkins CI 基于 Hudson 构建,MIT许可协议。

目录

[编辑] 简介

[编辑] 功能

[编辑] 安装

[编辑] 体验

快速体验Jenkins

docker volume create --name=m2repo
sudo chmod a+rw $(docker volume inspect -f '模板:.Mountpoint' m2repo)
docker run --rm -p 127.0.0.1:2222:2222 -p 127.0.0.1:8080:8080 -p 127.0.0.1:8081:8081 -p 127.0.0.1:9418:9418 -ti -v m2repo:/m2repo jenkinsci/workflow-demo
http://localhost:8080/
http://localhost:8080/blue

[编辑] 流水线

Jenkins 长期使用嵌入式 Groovy 引擎来为管理员和用户提供高级脚本功能。另外, Jenkins 流水线的实现者发现 Groovy是构建现在成为脚本式流水线 DSL 的坚实基础。

声明式流水线、脚本式流水线是一种基于 Groovy领域特定语言(DSL),大多数 Groovy 语法都可以无需修改,直接在脚本式流水线中使用。

[编辑] macOS

下载macOS版本安装后,开关机会自动启动Jenkins。

sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist

[编辑] War文件

下载 war 文件,然后运行,

java -jar jenkins.war
java -jar jenkins.war --httpPort=8081
java -jar jenkins.war --httpPort=8081 --ajp13Port=8010
java -jar jenkins.war --prefix=jenkins 
java -jar jenkins.war --controlPort=8001 // embedded Winstone application server

[编辑] Decker

docker pull jenkins/jenkins
docker run -p 8080:8080 -p 50000:50000 jenkins/jenkins:lts
http://0.0.0.0:8080/
密码在容器的 /var/jenkins_home/secrets/initialAdminPassword如:1b14ff23c69248f6a3347ab66ede0259

[编辑] Debian

wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | apt-key add -
vim  /etc/apt/sources.list
deb http://pkg.jenkins-ci.org/debian binary/
apt-get update
apt-get install jenkins
http://localhost:8080/

注意:你可能需要修改Java,vim /etc/default/jenkins

JAVA=/home/huihoo/jdk1.7.0_21/bin/java

和 chown -R jenkins:adm /var/lib/jenkins

[编辑] Apache Server

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
ProxyPass /jenkins http://localhost:8081/jenkins 
ProxyPassReverse /jenkins http://localhost:8081/jenkins 
ProxyRequests Off 

[编辑] Jetty

[编辑] Nginx

[编辑] 使用

Jenkins 命令行

wget http://localhost:8080/jnlpJars/jenkins-cli.jar
java -jar jenkins-cli.jar -s http://localhost:8080/ help
java -jar jenkins-cli.jar -s http://localhost:8080/ version

[编辑] iOS

[编辑] Android

[编辑] Jenkins DSL

[编辑] Groovy

[编辑] JavaScript

[编辑] PHP

[编辑] Python

[编辑] Ruby

[编辑] .NET

[编辑] Plugins

若将Debian近30000个软件包的构建可视化,是多么伟大的工程 :)

[编辑] GitHub

cd ~/.ssh
ssh-keygen -t rsa -C "[email protected]"
cp ~/.ssh/id_rsa* /var/lib/jenkins/.ssh/
在gitHub里单击账户设置。点击SSH 公钥 ,点击添加另一个公钥。
粘贴前面生成的id_rsa.pub 文件内容。
ssh [email protected]
若验证成功,会显示类似信息:
Hi openweb! You've successfully authenticated :)
git config --global user.name "username"
git config --global user.email "email"
git config --list

参考:

总是这个错误:stderr: Permission denied (publickey).

windows下解决:在jenkins中,把git的设置由git.exe改成git.cmd即可?
linux下:

[编辑] Gerrit

[编辑] Phabricator

[编辑] PostgreSQL

使用PostgreSQL作为Jenkins的后端数据库。

[编辑] MongoDB

[编辑] Distributed Builds

[编辑] Puppet

[编辑] Docker

docker pull zaiste/jenkins
docker run -d -p 49001:8080 -v $PWD/jenkins:/var/lib/jenkins -t zaiste/jenkins
http://localhost:8080

[编辑] 问题

  • GitHub的整合,总报这个错误:stderr: Permission denied (publickey).

https://help.github.com/articles/error-permission-denied-publickey

[编辑] 用户

[编辑] 文档

更多文档 >>>

[编辑] 图集

[编辑] 链接

分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱