hudson.model.Job Java Examples

The following examples show how to use hudson.model.Job. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FolderVaultConfigurationSpec.java    From hashicorp-vault-plugin with MIT License 6 votes vote down vote up
@Test
public void resolverShouldCorrectlyMerge() {
    final DescribableList firstFolderProperties = mock(DescribableList.class);
    when(firstFolderProperties.get(FolderVaultConfiguration.class))
        .thenReturn(completeTestConfigFolder("firstParent", null));

    final DescribableList secondFolderProperties = mock(DescribableList.class);
    when(secondFolderProperties.get(FolderVaultConfiguration.class))
        .thenReturn(completeTestConfigFolder("secondParent", 2));

    final AbstractFolder secondParent = generateMockFolder(secondFolderProperties, null);

    final AbstractFolder firstParent = generateMockFolder(firstFolderProperties, secondParent);

    final Job job = generateMockJob(firstParent);

    VaultConfiguration result = new FolderVaultConfiguration.ForJob().forJob(job);

    VaultConfiguration expected = completeTestConfig("firstParent", null)
        .mergeWithParent(completeTestConfig("secondParent", 2));

    assertThat(result.getVaultCredentialId(), is(expected.getVaultCredentialId()));
    assertThat(result.getVaultUrl(), is(expected.getVaultUrl()));
    assertThat(result.getEngineVersion(), is(expected.getEngineVersion()));
}
 
Example #2
Source File: GithubIssue.java    From blueocean-plugin with MIT License 6 votes vote down vote up
@Override
public Collection<BlueIssue> getIssues(ChangeLogSet.Entry changeSetEntry) {
    Job job = changeSetEntry.getParent().getRun().getParent();
    if (!(job.getParent() instanceof MultiBranchProject)) {
        return null;
    }
    MultiBranchProject mbp = (MultiBranchProject)job.getParent();
    List<SCMSource> scmSources = (List<SCMSource>) mbp.getSCMSources();
    SCMSource source = scmSources.isEmpty() ? null : scmSources.get(0);
    if (!(source instanceof GitHubSCMSource)) {
        return null;
    }
    GitHubSCMSource gitHubSource = (GitHubSCMSource)source;
    String apiUri =  gitHubSource.getApiUri();
    final String repositoryUri = new HttpsRepositoryUriResolver().getRepositoryUri(apiUri, gitHubSource.getRepoOwner(), gitHubSource.getRepository());
    Collection<BlueIssue> results = new ArrayList<>();
    for (String input : findIssueKeys(changeSetEntry.getMsg())) {
        String uri = repositoryUri.substring(0, repositoryUri.length() - 4);
        results.add(new GithubIssue("#" + input, String.format("%s/issues/%s", uri, input)));
    }
    return results;
}
 
Example #3
Source File: PendingBuildsHandler.java    From gitlab-plugin with GNU General Public License v2.0 6 votes vote down vote up
public void cancelPendingBuilds(Job<?, ?> job, Integer projectId, String branch) {
    Queue queue = Jenkins.getInstance().getQueue();
    for (Queue.Item item : queue.getItems()) {
        if (!job.getName().equals(item.task.getName())) {
            continue;
        }
        GitLabWebHookCause queueItemGitLabWebHookCause = getGitLabWebHookCauseData(item);
        if (queueItemGitLabWebHookCause == null) {
            continue;
        }
        CauseData queueItemCauseData = queueItemGitLabWebHookCause.getData();
        if (!projectId.equals(queueItemCauseData.getSourceProjectId())) {
            continue;
        }
        if (branch.equals(queueItemCauseData.getBranch())) {
            cancel(item, queue, branch);
            setCommitStatusCancelledIfNecessary(queueItemCauseData, job);
        }
    }
}
 
