当前位置: 首页>>代码示例>>Java>>正文


Java Run类代码示例

本文整理汇总了Java中hudson.model.Run的典型用法代码示例。如果您正苦于以下问题:Java Run类的具体用法?Java Run怎么用?Java Run使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Run类属于hudson.model包,在下文中一共展示了Run类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getLastRed

import hudson.model.Run; //导入依赖的package包/类
private RedInterval getLastRed(Job job, Run lastUnsuccessfulBuild) {
    Run repair = lastUnsuccessfulBuild.getNextBuild();
    Run initialFailure;
    Run previousSuccessfulBuild = lastUnsuccessfulBuild.getPreviousSuccessfulBuild();
    if (previousSuccessfulBuild == null) {
        // never succeeded, get the first build
        initialFailure = lastUnsuccessfulBuild;
        while (initialFailure.getPreviousBuild() != null) {
            initialFailure = initialFailure.getPreviousBuild();
        }
    } else {
        initialFailure = previousSuccessfulBuild.getNextBuild();
    }

    return new RedInterval(job, repair, initialFailure);
}
 
开发者ID:oliveiragabriel07,项目名称:redtime,代码行数:17,代码来源:RedtimeReportPortlet.java

示例2: setup

import hudson.model.Run; //导入依赖的package包/类
@Before
public void setup() throws IOException, InterruptedException {

  // Prepare site.
  when(envVarsMock.get("JIRA_SITE")).thenReturn("LOCAL");
  when(envVarsMock.get("BUILD_URL")).thenReturn("http://localhost:8080/jira-testing/job/01");

  PowerMockito.mockStatic(Site.class);
  Mockito.when(Site.get(any())).thenReturn(siteMock);
  when(siteMock.getService()).thenReturn(jiraServiceMock);

  when(runMock.getCauses()).thenReturn(null);
  when(taskListenerMock.getLogger()).thenReturn(printStreamMock);
  doNothing().when(printStreamMock).println();

  final ResponseDataBuilder<Object> builder = ResponseData.builder();
  when(jiraServiceMock.getProjects())
      .thenReturn(builder.successful(true).code(200).message("Success").build());

  when(contextMock.get(Run.class)).thenReturn(runMock);
  when(contextMock.get(TaskListener.class)).thenReturn(taskListenerMock);
  when(contextMock.get(EnvVars.class)).thenReturn(envVarsMock);
}
 
开发者ID:jenkinsci,项目名称:jira-steps-plugin,代码行数:24,代码来源:GetProjectsStepTest.java

示例3: PullRequestGroovyObject

import hudson.model.Run; //导入依赖的package包/类
public PullRequestGroovyObject(@Nonnull final CpsScript script) throws Exception {
    this.script = script;
    Run<?, ?> build = script.$build();
    if (build == null) {
        throw new IllegalStateException("No associated build");
    }
    Job job = build.getParent();

    this.pullRequestHead = GitHubHelper.getPullRequest(job);

    this.base = GitHubHelper.getRepositoryId(job);
    this.head = RepositoryId.create(pullRequestHead.getSourceOwner(), pullRequestHead.getSourceRepo());

    this.gitHubClient = GitHubHelper.getGitHubClient(job);
    this.pullRequestService = new ExtendedPullRequestService(gitHubClient);
    this.issueService = new ExtendedIssueService(gitHubClient);
    this.commitService = new ExtendedCommitService(gitHubClient);
    this.pullRequest = pullRequestService.getPullRequest(base, pullRequestHead.getNumber());
}
 
开发者ID:aaronjwhiteside,项目名称:pipeline-github,代码行数:20,代码来源:PullRequestGroovyObject.java

示例4: setup

import hudson.model.Run; //导入依赖的package包/类
@Before
public void setup() throws IOException, InterruptedException {

  // Prepare site.
  when(envVarsMock.get("JIRA_SITE")).thenReturn("LOCAL");
  when(envVarsMock.get("BUILD_URL")).thenReturn("http://localhost:8080/jira-testing/job/01");

  PowerMockito.mockStatic(Site.class);
  Mockito.when(Site.get(any())).thenReturn(siteMock);
  when(siteMock.getService()).thenReturn(jiraServiceMock);

  when(runMock.getCauses()).thenReturn(null);
  when(taskListenerMock.getLogger()).thenReturn(printStreamMock);
  doNothing().when(printStreamMock).println();

  final ResponseDataBuilder<Object> builder = ResponseData.builder();
  when(jiraServiceMock.getIssueWatches(anyString()))
      .thenReturn(builder.successful(true).code(200).message("Success").build());

  when(contextMock.get(Run.class)).thenReturn(runMock);
  when(contextMock.get(TaskListener.class)).thenReturn(taskListenerMock);
  when(contextMock.get(EnvVars.class)).thenReturn(envVarsMock);
}
 
