Java Code Examples for hudson.model.Cause#UpstreamCause

The following examples show how to use hudson.model.Cause#UpstreamCause . 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: BuildFlowAction.java    From yet-another-build-visualizer-plugin with MIT License 6 votes vote down vote up
private static Run getUpstreamBuild(@Nonnull Run build) {
  CauseAction causeAction = build.getAction(CauseAction.class);
  if (causeAction == null) {
    return null;
  }
  for (Cause cause : causeAction.getCauses()) {
    if (cause instanceof Cause.UpstreamCause) {
      Cause.UpstreamCause upstreamCause = (Cause.UpstreamCause) cause;
      Job upstreamJob =
          Jenkins.getInstance().getItemByFullName(upstreamCause.getUpstreamProject(), Job.class);
      // We want to ignore rebuilds, rebuilds have the same parent as
      // original build, see BuildCache#updateCache().
      if (upstreamJob == null || build.getParent() == upstreamJob) {
        continue;
      }
      return upstreamJob.getBuildByNumber(upstreamCause.getUpstreamBuild());
    }
  }
  return null;
}
 
Example 2
Source File: CauseDTO.java    From kubernetes-pipeline-plugin with Apache License 2.0 6 votes vote down vote up
public CauseDTO(Cause cause) {
    this.shortDescription = cause.getShortDescription();
    if (cause instanceof Cause.UserIdCause) {
        Cause.UserIdCause userIdCause = (Cause.UserIdCause) cause;
        this.userId = userIdCause.getUserId();
        this.userName = userIdCause.getUserName();
    } else if (cause instanceof Cause.RemoteCause) {
        Cause.RemoteCause remoteCause = (Cause.RemoteCause) cause;
        this.remoteAddr = remoteCause.getAddr();
        this.remoteNote = remoteCause.getNote();
    } else if (cause instanceof Cause.UpstreamCause) {
        Cause.UpstreamCause upstreamCause = (Cause.UpstreamCause) cause;
        this.upstreamProject = upstreamCause.getUpstreamProject();
        this.upstreamUrl = upstreamCause.getUpstreamUrl();

    }
}
 
Example 3
Source File: PipelineTriggerService.java    From pipeline-maven-plugin with MIT License 6 votes vote down vote up
/**
 * Check NO infinite loop of job triggers caused by {@link hudson.model.Cause.UpstreamCause}.
 *
 * @param initialBuild
 * @throws IllegalStateException if an infinite loop is detected
 */
public void checkNoInfiniteLoopOfUpstreamCause(@Nonnull Run initialBuild) throws IllegalStateException {
    java.util.Queue<Run> builds = new LinkedList<>(Collections.singleton(initialBuild));
    Run currentBuild;
    while ((currentBuild = builds.poll()) != null) {
        for (Cause cause : ((List<Cause>) currentBuild.getCauses())) {
            if (cause instanceof Cause.UpstreamCause) {
                Cause.UpstreamCause upstreamCause = (Cause.UpstreamCause) cause;
                Run<?, ?> upstreamBuild = upstreamCause.getUpstreamRun();
                if (upstreamBuild == null) {
                    // Can be Authorization, build deleted on the file system...
                } else if (Objects.equals(upstreamBuild.getParent().getFullName(), initialBuild.getParent().getFullName())) {
                    throw new IllegalStateException("Infinite loop of job triggers ");
                } else {
                    builds.add(upstreamBuild);
                }
            }
        }
    }
}
 
Example 4
Source File: UpstreamBuildUtil.java    From jira-ext-plugin with Apache License 2.0 6 votes vote down vote up
private static Cause.UpstreamCause getUpstreamCause(Run run)
{
    if (run == null)
    {
        return null;
    }
    List<Cause> causes = run.getCauses();
    for (Cause cause : causes)
    {
        if (cause instanceof Cause.UpstreamCause)
        {
            return (Cause.UpstreamCause)cause;
        }
    }
    return null;
}
 
