いくつかのトークンを使用して電子メールの件名をカスタマイズできることは知っていますが、もう少し動的なものを探しています。環境変数を設定するか、ビルド スクリプトのどこかにあるファイルに書き込み、メールの件名をフォーマットするときに email-ext を使用できるようにしたいと考えていました。
これを可能にする可能性のあるものはありますか?
助けてくれてありがとう
送信前の Groovy スクリプトを使用してメールの件名を変更することもできます。
たとえば、次のスクリプトは特定の条件をチェックし、件名行の先頭にテキストを追加します。
boolean isClaimed = false;
build.actions.each { action ->
if(action.class.name == "hudson.plugins.claim.ClaimBuildAction"
&& action.isClaimed()) {
isClaimed = true;
hudson.model.User user = hudson.model.User.get(action.getClaimedBy());
logger.println("[addClaimerOrCulprits.groovy] Build is claimed by " + user);
logger.println("[addClaimerOrCulprits.groovy] Sending email to claimer");
address = user.getProperty(hudson.tasks.Mailer.UserProperty).getAddress() ;
msg.addRecipients(javax.mail.Message.RecipientType.TO, address );
msg.setSubject("Attn " + action.getClaimedBy() + ": " + msg.getSubject());
}
}