Jenkins Pipeline 参数详解
Pipeline 是什么 Jenkins Pipeline 实际上是基于 Groovy 实现的 CI/CD 领域特定语言(DSL),主要分为两类,一类叫做 Declarative Pipeline ,一类叫做 Scripted Pipeline 。 Declarative Pipeline 体验上更接近于我们熟知的 travis CI 的 travis.yml ,通过声明自己要做的事情来规范流程,形如: pipeline { agent any stages { stage( ' Build ' ) { steps { // } } stage( ' Test ' ) { steps { // } } stage( ' Deploy ' ) { steps { // } } } } 而 Scripted Pipeline 则是旧版本中 Jenkins 支持的 Pipeline 模式,主要是写一些 groovy 的代码来制定流程: node { stage( ' Build ' ) { // } stage( ' Test ' ) { // } stage( ' Deploy ' ) { // } } 一般情况下声明式的流水线已经可以满足我们的需要,只有在复杂的情况下才会需要脚本式流水线的参与。 过去大家经常在 Jenkins 的界面上直接写脚本来实现自动化