Example #4
Source File: MavenReport.java    From pipeline-maven-plugin with MIT License 6 votes vote down vote up
public synchronized SortedMap<MavenArtifact, Collection<Job>> getDownstreamJobsByArtifact() {
    Map<MavenArtifact, SortedSet<String>> downstreamJobsByArtifact = GlobalPipelineMavenConfig.get().getDao().listDownstreamJobsByArtifact(run.getParent().getFullName(), run.getNumber());
    TreeMap<MavenArtifact, Collection<Job>> result = new TreeMap<>();

    for(Map.Entry<MavenArtifact, SortedSet<String>> entry: downstreamJobsByArtifact.entrySet()) {
        MavenArtifact mavenArtifact = entry.getKey();
        SortedSet<String> downstreamJobFullNames = entry.getValue();
        result.put(mavenArtifact, downstreamJobFullNames.stream().map(jobFullName -> {
            if (jobFullName == null) {
                return null;
            }
            // security / authorization is checked by Jenkins#getItemByFullName
            try {
                return Jenkins.getInstance().getItemByFullName(jobFullName, Job.class);
            } catch (AccessDeniedException e) {
                return null;
            }
        }).filter(Objects::nonNull).collect(Collectors.toList()));
    }

    return result;
}
 
Example #5
Source File: RunSearch.java    From blueocean-plugin with MIT License 6 votes vote down vote up
public static Iterable<BlueRun> findRuns(Job job, final Link parent){
    final List<BlueRun> runs = new ArrayList<>();
    Iterable<Job> pipelines;
    if(job != null){
        pipelines = ImmutableList.of(job);
    }else{
        pipelines = Jenkins.getInstance().getItems(Job.class);
    }
    for (Job p : pipelines) {
        RunList<? extends Run> runList = p.getBuilds();

        for (Run r : runList) {
            BlueRun run = BlueRunFactory.getRun(r, () -> parent);
            if (run != null) {
                runs.add(run);
            }
        }
    }

    return runs;
}
 
Example #6
Source File: GithubIssueTest.java    From blueocean-plugin with MIT License 6 votes vote down vote up
@Test
public void changeSetJobParentNotMultibranch() throws Exception {
    AbstractFolder project = mock(AbstractFolder.class);
    Job job = mock(MockJob.class);
    Run run = mock(Run.class);
    ChangeLogSet logSet = mock(ChangeLogSet.class);
    ChangeLogSet.Entry entry = mock(ChangeLogSet.Entry.class);

    when(project.getProperties()).thenReturn(new DescribableList(project));
    when(entry.getParent()).thenReturn(logSet);
    when(logSet.getRun()).thenReturn(run);
    when(run.getParent()).thenReturn(job);
    when(job.getParent()).thenReturn(project);

    when(entry.getMsg()).thenReturn("Closed #123 #124");

    Collection<BlueIssue> resolved = BlueIssueFactory.resolve(entry);
    Assert.assertEquals(0, resolved.size());
}
 
Example #7
Source File: GHBranchSubscriberTest.java    From github-integration-plugin with MIT License 6 votes vote down vote up
@Test
public void dontFailOnBadJob() throws IOException, ANTLRException {
    String goodRepo = "https://github.com/KostyaSha-auto/test-repo";

    final FreeStyleProject job1 = jRule.createProject(FreeStyleProject.class, "bad job");
    job1.addProperty(new GithubProjectProperty("http://bad.url/deep/bad/path/"));
    job1.addTrigger(new GitHubBranchTrigger("", GitHubPRTriggerMode.HEAVY_HOOKS_CRON, emptyList()));

    Set<Job> jobs = getBranchTriggerJobs(goodRepo);
    assertThat(jobs, hasSize(0));

    final FreeStyleProject job2 = jRule.createProject(FreeStyleProject.class, "good job");
    job2.addProperty(new GithubProjectProperty(goodRepo));
    job2.addTrigger(new GitHubBranchTrigger("", GitHubPRTriggerMode.HEAVY_HOOKS_CRON, emptyList()));

    jobs = getBranchTriggerJobs("KostyaSha-auto/test-repo");
    assertThat(jobs, hasSize(1));
    assertThat(jobs, hasItems(job2));
}
 
Example #8
Source File: ConduitCredentialsDescriptor.java    From phabricator-jenkins-plugin with MIT License 6 votes vote down vote up
public static ConduitCredentials getCredentials(Job owner, String credentialsID) {
    List<ConduitCredentials> available = availableCredentials(owner);
    if (available.size() == 0) {
        return null;
    }
    CredentialsMatcher matcher;
    if (credentialsID != null) {
        matcher = CredentialsMatchers.allOf(CredentialsMatchers.withId(credentialsID));
    } else {
        matcher = CredentialsMatchers.always();
    }
    return CredentialsMatchers.firstOrDefault(
            available,
            matcher,
            available.get(0)
    );
}
 