Example 5
Source File: DatabaseSyncRunListener.java    From pipeline-maven-plugin with MIT License 5 votes vote down vote up
@Override
public void onInitialize(WorkflowRun run) {
    super.onInitialize(run);

    for (Cause cause: run.getCauses()) {
        if (cause instanceof Cause.UpstreamCause) {
            Cause.UpstreamCause upstreamCause = (Cause.UpstreamCause) cause;

            String upstreamJobName = upstreamCause.getUpstreamProject();
            int upstreamBuildNumber = upstreamCause.getUpstreamBuild();
            globalPipelineMavenConfig.getDao().recordBuildUpstreamCause(upstreamJobName, upstreamBuildNumber, run.getParent().getFullName(), run.getNumber());
        }
    }

}
 
Example 6
Source File: UpstreamBuildUtil.java    From jira-ext-plugin with Apache License 2.0 5 votes vote down vote up
/**
 * Get the root upstream build which caused this build. Useful in build pipelines to
 * be able to extract the changes which started the pipeline in later stages of
 * the pipeline
 *
 * @return
 */
public static AbstractBuild getUpstreamBuild(AbstractBuild<?, ?> build)
{
    logger.log(Level.FINE, "Find build upstream of " + build.getId());

    Cause.UpstreamCause cause = getUpstreamCause(build);
    if (cause == null)
    {
        logger.log(Level.FINE, "No upstream cause, so must be upstream build: " + build.getId());
        return build;
    }
    logger.log(Level.FINE, "Found upstream cause: " + cause.toString() + "(" + cause.getShortDescription() + ")");
    AbstractProject project = (AbstractProject) Jenkins.getInstance().getItem(cause.getUpstreamProject(), build.getProject());
    if (project == null)
    {
        logger.log(Level.WARNING, "Found an UpstreamCause (" + cause.toString()
                + "), but the upstream project (" + cause.getUpstreamProject() + ") does not appear to be valid!");
        logger.log(Level.WARNING, "Using build [" + build.getId() + "] as the upstream build - this is likely incorrect.");

        return build;
    }
    AbstractBuild upstreamBuild = project.getBuildByNumber(cause.getUpstreamBuild());
    if (upstreamBuild == null)
    {
        logger.log(Level.WARNING, "Found an UpstreamCause (" + cause.toString()
                + "), and an upstream project (" + project.getName() + "), but the build is invalid!" + cause.getUpstreamBuild());
        logger.log(Level.WARNING, "Using build [" + build.getId() + "] as the upstream build - this is likely incorrect.");
        return build;
    }
    return getUpstreamBuild(upstreamBuild);
}
 
Example 7
Source File: PhabricatorBuildWrapper.java    From phabricator-jenkins-plugin with MIT License 5 votes vote down vote up
@VisibleForTesting
static Run<?, ?> getUpstreamRun(AbstractBuild build) {
    CauseAction action = build.getAction(hudson.model.CauseAction.class);
    if (action != null) {
        Cause.UpstreamCause upstreamCause = action.findCause(hudson.model.Cause.UpstreamCause.class);
        if (upstreamCause != null) {
            return upstreamCause.getUpstreamRun();
        }
    }
    return null;
}
 
Example 8
Source File: BuildCulpritsRetriever.java    From jenkins-build-monitor-plugin with MIT License 5 votes vote down vote up
public Set<String> getCommitters(Run<?, ?> run) {
    Set<String> committers = getCommittersForRun(run);
    //If no committers were found, recursively get upstream committers:
    if (committers.isEmpty()) {
        Cause.UpstreamCause upstreamCause = run.getCause(Cause.UpstreamCause.class);
        if (upstreamCause != null) {
            Run<?, ?> upstreamRun = upstreamCause.getUpstreamRun();
            if (upstreamRun != null) {
                committers.addAll(getCommitters(upstreamRun));
            }
        }
    }
    return committers;
}
 
