當前位置: 首頁>>代碼示例>>Java>>正文


Java Run.getAction方法代碼示例

本文整理匯總了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;
}
 
開發者ID:jenkinsci,項目名稱:envinject-api-plugin,代碼行數:27,代碼來源:EnvVarsResolver.java

示例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);
    }
}
 
開發者ID:Argelbargel,項目名稱:gitlab-branch-source-plugin,代碼行數:12,代碼來源:GitLabSCMRunListener.java

示例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;
}
 
開發者ID:Argelbargel,項目名稱:gitlab-branch-source-plugin,代碼行數:9,代碼來源:GitLabSCMRunListener.java


注:本文中的hudson.model.Run.getAction方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。