LoginSignup
31
32

More than 5 years have passed since last update.

【Jenkins】シェルの実行で定義した変数を下流ジョブに渡すパラメータに設定する(Parameterized Trigger plugin)

Last updated at Posted at 2014-07-23

背景

シェルの実行で定義した変数を下流ジョブに流すパラメータに設定したい。
が、変数はシェル実行が終わると消えてしまう。

パラメータの設定使用しているプラグインはParameterized Trigger plugin

結論

上記プラグインにファイルからパラメータを設定する機能を使う

  • Parameters from properties file

やったこと

  1. シェルの実行で、ワークスペースにファイルを書き出す。
    • 形式は、KEY=value
    • 一行につきパラメータ一つ
  2. ビルド後の処理に「Trigger parameterized build on other projects」を追加
    1. Add Parametersから「Parameters from properties file」を選択
    2. 「Use properties from file」に1で書き出したファイルを指定

他のパラメータとの食い合わせ

プラグインの設定を複数して、同じパラメータがあった場合にどうなるか?

  • Current build parameters設定の後に、Parameters from properties fileを設定した場合
  • Parameters from properties file設定の後に、Current build parametersを設定した場合

結論 : 最後に設定した値で上書きされる

31
32
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
31
32