Example 9
Source File: MigrationStep11.java    From pipeline-maven-plugin with MIT License 4 votes vote down vote up
@Override
public void execute(@Nonnull Connection cnn, @Nonnull JenkinsDetails jenkinsDetails) throws SQLException {
    int jobCount = 0;
    int buildCauseCount = 0;

    LOGGER.info("Upgrade table JENKINS_BUILD_UPSTREAM_CAUSE...");
    String select = "select jenkins_job.full_name, jenkins_job.jenkins_master_id, jenkins_build.number, jenkins_build.id " +
            " from jenkins_build inner join jenkins_job on jenkins_build.job_id = jenkins_job.id order by jenkins_job.full_name, jenkins_build.number";

    String insert = " insert into JENKINS_BUILD_UPSTREAM_CAUSE (upstream_build_id, downstream_build_id) " +
            " select upstream_build.id, ? " +
            " from jenkins_build as upstream_build, jenkins_job as upstream_job " +
            " where " +
            "   upstream_build.job_id = upstream_job.id and" +
            "   upstream_job.full_name = ? and" +
            "   upstream_job.jenkins_master_id = ? and" +
            "   upstream_build.number = ? ";
    try (PreparedStatement insertStmt = cnn.prepareStatement(insert)) {
        try (PreparedStatement selectStmt = cnn.prepareStatement(select)) {
            try (ResultSet rst = selectStmt.executeQuery()) {
                while (rst.next()) {
                    jobCount++;
                    if ((jobCount < 100 && (jobCount % 10) == 0) ||
                            (jobCount < 500 && (jobCount % 20) == 0) ||
                            ((jobCount % 50) == 0)) {
                        LOGGER.log(Level.INFO, "#" + jobCount + " - " + rst.getString("FULL_NAME") + "...");
                    }

                    String jobFullName = rst.getString("full_name");
                    int buildNumber = rst.getInt("number");
                    long buildId = rst.getLong("id");
                    long jenkinsMasterId = rst.getLong("jenkins_master_id");

                    try {
                        WorkflowJob pipeline = Jenkins.getInstance().getItemByFullName(jobFullName, WorkflowJob.class);
                        if (pipeline == null) {
                            continue;
                        }
                        WorkflowRun build = pipeline.getBuildByNumber(buildNumber);
                        if (build == null) {
                            continue;
                        }

                        for (Cause cause : build.getCauses()) {
                            if (cause instanceof Cause.UpstreamCause) {
                                Cause.UpstreamCause upstreamCause = (Cause.UpstreamCause) cause;
                                String upstreamJobFullName = upstreamCause.getUpstreamProject();
                                int upstreamJobNumber = upstreamCause.getUpstreamBuild();

                                insertStmt.setLong(1, buildId);
                                insertStmt.setString(2, upstreamJobFullName);
                                insertStmt.setLong(3, jenkinsMasterId);
                                insertStmt.setInt(4, upstreamJobNumber);
                                insertStmt.addBatch();
                                buildCauseCount++;
                            }
                        }
                    } catch (RuntimeException e) {
                        LOGGER.log(Level.WARNING, "Silently ignore exception migrating build " + jobFullName + "#" + buildNumber, e);
                    }

                }
                insertStmt.executeBatch();
            }
        }
    }
    LOGGER.info("Successfully upgraded table JENKINS_BUILD_UPSTREAM_CAUSE, " + jobCount + " jobs scanned, " + buildCauseCount + " job causes inserted");

}
 
Example 10
Source File: DependencyGraphTest.java    From pipeline-maven-plugin with MIT License 4 votes vote down vote up
/**
 * The maven-war-app has a dependency on the maven-jar-app
 */