Example #9
Source File: JobHelper.java    From github-integration-plugin with MIT License 6 votes vote down vote up
/**
 * @see jenkins.model.ParameterizedJobMixIn#getDefaultParametersValues()
 */
public static List<ParameterValue> getDefaultParametersValues(Job<?, ?> job) {
    ParametersDefinitionProperty paramDefProp = job.getProperty(ParametersDefinitionProperty.class);
    List<ParameterValue> defValues = new ArrayList<>();

    /*
     * This check is made ONLY if someone will call this method even if isParametrized() is false.
     */
    if (isNull(paramDefProp)) {
        return defValues;
    }

    /* Scan for all parameter with an associated default values */
    for (ParameterDefinition paramDefinition : paramDefProp.getParameterDefinitions()) {
        ParameterValue defaultValue = paramDefinition.getDefaultParameterValue();

        if (defaultValue != null) {
            defValues.add(defaultValue);
        }
    }

    return defValues;
}
 
Example #10
Source File: ActionResolver.java    From gitlab-plugin with GNU General Public License v2.0 6 votes vote down vote up
private Item resolveProject(final String projectName, final Iterator<String> restOfPathParts) {
    return ACLUtil.impersonate(ACL.SYSTEM, new ACLUtil.Function<Item>() {
        public Item invoke() {
            final Jenkins jenkins = Jenkins.getInstance();
            if (jenkins != null) {
                Item item = jenkins.getItemByFullName(projectName);
                while (item instanceof ItemGroup<?> && !(item instanceof Job<?, ?> || item instanceof SCMSourceOwner) && restOfPathParts.hasNext()) {
                    item = jenkins.getItem(restOfPathParts.next(), (ItemGroup<?>) item);
                }
                if (item instanceof Job<?, ?> || item instanceof SCMSourceOwner) {
                    return item;
                }
            }
            LOGGER.log(Level.FINE, "No project found: {0}, {1}", toArray(projectName, Joiner.on('/').join(restOfPathParts)));
            return null;
        }
    });
}
 
Example #11
Source File: PhabricatorBuildWrapper.java    From phabricator-jenkins-plugin with MIT License 5 votes vote down vote up
private String getConduitToken(Job owner, Logger logger) {
    ConduitCredentials credentials = getConduitCredentials(owner);
    if (credentials != null) {
        return credentials.getToken().getPlainText();
    }
    logger.warn("credentials", "No credentials configured.");
    return null;
}
 
Example #12
Source File: ActionResolver.java    From gitlab-plugin with GNU General Public License v2.0 5 votes vote down vote up
private WebHookAction resolveAction(Item project, String restOfPath, StaplerRequest request) {
    String method = request.getMethod();
    if (method.equals("POST")) {
        return onPost(project, request);
    } else if (method.equals("GET")) {
        if (project instanceof Job<?, ?>) {
            return onGet((Job<?, ?>) project, restOfPath, request);
        } else {
            LOGGER.log(Level.FINE, "GET is not supported for this project {0}", project.getName());
            return new NoopAction();
        }
    }
    LOGGER.log(Level.FINE, "Unsupported HTTP method: {0}", method);
    return new NoopAction();
}
 
Example #13
Source File: GogsWebHookPluginsTest.java    From gogs-webhook-plugin with MIT License 5 votes vote down vote up
@Test
public void testCloudBeesFolder() throws Exception {
    Folder folder = createFolder(FOLDERNAME);

    FreeStyleProject project = folder.createProject(FreeStyleProject.class, PROJECTNAME);

    Job job = GogsUtils.find(FOLDERNAME + "/" + PROJECTNAME, Job.class);
    assertEquals("Couldn't find " + FOLDERNAME + "/" + PROJECTNAME, job, project);
}
 
Example #14
Source File: BuildUtil.java    From gitlab-plugin with GNU General Public License v2.0 5 votes vote down vote up
public static Run<?, ?> getBuildBySHA1WithoutMergeBuilds(Job<?, ?> project, String sha1) {
    for (Run<?, ?> build : project.getBuilds()) {
        MergeRecord merge = build.getAction(MergeRecord.class);
        for(BuildData data : build.getActions(BuildData.class)) {
            if (hasLastBuild(data) && isNoMergeBuild(data, merge) && data.lastBuild.isFor(sha1)) {
                return build;
            }
        }
    }
    return null;
}
 