开发者ID:jenkinsci,项目名称:jira-steps-plugin,代码行数:24,代码来源:GetIssueWatchesStepTest.java

示例5: perform

import hudson.model.Run; //导入依赖的package包/类
@Override
public void perform(Run<?, ?> build, FilePath workspace, Launcher launcher, TaskListener listener) {
    /*
    // This also shows how you can consult the global configuration of the builder
    if (getDescriptor().getUseFrench()) {
        listener.getLogger().println("Bonjour, " + oFile + "!");
    } else {
        listener.getLogger().println("Hello, " + oFile + "!");
    }
     */

    listener.getLogger().println("[Cppchecker] " + "Starting the cppcheck.");
    try {
        ArgumentListBuilder args = getArgs();
        OutputStream out = listener.getLogger();
        FilePath of = new hudson.FilePath(workspace.getChannel(), workspace + "/" + this.oFile.trim());

        launcher.launch().cmds(args).stderr(of.write()).stdout(out).pwd(workspace).join();
    } catch (IOException | InterruptedException ex) {
        Logger.getLogger(Cppchecker.class.getName()).log(Level.SEVERE, null, ex);
    }

    listener.getLogger().println("[Cppchecker] " + "Ending the cppcheck.");
}
 
开发者ID:TommyLin,项目名称:cppchecker,代码行数:25,代码来源:Cppchecker.java

示例6: setUp

import hudson.model.Run; //导入依赖的package包/类
@Override
public void setUp(Context context, Run<?, ?> build,
                  FilePath workspace,
                  Launcher launcher,
                  TaskListener listener,
                  EnvVars initialEnvironment) throws IOException, InterruptedException {
    KubeConfigWriter kubeConfigWriter = KubeConfigWriterFactory.get(
            this.serverUrl,
            this.credentialsId,
            this.caCertificate,
            workspace,
            launcher,
            build);

    // Write the kubeconfig file
    String configFile = kubeConfigWriter.writeKubeConfig();

    // Remove it when the build is finished
    context.setDisposer(new CleanupDisposer(configFile));

    // Set environment for the kubectl calls to find the configuration
    context.env(KubeConfigWriter.ENV_VARIABLE_NAME, configFile);
}
 
开发者ID:maxlaverse,项目名称:kubernetes-cli-plugin,代码行数:24,代码来源:KubectlBuildWrapper.java

示例7: getCredentials

import hudson.model.Run; //导入依赖的package包/类
/**
 * Get the {@link StandardCredentials}.
 *
 * @return the credentials matching the {@link #credentialsId} or {@code null} is {@code #credentialsId} is blank
 * @throws AbortException if no {@link StandardCredentials} matching {@link #credentialsId} is found
 */
private StandardCredentials getCredentials(Run<?, ?> build) throws AbortException {
    if (StringUtils.isBlank(credentialsId)) {
        return null;
    }
    StandardCredentials result = CredentialsProvider.findCredentialById(
            credentialsId,
            StandardCredentials.class,
            build,
            Collections.<DomainRequirement>emptyList());

    if (result == null) {
        throw new AbortException("No credentials found for id \"" + credentialsId + "\"");
    }
    return result;
}
 
开发者ID:maxlaverse,项目名称:kubernetes-cli-plugin,代码行数:22,代码来源:KubeConfigWriter.java

示例8: getVirtEnvName

import hudson.model.Run; //导入依赖的package包/类
/**
 * Private method to get the name of the virtual environment
 * given in virtualenv tag of warhorn config file
 *
 * @param build Build
 * @param workspace Jenkins job workspace
 * @param listener Task listener
 * @return virtEnvName Name of the Virtual Environment
 * @throws ParserConfigurationException ParserConfigurationException
 * @throws SAXException SAXException
 * @throws IOException IOException
 */
private String getVirtEnvName(Run<?,?> build, FilePath workspace, TaskListener listener)
        throws ParserConfigurationException, SAXException, IOException{

    String absWarhornConfig = "";
    if (configType.equals("configGit")){
        absWarhornConfig = workspace.getRemote() + "/configRepo/" + gitConfigFile;
    } else {
        absWarhornConfig = workspace.getRemote() + "/warhorn_config.xml";
    }
    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
    DocumentBuilder db = dbf.newDocumentBuilder();
    Document document = db.parse(new File(absWarhornConfig));
    NodeList veNodeList = document.getElementsByTagName("virtualenv");

    String virtEnvName = "";
    if(veNodeList.getLength() > 0){
        Element element = (Element) veNodeList.item(0);
        virtEnvName = element.getAttribute("name");
    }

    return virtEnvName;
}
 