@Test
public void verify_downstream_simple_pipeline_trigger() throws Exception {
    System.out.println("gitRepoRule: " + gitRepoRule);
    loadMavenJarProjectInGitRepo(this.gitRepoRule);
    System.out.println("downstreamArtifactRepoRule: " + downstreamArtifactRepoRule);
    loadMavenWarProjectInGitRepo(this.downstreamArtifactRepoRule);

    String mavenJarPipelineScript = "node('master') {\n" +
            "    git($/" + gitRepoRule.toString() + "/$)\n" +
            "    withMaven() {\n" +
            "        sh 'mvn install'\n" +
            "    }\n" +
            "}";
    String mavenWarPipelineScript = "node('master') {\n" +
            "    git($/" + downstreamArtifactRepoRule.toString() + "/$)\n" +
            "    withMaven() {\n" +
            "        sh 'mvn install'\n" +
            "    }\n" +
            "}";


    WorkflowJob mavenJarPipeline = jenkinsRule.createProject(WorkflowJob.class, "build-maven-jar");
    mavenJarPipeline.setDefinition(new CpsFlowDefinition(mavenJarPipelineScript, true));
    mavenJarPipeline.addTrigger(new WorkflowJobDependencyTrigger());

    WorkflowRun mavenJarPipelineFirstRun = jenkinsRule.assertBuildStatus(Result.SUCCESS, mavenJarPipeline.scheduleBuild2(0));
    // TODO check in DB that the generated artifact is recorded


    WorkflowJob mavenWarPipeline = jenkinsRule.createProject(WorkflowJob.class, "build-maven-war");
    mavenWarPipeline.setDefinition(new CpsFlowDefinition(mavenWarPipelineScript, true));
    mavenWarPipeline.addTrigger(new WorkflowJobDependencyTrigger());
    WorkflowRun mavenWarPipelineFirstRun = jenkinsRule.assertBuildStatus(Result.SUCCESS, mavenWarPipeline.scheduleBuild2(0));
    // TODO check in DB that the dependency on the war project is recorded
    System.out.println("mavenWarPipelineFirstRun: " + mavenWarPipelineFirstRun);

    WorkflowRun mavenJarPipelineSecondRun = jenkinsRule.assertBuildStatus(Result.SUCCESS, mavenJarPipeline.scheduleBuild2(0));

    jenkinsRule.waitUntilNoActivity();

    WorkflowRun mavenWarPipelineLastRun = mavenWarPipeline.getLastBuild();
    SqlTestsUtils.dump("select * from job_generated_artifacts", ((PipelineMavenPluginJdbcDao)GlobalPipelineMavenConfig.get().getDao()).getDataSource(), System.out);
    SqlTestsUtils.dump("select * from job_dependencies", ((PipelineMavenPluginJdbcDao)GlobalPipelineMavenConfig.get().getDao()).getDataSource(), System.out);

    System.out.println("mavenWarPipelineLastBuild: " + mavenWarPipelineLastRun + " caused by " + mavenWarPipelineLastRun.getCauses());

    assertThat(mavenWarPipelineLastRun.getNumber(), is(mavenWarPipelineFirstRun.getNumber() + 1));
    Cause.UpstreamCause upstreamCause = mavenWarPipelineLastRun.getCause(Cause.UpstreamCause.class);
    assertThat(upstreamCause, notNullValue());
}
 
Example 11
Source File: DependencyGraphTest.java    From pipeline-maven-plugin with MIT License 4 votes vote down vote up
/**
 * The maven-war-app has a dependency on the maven-jar-app
 */