Example #15
Source File: MyBuildsView.java    From DotCi with MIT License 5 votes vote down vote up
@Override
public Collection<TopLevelItem> getItems() {
    final List<TopLevelItem> items = new LinkedList<>();
    for (final TopLevelItem item : getOwnerItemGroup().getItems()) {
        if (item.hasPermission(Job.CONFIGURE)) {
            items.add(item);
        }
    }
    return Collections.unmodifiableList(items);
}
 
Example #16
Source File: IssuesTotalColumnTest.java    From warnings-ng-plugin with MIT License 5 votes vote down vote up
@Test
void shouldShowNoResultIfNoAction() {
    IssuesTotalColumn column = createColumn();
    column.setSelectTools(false);

    Job<?, ?> job = createJobWithActions();

    assertThat(column.getTotal(job)).isEmpty();
    assertThat(column.getUrl(job)).isEmpty();
    assertThat(column.getDetails(job)).isEmpty();
    assertThat(column.getTools()).isEmpty();
    assertThat(column.getSelectTools()).isFalse();
    assertThat(column.getName()).isEqualTo(NAME);
}
 
Example #17
Source File: ProjectBranchesProvider.java    From gitlab-plugin with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Get the URL of the first declared repository in the project configuration.
 * Use this as default source repository url.
 *
 * @return URIish the default value of the source repository url
 * @throws IllegalStateException Project does not use git scm.
 */
private URIish getSourceRepoURLDefault(Job<?, ?> job) {
    SCMTriggerItem item = SCMTriggerItem.SCMTriggerItems.asSCMTriggerItem(job);
    GitSCM gitSCM = getGitSCM(item);
    if (gitSCM == null) {
        LOGGER.log(Level.WARNING, "Could not find GitSCM for project. Project = {1}, next build = {2}",
                array(job.getName(), String.valueOf(job.getNextBuildNumber())));
        throw new IllegalStateException("This project does not use git:" + job.getName());
    }
    return getFirstRepoURL(gitSCM.getRepositories());
}
 
Example #18
Source File: BranchImpl.java    From blueocean-plugin with MIT License 5 votes vote down vote up
@Override
public BluePipeline getPipeline(Item item, Reachable parent, BlueOrganization organization) {
    if (item instanceof WorkflowJob && item.getParent() instanceof MultiBranchProject) {
        return new BranchImpl(organization, (Job) item, parent.getLink());
    }
    return null;
}
 
Example #19
Source File: IssuesTotalColumnTest.java    From warnings-ng-plugin with MIT License 5 votes vote down vote up
@Test
void shouldShowTotalOfSelectedTool() {
    IssuesTotalColumn column = createColumn();
    column.setSelectTools(true);
    column.setTools(Collections.singletonList(createTool(CHECK_STYLE_ID)));

    Job<?, ?> job = createJobWithActions(
            createAction(CHECK_STYLE_ID, CHECK_STYLE_NAME, 1),
            createAction(SPOT_BUGS_ID, SPOT_BUGS_NAME, 2));

    assertThat(column.getTotal(job)).isNotEmpty();
    assertThat(column.getTotal(job)).hasValue(1);
    assertThat(column.getUrl(job)).isEqualTo("0/" + CHECK_STYLE_ID);

    column.setTools(Collections.singletonList(createTool(SPOT_BUGS_ID)));

    assertThat(column.getTotal(job)).isNotEmpty();
    assertThat(column.getTotal(job)).hasValue(2);
    assertThat(column.getUrl(job)).isEqualTo("0/" + SPOT_BUGS_ID);

    column.setTools(Collections.singletonList(createTool("unknown")));

    assertThat(column.getTotal(job)).isEmpty();
    assertThat(column.getUrl(job)).isEmpty();

    column.setTools(Collections.emptyList());

    assertThat(column.getTotal(job)).isEmpty();
    assertThat(column.getUrl(job)).isEmpty();
}
 