开发者ID:warriorframework,项目名称:warrior-jenkins-plugin,代码行数:35,代码来源:WarriorPluginBuilder.java

示例9: setup

import hudson.model.Run; //导入依赖的package包/类
@Before
public void setup() throws IOException, InterruptedException {

  // Prepare site.
  when(envVarsMock.get("JIRA_SITE")).thenReturn("LOCAL");
  when(envVarsMock.get("BUILD_URL")).thenReturn("http://localhost:8080/jira-testing/job/01");

  PowerMockito.mockStatic(Site.class);
  Mockito.when(Site.get(any())).thenReturn(siteMock);
  when(siteMock.getService()).thenReturn(jiraServiceMock);

  when(runMock.getCauses()).thenReturn(null);
  when(taskListenerMock.getLogger()).thenReturn(printStreamMock);
  doNothing().when(printStreamMock).println();

  final ResponseDataBuilder<Object> builder = ResponseData.builder();
  when(jiraServiceMock.getIssue(anyString()))
      .thenReturn(builder.successful(true).code(200).message("Success").build());
  when(contextMock.get(Run.class)).thenReturn(runMock);
  when(contextMock.get(TaskListener.class)).thenReturn(taskListenerMock);
  when(contextMock.get(EnvVars.class)).thenReturn(envVarsMock);
}
 
开发者ID:jenkinsci,项目名称:jira-steps-plugin,代码行数:23,代码来源:GetIssueStepTest.java

示例10: parseExportedVariables

import hudson.model.Run; //导入依赖的package包/类
public void parseExportedVariables(PrintStream logger, Run<?, ?> build, String output) throws IOException {

        if (exportVariablesString == null) {
            return;
        }
        if (exportVariablesString.trim().equals("")) {
            return;
        }
        logger.println("Transforming to environment variables: " + exportVariablesString);
        HashMap<String, String> exportVariablesNames = com.azure.azurecli.helpers.Utils.parseExportedVariables(exportVariablesString);
        HashMap<String, String> exportVariables = new HashMap<>();

        ObjectMapper mapper = new ObjectMapper();
        mapper.setSerializationInclusion(JsonInclude.Include.ALWAYS);

        JsonNode rootNode = mapper.readTree(output);
        for (Map.Entry<String, String> var
                :
                exportVariablesNames.entrySet()) {

            String value = rootNode.at(var.getKey()).asText();
            exportVariables.put(var.getValue(), value);
        }
        com.azure.azurecli.helpers.Utils.setEnvironmentVariables(build, exportVariables);
    }
 
开发者ID:jenkinsci,项目名称:azure-cli-plugin,代码行数:26,代码来源:Command.java

示例11: setup

import hudson.model.Run; //导入依赖的package包/类
@Before
public void setup() throws IOException, InterruptedException {

  // Prepare site.
  when(envVarsMock.get("JIRA_SITE")).thenReturn("LOCAL");
  when(envVarsMock.get("BUILD_URL")).thenReturn("http://localhost:8080/jira-testing/job/01");

  PowerMockito.mockStatic(Site.class);
  Mockito.when(Site.get(any())).thenReturn(siteMock);
  when(siteMock.getService()).thenReturn(jiraServiceMock);

  when(runMock.getCauses()).thenReturn(null);
  when(taskListenerMock.getLogger()).thenReturn(printStreamMock);
  doNothing().when(printStreamMock).println();

  final ResponseDataBuilder<Object> builder = ResponseData.builder();
  when(jiraServiceMock.getFields())
      .thenReturn(builder.successful(true).code(200).message("Success").build());

  when(contextMock.get(Run.class)).thenReturn(runMock);
  when(contextMock.get(TaskListener.class)).thenReturn(taskListenerMock);
  when(contextMock.get(EnvVars.class)).thenReturn(envVarsMock);
}
 
开发者ID:jenkinsci,项目名称:jira-steps-plugin,代码行数:24,代码来源:GetFieldsStepTest.java

示例12: onFailure