@Test
public void verify_downstream_multi_branch_pipeline_trigger() throws Exception {
    System.out.println("gitRepoRule: " + gitRepoRule);
    loadMavenJarProjectInGitRepo(this.gitRepoRule);
    System.out.println("downstreamArtifactRepoRule: " + downstreamArtifactRepoRule);
    loadMavenWarProjectInGitRepo(this.downstreamArtifactRepoRule);

    String script = "node('master') {\n" +
            "    checkout scm\n" +
            "    withMaven() {\n" +
            "        sh 'mvn install'\n" +
            "    }\n" +
            "}";
    gitRepoRule.write("Jenkinsfile", script);
    gitRepoRule.git("add", "Jenkinsfile");
    gitRepoRule.git("commit", "--message=jenkinsfile");


    downstreamArtifactRepoRule.write("Jenkinsfile", script);
    downstreamArtifactRepoRule.git("add", "Jenkinsfile");
    downstreamArtifactRepoRule.git("commit", "--message=jenkinsfile");

    // TRIGGER maven-jar#1 to record that "build-maven-jar" generates this jar and install this maven jar in the local maven repo
    WorkflowMultiBranchProject mavenJarPipeline = jenkinsRule.createProject(WorkflowMultiBranchProject.class, "build-maven-jar");
    mavenJarPipeline.addTrigger(new WorkflowJobDependencyTrigger());
    mavenJarPipeline.getSourcesList().add(new BranchSource(new GitSCMSource(null, gitRepoRule.toString(), "", "*", "", false)));
    System.out.println("trigger maven-jar#1...");
    WorkflowJob mavenJarPipelineMasterPipeline = WorkflowMultibranchProjectTestsUtils.scheduleAndFindBranchProject(mavenJarPipeline, "master");
    assertEquals(1, mavenJarPipeline.getItems().size());
    System.out.println("wait for maven-jar#1...");
    jenkinsRule.waitUntilNoActivity();

    assertThat(mavenJarPipelineMasterPipeline.getLastBuild().getNumber(), is(1));
    // TODO check in DB that the generated artifact is recorded

    // TRIGGER maven-war#1 to record that "build-maven-war" has a dependency on "build-maven-jar"
    WorkflowMultiBranchProject mavenWarPipeline = jenkinsRule.createProject(WorkflowMultiBranchProject.class, "build-maven-war");
    mavenWarPipeline.addTrigger(new WorkflowJobDependencyTrigger());
    mavenWarPipeline.getSourcesList().add(new BranchSource(new GitSCMSource(null, downstreamArtifactRepoRule.toString(), "", "*", "", false)));
    System.out.println("trigger maven-war#1...");
    WorkflowJob mavenWarPipelineMasterPipeline = WorkflowMultibranchProjectTestsUtils.scheduleAndFindBranchProject(mavenWarPipeline, "master");
    assertEquals(1, mavenWarPipeline.getItems().size());
    System.out.println("wait for maven-war#1...");
    jenkinsRule.waitUntilNoActivity();
    WorkflowRun mavenWarPipelineFirstRun = mavenWarPipelineMasterPipeline.getLastBuild();

    // TODO check in DB that the dependency on the war project is recorded


    // TRIGGER maven-jar#2 so that it triggers "maven-war" and creates maven-war#2
    System.out.println("trigger maven-jar#2...");
    Future<WorkflowRun> mavenJarPipelineMasterPipelineSecondRunFuture = mavenJarPipelineMasterPipeline.scheduleBuild2(0, new CauseAction(new Cause.RemoteCause("127.0.0.1", "junit test")));
    System.out.println("wait for maven-jar#2...");
    mavenJarPipelineMasterPipelineSecondRunFuture.get();
    jenkinsRule.waitUntilNoActivity();


    WorkflowRun mavenWarPipelineLastRun = mavenWarPipelineMasterPipeline.getLastBuild();

    System.out.println("mavenWarPipelineLastBuild: " + mavenWarPipelineLastRun + " caused by " + mavenWarPipelineLastRun.getCauses());

    assertThat(mavenWarPipelineLastRun.getNumber(), is(mavenWarPipelineFirstRun.getNumber() + 1));
    Cause.UpstreamCause upstreamCause = mavenWarPipelineLastRun.getCause(Cause.UpstreamCause.class);
    assertThat(upstreamCause, notNullValue());

}
 
Example 12
Source File: DependencyGraphTest.java    From pipeline-maven-plugin with MIT License 4 votes vote down vote up
/**
 * The maven-war-app has a dependency on the maven-jar-app
 */
@Test
public void verify_downstream_pipeline_triggered_on_parent_pom_build() throws Exception {
    System.out.println("gitRepoRule: " + gitRepoRule);
    loadMavenJarProjectInGitRepo(this.gitRepoRule);
    System.out.println("downstreamArtifactRepoRule: " + downstreamArtifactRepoRule);
    loadMavenWarProjectInGitRepo(this.downstreamArtifactRepoRule);

    String mavenJarPipelineScript = "node('master') {\n" +
            "    git($/" + gitRepoRule.toString() + "/$)\n" +
            "    withMaven() {\n" +
            "        sh 'mvn install'\n" +
            "    }\n" +
            "}";
    String mavenWarPipelineScript = "node('master') {\n" +
            "    git($/" + downstreamArtifactRepoRule.toString() + "/$)\n" +
            "    withMaven() {\n" +
            "        sh 'mvn install'\n" +
            "    }\n" +
            "}";


    WorkflowJob mavenJarPipeline = jenkinsRule.createProject(WorkflowJob.class, "build-maven-jar");
    mavenJarPipeline.setDefinition(new CpsFlowDefinition(mavenJarPipelineScript, true));
    mavenJarPipeline.addTrigger(new WorkflowJobDependencyTrigger());

    WorkflowRun mavenJarPipelineFirstRun = jenkinsRule.assertBuildStatus(Result.SUCCESS, mavenJarPipeline.scheduleBuild2(0));
    // TODO check in DB that the generated artifact is recorded


    WorkflowJob mavenWarPipeline = jenkinsRule.createProject(WorkflowJob.class, "build-maven-war");
    mavenWarPipeline.setDefinition(new CpsFlowDefinition(mavenWarPipelineScript, true));
    mavenWarPipeline.addTrigger(new WorkflowJobDependencyTrigger());
    WorkflowRun mavenWarPipelineFirstRun = jenkinsRule.assertBuildStatus(Result.SUCCESS, mavenWarPipeline.scheduleBuild2(0));
    // TODO check in DB that the dependency on the war project is recorded
    System.out.println("mavenWarPipelineFirstRun: " + mavenWarPipelineFirstRun);

    WorkflowRun mavenJarPipelineSecondRun = jenkinsRule.assertBuildStatus(Result.SUCCESS, mavenJarPipeline.scheduleBuild2(0));

    jenkinsRule.waitUntilNoActivity();

    WorkflowRun mavenWarPipelineLastRun = mavenWarPipeline.getLastBuild();

    System.out.println("mavenWarPipelineLastBuild: " + mavenWarPipelineLastRun + " caused by " + mavenWarPipelineLastRun.getCauses());

    assertThat(mavenWarPipelineLastRun.getNumber(), is(mavenWarPipelineFirstRun.getNumber() + 1));
    Cause.UpstreamCause upstreamCause = mavenWarPipelineLastRun.getCause(Cause.UpstreamCause.class);
    assertThat(upstreamCause, notNullValue());


}
 