Example #20
Source File: ImageAction.java    From docker-workflow-plugin with MIT License 5 votes vote down vote up
@Override public Collection<String> getDockerImagesUsedByJob(Job<?,?> job) {
    Run<?,?> build = job.getLastCompletedBuild();
    if (build != null) {
        ImageAction action = build.getAction(ImageAction.class);
        if (action != null) {
            Set<String> bareNames = new TreeSet<String>();
            for (String name : action.names) {
                bareNames.add(name./* strip any tag or hash */replaceFirst("[:@].+", ""));
            }
            return bareNames;
        }
    }
    return Collections.emptySet();
}
 
Example #21
Source File: PipelineTriggerService.java    From pipeline-maven-plugin with MIT License 5 votes vote down vote up
public boolean isDownstreamVisibleByUpstreamBuildAuth(@Nonnull Item downstreamPipeline) {
    boolean result = getItemByFullName(downstreamPipeline.getFullName(), Job.class) != null;
    LOGGER.log(Level.FINE, "isDownstreamVisibleByUpstreamBuildAuth({0}, auth: {1}): {2}",
            new Object[]{downstreamPipeline, Jenkins.getAuthentication(), result});

    return result;
}
 
Example #22
Source File: Office365ConnectorWebhookNotifierTest.java    From office-365-connector-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void extractWebhooks_OnMissingProperty_ReturnsEmptyWebhooks() {

    // given
    Job job = mock(Job.class);
    when(job.getProperty(WebhookJobProperty.class)).thenReturn(null);
    Office365ConnectorWebhookNotifier notifier = new Office365ConnectorWebhookNotifier(run, taskListener);

    // when
    List<Webhook> webhooks = Deencapsulation.invoke(notifier, "extractWebhooks", job);

    // then
    assertThat(webhooks).isEmpty();
}
 
Example #23
Source File: BuildWebHookAction.java    From gitlab-plugin with GNU General Public License v2.0 5 votes vote down vote up
public void run() {
    GitLabPushTrigger trigger = GitLabPushTrigger.getFromJob((Job<?, ?>) project);
    if (trigger != null) {
        if (StringUtils.isEmpty(trigger.getSecretToken())) {
            checkPermission(Item.BUILD, project);
        } else if (!StringUtils.equals(trigger.getSecretToken(), secretToken)) {
            throw HttpResponses.errorWithoutStack(401, "Invalid token");
        }
        performOnPost(trigger);
    }
}
 
Example #24
Source File: IssuesTablePortletTest.java    From warnings-ng-plugin with MIT License 5 votes vote down vote up
@Test
void shouldShowTableWithOneJob() {
    Job<?, ?> job = createJob(CHECK_STYLE_ID, CHECK_STYLE_NAME, 1);

    PortletTableModel model = createModel(list(job));

    verifySingleTool(job, model, CHECK_STYLE_ID, CHECK_STYLE_NAME, 1);
}
 
Example #25
Source File: AWSDeviceFarmUtils.java    From aws-device-farm-jenkins-plugin with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the most recent AWS Device Farm test result from the previous build.
 *
 * @param job The job which generated an AWS Device Farm test result
 * @return The previous Device Farm build result.
 */
public static AWSDeviceFarmTestResult previousAWSDeviceFarmBuildResult(Job job) {
    Run prev = job.getLastCompletedBuild();
    if (prev == null) {
        return null;
    }
    AWSDeviceFarmTestResultAction action = prev.getAction(AWSDeviceFarmTestResultAction.class);
    if (action == null) {
        return null;
    }
    return action.getResult();
}
 
Example #26
Source File: IssuesTablePortletTest.java    From warnings-ng-plugin with MIT License 5 votes vote down vote up
private void verifySpotBugsAndCheckStyle(final Job job, final PortletTableModel model) {
    assertThat(model.getToolNames()).containsExactly(CHECK_STYLE_NAME, SPOT_BUGS_NAME);

    List<TableRow> rows = model.getRows();
    assertThat(rows).hasSize(1);

    TableRow actualRow = rows.get(0);
    assertThat(actualRow.getJob()).isSameAs(job);

    List<Result> results = actualRow.getResults();
    assertThat(results).hasSize(2);

    verifyResult(results.get(0), CHECK_STYLE_ID, 2);
    verifyResult(results.get(1), SPOT_BUGS_ID, 1);
}
 