import hudson.model.Run; //导入依赖的package包/类
@Override public void onFailure(StepContext context, Throwable t) {
    try {
        TaskListener listener = context.get(TaskListener.class);
        Result r = Result.FAILURE;
        if (t instanceof AbortException) {
            listener.error(t.getMessage());
        } else if (t instanceof FlowInterruptedException) {
            FlowInterruptedException fie = (FlowInterruptedException) t;
            fie.handle(context.get(Run.class), listener);
            r = fie.getResult();
        } else {
            listener.getLogger().println(Functions.printThrowable(t).trim()); // TODO 2.43+ use Functions.printStackTrace
        }
        context.get(Run.class).setResult(r);
        context.onSuccess(null);
    } catch (Exception x) {
        context.onFailure(x);
    }
}
 
开发者ID:10000TB,项目名称:Jenkins-Plugin-Examples,代码行数:20,代码来源:CatchErrorStep.java

示例13: setup

import hudson.model.Run; //导入依赖的package包/类
@Before
public void setup() throws IOException, InterruptedException {
  when(runMock.getCauses()).thenReturn(null);
  when(taskListenerMock.getLogger()).thenReturn(printStreamMock);
  doNothing().when(printStreamMock).println();

  final ResponseDataBuilder<Void> builder = ResponseData.builder();
  when(hubotServiceMock.sendMessage(anyString(), anyString()))
      .thenReturn(builder.successful(true).code(200).message("Success").build());

  when(envVarsMock.get("HUBOT_URL")).thenReturn("http://localhost:9090/");
  when(envVarsMock.get("BUILD_URL")).thenReturn("http://localhost:9090/hubot-testing/job/01");

  when(contextMock.get(Run.class)).thenReturn(runMock);
  when(contextMock.get(TaskListener.class)).thenReturn(taskListenerMock);
  when(contextMock.get(EnvVars.class)).thenReturn(envVarsMock);

}
 
开发者ID:jenkinsci,项目名称:hubot-steps-plugin,代码行数:19,代码来源:ApproveStepTest.java

示例14: decorateRevisionToBuild

import hudson.model.Run; //导入依赖的package包/类
@Override
public Revision decorateRevisionToBuild(GitSCM scm, Run<?, ?> build, GitClient git, TaskListener listener, Revision marked, Revision rev) throws IOException, InterruptedException, GitException {
    listener.getLogger().println("Merging " + targetBranch.getName() + " commit " + targetBranch.getRevision().getHash() + " into merge-request head commit " + rev.getSha1String());
    checkout(scm, build, git, listener, rev);
    try {
        git.setAuthor("Jenkins", /* could parse out of JenkinsLocationConfiguration.get().getAdminAddress() but seems overkill */"[email protected]");
        git.setCommitter("Jenkins", "[email protected]");
        MergeCommand cmd = git.merge().setRevisionToMerge(ObjectId.fromString(targetBranch.getRevision().getHash()));
        for (GitSCMExtension ext : scm.getExtensions()) {
            // By default we do a regular merge, allowing it to fast-forward.
            ext.decorateMergeCommand(scm, build, git, listener, cmd);
        }
        cmd.execute();
    } catch (GitException e) {
        // Try to revert merge conflict markers.
        checkout(scm, build, git, listener, rev);
        throw e;
    }
    build.addAction(new MergeRecord(targetBranch.getRefSpec().destinationRef(targetBranch.getName()), targetBranch.getRevision().getHash())); // does not seem to be used, but just in case
    ObjectId mergeRev = git.revParse(Constants.HEAD);
    listener.getLogger().println("Merge succeeded, producing " + mergeRev.name());
    return new Revision(mergeRev, rev.getBranches()); // note that this ensures Build.revision != Build.marked
}
 
开发者ID:Argelbargel,项目名称:gitlab-branch-source-plugin,代码行数:24,代码来源:GitLabSCMMergeRequestHead.java

示例15: getPollingEnvVars

import hudson.model.Run; //导入依赖的package包/类
@Nonnull
public static Map<String, String> getPollingEnvVars(@Nonnull Job<?, ?> job, @CheckForNull Node node) throws EnvInjectException {

    final Run<?, ?> lastBuild = job.getLastBuild();
    if (lastBuild != null) {
        if (EnvInjectPluginHelper.isEnvInjectPluginInstalled()) {
            return getEnVars(lastBuild);
        }
    }

    if (node == null) {
        return getFallBackMasterNode(job);
    }
    if (node.getRootPath() == null) {
        return getFallBackMasterNode(job);
    }

    return getDefaultEnvVarsJob(job, node);
}
 
开发者ID:jenkinsci,项目名称:envinject-api-plugin,代码行数:20,代码来源:EnvVarsResolver.java


注:本文中的hudson.model.Run类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。