Example 13
Source File: DependencyGraphTest.java    From pipeline-maven-plugin with MIT License 4 votes vote down vote up
/**
 * NBM dependencies
 */
@Test
public void verify_nbm_downstream_simple_pipeline_trigger() throws Exception {
    System.out.println("gitRepoRule: " + gitRepoRule);
    loadNbmDependencyMavenJarProjectInGitRepo(this.gitRepoRule);
    System.out.println("downstreamArtifactRepoRule: " + downstreamArtifactRepoRule);
    loadNbmBaseMavenProjectInGitRepo(this.downstreamArtifactRepoRule);

    String mavenJarPipelineScript = "node('master') {\n"
            + "    git($/" + gitRepoRule.toString() + "/$)\n"
            + "    withMaven() {\n"
            + "        sh 'mvn install'\n"
            + "    }\n"
            + "}";
    String mavenWarPipelineScript = "node('master') {\n"
            + "    git($/" + downstreamArtifactRepoRule.toString() + "/$)\n"
            + "    withMaven() {\n"
            + "        sh 'mvn install'\n"
            + "    }\n"
            + "}";

    WorkflowJob mavenNbmDependency = jenkinsRule.createProject(WorkflowJob.class, "build-nbm-dependency");
    mavenNbmDependency.setDefinition(new CpsFlowDefinition(mavenJarPipelineScript, true));
    mavenNbmDependency.addTrigger(new WorkflowJobDependencyTrigger());

    WorkflowRun mavenJarPipelineFirstRun = jenkinsRule.assertBuildStatus(Result.SUCCESS, mavenNbmDependency.scheduleBuild2(0));
    // TODO check in DB that the generated artifact is recorded

    WorkflowJob mavenNbmBasePipeline = jenkinsRule.createProject(WorkflowJob.class, "build-nbm-base");
    mavenNbmBasePipeline.setDefinition(new CpsFlowDefinition(mavenWarPipelineScript, true));
    mavenNbmBasePipeline.addTrigger(new WorkflowJobDependencyTrigger());
    WorkflowRun mavenWarPipelineFirstRun = jenkinsRule.assertBuildStatus(Result.SUCCESS, mavenNbmBasePipeline.scheduleBuild2(0));
    // TODO check in DB that the dependency on the war project is recorded
    System.out.println("build-nbm-dependencyFirstRun: " + mavenWarPipelineFirstRun);

    WorkflowRun mavenJarPipelineSecondRun = jenkinsRule.assertBuildStatus(Result.SUCCESS, mavenNbmDependency.scheduleBuild2(0));

    jenkinsRule.waitUntilNoActivity();

    WorkflowRun mavenWarPipelineLastRun = mavenNbmBasePipeline.getLastBuild();

    System.out.println("build-nbm-baseLastBuild: " + mavenWarPipelineLastRun + " caused by " + mavenWarPipelineLastRun.getCauses());

    assertThat(mavenWarPipelineLastRun.getNumber(), is(mavenWarPipelineFirstRun.getNumber() + 1));
    Cause.UpstreamCause upstreamCause = mavenWarPipelineLastRun.getCause(Cause.UpstreamCause.class);
    assertThat(upstreamCause, notNullValue());
}