Example #27
Source File: IssuesTablePortletTest.java    From warnings-ng-plugin with MIT License 5 votes vote down vote up
@Test
void shouldShowTableWithTwoSelectedTools() {
    Job<?, ?> job = createJobWithActions(
            createAction(SPOT_BUGS_ID, SPOT_BUGS_NAME, 1),
            createAction(CHECK_STYLE_ID, CHECK_STYLE_NAME, 2));

    IssuesTablePortlet portlet = createPortlet();
    portlet.setSelectTools(true);
    portlet.setTools(list(createTool(SPOT_BUGS_ID), createTool(CHECK_STYLE_ID)));

    List<Job<?, ?>> jobs = list(job);
    verifySpotBugsAndCheckStyle(job, portlet.getModel(jobs));

    portlet.setTools(list(createTool(SPOT_BUGS_ID)));
    verifySingleTool(job, portlet.getModel(jobs), SPOT_BUGS_ID, SPOT_BUGS_NAME, 1);

    portlet.setTools(list(createTool(CHECK_STYLE_ID)));
    verifySingleTool(job, portlet.getModel(jobs), CHECK_STYLE_ID, CHECK_STYLE_NAME, 2);

    portlet.setTools(Collections.emptyList());

    PortletTableModel model = portlet.getModel(jobs);
    assertThat(model.getToolNames()).isEmpty();

    List<TableRow> rows = model.getRows();
    assertThat(rows).hasSize(1);

    TableRow actualRow = rows.get(0);
    assertThat(actualRow.getJob()).isSameAs(job);
    assertThat(actualRow.getResults()).isEmpty();
}
 
Example #28
Source File: GitCloneEnvContributor.java    From DotCi with MIT License 5 votes vote down vote up
@Override
public void buildEnvironmentFor(Job job, EnvVars envs, TaskListener listener) throws IOException, InterruptedException {
    if (job instanceof DynamicProject) {
        DynamicProject dynamicJob = ((DynamicProject) job);
        GitUrl gitUrl = new GitUrl(dynamicJob.getGithubRepoUrl());
        envs.put("DOTCI_DOCKER_COMPOSE_GIT_CLONE_URL", getCloneUrl(gitUrl));
    }
}
 
Example #29
Source File: ActionableBuilderTest.java    From office-365-connector-plugin with Apache License 2.0 5 votes vote down vote up
@Test
public void pullRequestActionable_OnObjectMetadataAction_DoesNotAddFact() {

    // given
    // from @Before
    SCMHead head = new SCMHeadBuilder("Pull Request");

    Job job = mock(Job.class);
    when(run.getParent()).thenReturn(job);

    mockStatic(SCMHead.HeadByItem.class);
    when(SCMHead.HeadByItem.findHead(job)).thenReturn(head);
    when(job.getAction(ObjectMetadataAction.class)).thenReturn(null);

    ContributorMetadataAction contributorMetadataAction = mock(ContributorMetadataAction.class);
    when(contributorMetadataAction.getContributor()).thenReturn("damianszczepanik");
    when(contributorMetadataAction.getContributorDisplayName()).thenReturn("Damian Szczepanik");
    when(job.getAction(ContributorMetadataAction.class)).thenReturn(contributorMetadataAction);

    // when
    Deencapsulation.invoke(actionableBuilder, "pullRequestActionable");

    // then
    assertThat(factsBuilder.collect()).hasSize(1);

    List<PotentialAction> potentialActions = Deencapsulation.getField(actionableBuilder, "potentialActions");
    assertThat(potentialActions).isEmpty();
}
 
Example #30
Source File: TemplateDrivenMultiBranchProject.java    From multi-branch-project-plugin with MIT License 5 votes vote down vote up
/**
 * Returns the last successful build, if any. Otherwise null. A successful build would include
 * either {@link Result#SUCCESS} or {@link Result#UNSTABLE}.
 *
 * @return the build or null
 * @see #getLastStableBuild()
 */
@SuppressWarnings(UNUSED)
@CheckForNull
@Exported
public Run getLastSuccessfulBuild() {
    Run retVal = null;
    for (Job job : getAllJobs()) {
        retVal = takeLast(retVal, job.getLastSuccessfulBuild());
    }
    return retVal;
}