本文整理匯總了Java中hudson.model.Run.getAction方法的典型用法代碼示例。如果您正苦於以下問題:Java Run.getAction方法的具體用法?Java Run.getAction怎麽用?Java Run.getAction使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類hudson.model.Run
的用法示例。
在下文中一共展示了Run.getAction方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getCauseEnvVars
import hudson.model.Run; //導入方法依賴的package包/類
/**
* Retrieves variables describing the Run cause.
* @param run Run
* @return Set of environment variables, which depends on the cause type.
*/
@Nonnull
public static Map<String, String> getCauseEnvVars(@Nonnull Run<?, ?> run) {
CauseAction causeAction = run.getAction(CauseAction.class);
Map<String, String> env = new HashMap<>();
List<String> directCauseNames = new ArrayList<>();
Set<String> rootCauseNames = new LinkedHashSet<>();
if (causeAction != null) {
List<Cause> buildCauses = causeAction.getCauses();
for (Cause cause : buildCauses) {
directCauseNames.add(CauseHelper.getTriggerName(cause));
CauseHelper.insertRootCauseNames(rootCauseNames, cause, 0);
}
} else {
directCauseNames.add("UNKNOWN");
rootCauseNames.add("UNKNOWN");
}
env.putAll(CauseHelper.buildCauseEnvironmentVariables(ENV_CAUSE, directCauseNames));
env.putAll(CauseHelper.buildCauseEnvironmentVariables(ENV_ROOT_CAUSE, rootCauseNames));
return env;
}
示例2: onStarted
import hudson.model.Run; //導入方法依賴的package包/類
@Override
public void onStarted(Run<?, ?> build, TaskListener listener) {
GitLabSCMHeadMetadataAction metadata = getMetadataAction(build);
GitLabSCMPublishAction publishAction = build.getParent().getAction(GitLabSCMPublishAction.class);
if (metadata != null && publishAction != null) {
GitLabSCMCauseAction cause = build.getAction(GitLabSCMCauseAction.class);
String description = (cause != null) ? cause.getDescription() : "";
publishAction.updateBuildDescription(build, description, listener);
publishAction.publishStarted(build, metadata, description);
}
}
示例3: getMetadataAction
import hudson.model.Run; //導入方法依賴的package包/類
private GitLabSCMHeadMetadataAction getMetadataAction(Run<?, ?> build) {
GitLabSCMHeadMetadataAction metadata = build.getAction(GitLabSCMHeadMetadataAction.class);
if (metadata == null) {
metadata = build.getParent().getAction(GitLabSCMHeadMetadataAction.class);
}
return metadata;
}