2016-04-30 1 views
2

私が設定され、ゲリット・トリガープラグインでジェンキンスとヘリットを統合し、ジェンキンスでポストビルドタスクの一部として、私は次のスクリプトを実行していています:ジェンキンスフェッチすることができませんでしchangeIdとリビジョンID

ここ
/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

しかし、IAMが次の出力取得:問題はジェンキンスためthis security patchによって引き起こされる

[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 
+0

、出力を参照してください。 ** changeId **と** revisionId **には値が必要です。 – CSchulz

答えて

2

を - それが適用されますバージョン1.651.2,2.3およびそれ以降。 ここにはlist of affected pluginsがあります。

基本的には、ビルド用に明示的に設定されていないパラメータをプラグインに挿入することを禁止しています。したがって、Jenkinsは$GERRIT_CHANGE_ID$GERRIT_PATCHSET_REVISIONについては知らないのです。 Gerrit Trigger Plugin creators' noticeによると

あなたはジェンキンス構成

-Dhudson.model.ParametersAction.keepUndefinedParameters=true

に次のJAVA_ARGを追加することができます回避策として

しかし、私はこのソリューションは、あまりにも侵襲見つけるには、私が思いつきました別の修正を加えて

  • GERRIT_CHANGE_ID

  • GERRIT_PATCHSET_REVISION

そして、それはそれだ:単にジョブ設定にこれらの文字列パラメータを追加します。今すぐあなたの設定は次のようになります。あなたはwrogn途中でスプートニクを使用している

Job parameters

関連する問題