参考链接:https://www.jenkins.io/doc/book/pipeline/syntax/#parameters https://plugins.jenkins.io/extended-choice-parameter/ https://github.com/jenkinsci/extended-choice-parameter-plugin
应该在“pipeline”级别定义它,并且整个流水线只允许一个指令。 字符串和布尔值是可以使用的有效参数类型。 pipeline { agent any parameters { string(name: 'user', defaultValue: 'John', description: 'A user that triggers the pipeline') } stages { stage('Trigger pipeline') { steps { echo "Pipeli...
parameters([ [$class:"ChoiceParameter", choiceType:"PT_SINGLE_SELECT", description:"Select the Env Name from the Dropdown List", filterLength:1, filterable: false, name:"Env", randomName:"choice-parameter-5631314439613978", script: [ $class:"GroovyScript", fallbackScript: [ classpath: [],...
(1)build步骤是由上游pipeline使用的,而upstream方式是由下游pipeline使用的。 (2)build步骤是可以带参数的,而upstream方式只是被动触发,并且没有带参数。 上游pipeline触发下游pipeline时,并没有自动带上自身的信息。所以,当下游pipeline需要使用上游pipeline的信息时,上游pipeline信息就要以参数的方式传给下游pipeline。 如...
properties([parameters([[$class:"ChoiceParameter",choiceType:"PT_SINGLE_SELECT",description:"非直连版本: novlc, 直连版本: vlc",filterLength:1,filterable:false,name:"CHASSIS_MODE",script:[$class:"GroovyScript",script:[classpath:[],sandbox:true,script:'''return["vlc","novlc"]''']]],[$...
Jenkins为您提供了两种开发Pipeline的方式:脚本式和声明式。 脚本式流水线(也称为“传统”流水线)基于Groovy作为其特定于域的语言。 而声明式流水线提供了简化且更友好的语法,并带有用于定义它们的特定语句,而无需学习Groovy。声明式流水线语法错误在脚本开始时报告。这是一个很好的功能,因为您不会浪费时间,直到某个...
安装插件“Extended Choice Parameter plugin”,它可以扩展参数化构建过程,直接在管理界面增加 创建任务时候使用参数构建 pipeline也可以添加参数化构建 构建任务选择传递参数 1.先点击Build with Parameters 2.然后点击立即构建 2.没有构建参数的任务就可以直接点击立即构建 ...
同样新建一个pipeline风格的任务,然后需要准备几个参数化构建过程的插件,包括:Active Choice Parameter,Choice parameter,Extended Choice Parameter等插件 设置选择分支 代码语言:javascript 复制 def gettags = ("git ls-remote -h git@coxxxxxxxxxxxxxxxxxxxxxxicheng00001/lorehouse-base-interface.git").execute() ge...
在声明式流水线语法中,流水线过程定义在 Pipeline{}中,Pipeline 块定义了整个流水线中完成的所有工作,比如 参数说明: agent any:在任何可用的代理上执行流水线或它的任何阶段,也就是执行流水线过程的位置,也可以指定到具体的节点 stage:定义流水线的执行过程(相当于一个阶段),比如下文所示的 Build、Test、Deploy,...
//Jenkinsfile (Scripted Pipeline) node { stage('Build') { echo 'Build' } stage('Test') { echo 'Test' } stage('Deploy') { echo 'Deploy' } } 二、声明式流水线 声明式流水线必须包含在一个 Pipeline 块中,比如是一个 Pipeline 块的格式 ...