Jenkins 从入门到实践

2018-03-08  本文已影响131人  08e91ec82bed

最近在公司做的 Jenkins 入门介绍

Jenkins 从入门到实践


持续集成/持续交付/持续部署

image

Note:
持续集成是是一种软件开发实践,指开发阶段对项目进行持续性自动化编译、测试,以达到控制代码质量的手段。
持续集成的优点:


Jenkins

<iframe width="560" height="315" src="https://www.youtube.com/embed/VeoLZq2E2JQ?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>

Note:
Jenkins 是一个可扩展的 CI 引擎。原名 Hudson
是 Java 编写的本地开源软件
是安装配置和使用最简单的 CI 产品之一


安装部署


安装

Note:
默认情况下,Windows 上使用 system 用户运行(可在系统服务管理中修改),
Linux 上使用 jenkins 用户运行(可通过配置文件修改)
Linux 下需要预先安装 JRE 或 JDK


目录结构

JENKINS_HOME
 +- config.xml     (jenkins root configuration)
 +- *.xml          (other site-wide configuration files)
 +- userContent    (files in this directory will be served under your http://server/userContent/)
 +- fingerprints   (stores fingerprint records)
 +- plugins        (stores plugins)
 +- workspace (working directory for the version control system)
     +- [JOBNAME] (sub directory for each job)
 +- jobs
     +- [JOBNAME]      (sub directory for each job)
         +- config.xml     (job configuration file)
         +- latest         (symbolic link to the last successful build)
         +- builds
             +- [BUILD_ID]     (for each build)
                 +- build.xml      (build result summary)
                 +- log            (log file)
                 +- changelog.xml  (change log)

Note:
备份与迁移: Just copy $JENKINS_HOME


基本操作


首页一览

Note:
AJAX 即时反馈


系统管理

Note:
捋一遍 Manage Jenkins 界面上的选项


Freestyle 任务


Pipeline 任务

Jenkins 2.0 的核心特性,为了更好地实现 CD

Note:
Pipeline 就是流水线


Pipeline as Code

Note:
举个🌰
带你玩转 Pipeline


Multibranch Pipeline

Note:
Git Plugin 3.6 之后支持按 tag 构建


Jenkinsfile

Note:
可在系统配置里设置环境变量


小技巧


Blue Ocean

为 Pipeline 设计的全新界面,易上手,更清晰


The End

构建流程是开发的,也是运维的,但是归根结底是开发的

Note:
DevOps 上还是有很长的路要走

上一篇 下一篇

猜你喜欢

热点阅读