LoginSignup
6
5

More than 5 years have passed since last update.

Jenkinsでシェル内で加工した変数を下流のジョブに引き継ぐ方法

Posted at

概要

ユーザが入力したパラメータを少し加工したものを下流ジョブで使いたいと思い、色々試してみました。

解決策

Trigger parameterized build on other projectsのParameters from properties fileを使用する方法

プラグインの「Trigger parameterized build on other projects」にはパラメータの引き渡し方として「Parameters from properties file」という方法があります。

これは「キー=値」の形式で記載されたファイルを読み込み、ファイル内に記載されたパラメータを次のジョブに引き渡すというものです。

これを利用して、上流のジョブで
echo XXX=YYY > property.txt
のようにしてパラメータをプロパティファイルに出力して、
下流のジョブではそのファイルを読み込むという方法を取ればジョブ間で加工したパラメータの受け渡しができます。

6
5
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
6
5