> 文章列表 > 【Jenkins 2.x 实践指南】2.7 pipeline -- 章节小结

【Jenkins 2.x 实践指南】2.7 pipeline -- 章节小结

【Jenkins 2.x 实践指南】2.7 pipeline -- 章节小结

目录

一、 pipeline入门

1. pipeline 是什么

2. Jenkinsfile 又是什么

3. pipeline语法 的选择

4. 创建第一个pipeline - helloworld

Stage 1: 创建任务

Stage 2: 创建流水线 - Hello World

Stage 3: 编写 pipeline 声明

Stage 4: 执行 

Stage 5: 点击 #1 查看日志

5. 从版本控制库拉取pipeline

6. 使用Maven构建Java应用

7. 本章小结


一、 pipeline入门

1. pipeline 是什么

  • 部署流水线Deployment pipeline
  • 从软件版本控制库到用户手中这一过程的自动化表现形式
  • Jenkins 1.x 只能通过界面手动操作来“描述”部署流水线
  • Jenkins 2.x 支持pipeline as code,可以通过“代码”来描述部署流水线

2. Jenkinsfile 又是什么

  • 一个文本文件 (像Dockerfile之于Docker)
  • pipeline as code 的 表现形式
  • Jenkins默认是不支持Jenkinsfile。需安装pipeline插件

3. pipeline语法 的选择

  • 脚本式(Scripted)语法,pipeline 版本 < 2.5
  • 声明式(Declar-ative)语法更简单、更结构化(more opinionated)的语法(推荐)
  • pipeline 插件从2.5版本开始,才同时支持两种格式

4. 创建第一个pipeline - helloworld

Stage 1: 创建任务

Stage 2: 创建流水线 - Hello World

Stage 3: 编写 pipeline 声明

Stage 4: 执行 

Stage 5: 点击 #1 查看日志

5. 从版本控制库拉取pipeline

6. 使用Maven构建Java应用

7. 本章小结

场景:gitlab + jenkins ,书本讲解不是很详细,没有办法从gitlab 拉取,后续补上笔记