首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >詹金斯无法获取changeId和revisionId

詹金斯无法获取changeId和revisionId
EN

Stack Overflow用户
提问于 2016-04-30 06:59:45
回答 1查看 969关注 0票数 2

我已经配置并集成了Jenkins和Gerrit与Gerrit触发器插件,并且作为Jenkins构建后任务的一部分,我正在执行以下脚本:

代码语言:javascript
复制
/opt/sputnik/bin/sputnik --conf /opt/sputnik/myconf.properties --changeId $GERRIT_CHANGE_ID --revisionId $GERRIT_PATCHSET_REVISION
echo "exit 0 workaround"

下面是人造卫星是什么:https://github.com/TouK/sputnik

但我的产出如下:

代码语言:javascript
复制
[PostBuildScript] - Execution post build scripts.
[PostBuildScript] - Resolving environment variables for the script content.
[PostBuildScript] - Evaluating the script: 
/var/lib/jenkins/sputnik/bin/sputnik --conf /var/lib/jenkins/sputnik/gerrit.properties --changeId $GERRIT_CHANGE_ID --revisionId $GERRIT_PATCHSET_REVISION
echo "exit 0 workaround"

[project1] $ /bin/sh -xe /tmp/hudson6990025050616459512.sh
+ /var/lib/jenkins/sputnik/bin/sputnik --conf /var/lib/jenkins/sputnik/gerrit.properties --changeId --revisionId
Sputnik version 1.7.0
Sputnik - review your Gerrit patchset with Checkstyle, PMD and FindBugs
usage: sputnik [--apiKey <apiKey>] [--buildId <buildId>] [--changeId <changeId>] --conf <conf> [--pullRequestId
   <pullRequestId>] [--revisionId <revisionId>]
--apiKey <apiKey>                 Optional API key for using Sputnik for Github
--buildId <buildId>               Optional build id for using Sputnik for Github
--changeId <changeId>             Gerrit change id
--conf <conf>                     Configuration properties file
--pullRequestId <pullRequestId>   Stash pull request id
--revisionId <revisionId>         Gerrit revision id
Missing argument for option: changeId
Build step 'Execute a set of scripts' changed build result to FAILURE
Build step 'Execute a set of scripts' marked build as failure
Finished: FAILURE
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-06-07 12:56:20

这个问题是由这个安全补丁 for Jenkins引起的--它适用于1.651.22.3和更高版本。这是一个受影响插件列表

基本上,它禁止插件注入未显式配置的构建参数,因此您的Jenkins不了解$GERRIT_CHANGE_ID$GERRIT_PATCHSET_REVISION

根据Gerrit触发器插件创建者通知

作为解决办法,您可以将以下JAVA_ARG添加到jenkins配置中 -Dhudson.model.ParametersAction.keepUndefinedParameters=true

然而,我发现这个解决方案太有侵略性,所以我想出了另一个解决方案。只需将这些字符串参数添加到作业配置:

  • GERRIT_CHANGE_ID
  • GERRIT_PATCHSET_REVISION

就是这样。现在您的配置应该如下所示:

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36951839

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档