私はそれを稼働させることができました。
Fist私はEnvironmentContributingActionインターフェイスを実装するActionクラスを定義しました。
public class RunInCloudEnvInject implements EnvironmentContributingAction {
private String key;
private String value;
public RunInCloudEnvInject(String key, String value) {
this.key = key;
this.value = value;
}
@Override public void buildEnvVars(AbstractBuild<?, ?> abstractBuild, EnvVars envVars) {
if (envVars != null && key != null && value != null) {
envVars.put(key, value);
}
}
@Override public String getIconFileName() {
return null;
}
@Override public String getDisplayName() {
return "RunInCloudBuilderEnvInjectionAction";
}
@Override public String getUrlName() {
return null;
}
}
その後、抽象ビルダを実装するクラスの@Override perform()メソッド内でこのスニペットを変更しました。ジェンキンスは、例えばスラック通知に結果のURLを投稿する構築の内側
String cloudLink = String.format("%s/#service/testrun/%s/%s", cloudLinkPrefix, testRun.getProjectId(),
testRun.getId());
build.getActions().add(new CloudLink(build, cloudLink));
RunInCloudEnvInject variable = new RunInCloudEnvInject("CLOUD_LINK", cloudLink);
build.addAction(variable);
は今、私は私のCLOUD_LINK環境変数を使用することができます。
ここにプルリクエストですhttps://github.com/jenkinsci/testdroid-run-in-cloud-plugin/pull/4