0

例如,管道/jenkinsfile 语法应该如何被参数化触发器通过 curl 触发?

我的管道始于:

pipeline{  
    parameters {
        string(name: 'mycommitid', defaultValue: 'nocommit', description: 'my parameterized build')   
    }
    properties([
        parameters([
            string(defaultValue: 'nocommit', description: 'fas', name: 'mycommitid')
        ])
    ])
    node{...}
}

通过在代码中设置它,我的管道不会被触发,只有当我在 jenkins 的构建触发器部分手动设置它时。但目标是在多分支管道和 jenkinsfiles 中使用它。

我得到的输出是(这里的哈希是我输入的一些随机数作为示例):

git rev-parse 4364576456fgds467734ss344c^{commit} # timeout=10 
ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.

Finished: FAILURE 

提交通过后,您如何建议我应该只构建那个单一的修订版?

4

1 回答 1

0

在 groovy 管道脚本中定义参数时,应在作业配置中的 groovy 脚本之前定义它们。

在作业配置中创建参数后,您可以在 groovy 中使用语法访问它们${env.PARAM}

于 2017-04-04T18:55:33.330 回答