_sourceBranch = gitlabMergeRequest.getSourceBranch();
}
if (_sourceProject == null) {
try {
GitlabAPI api = _builder.getGitlab().get();
_sourceProject = getSourceProject(gitlabMergeRequest, api);
} catch (IOException e) {
_logger.log(Level.SEVERE, "Failed to get source project for Merge request " + gitlabMergeRequest.getId() + " :\n" + e.getMessage());
return;
}
}
if (isAllowedByTargetBranchRegex(_targetBranch)) {
_logger.log(Level.INFO, "The target regex matches the target branch {" + _targetBranch + "}. Source branch {" + _sourceBranch + "}");
_shouldRun = true;
} else {
_logger.log(Level.INFO, "The target regex did not match the target branch {" + _targetBranch + "}. Not triggering this job. Source branch {" + _sourceBranch + "}");
return;
}
try {
GitlabAPI api = _builder.getGitlab().get();
GitlabNote lastJenkinsNote = getJenkinsNote(gitlabMergeRequest, api);
GitlabCommit latestCommit = getLatestCommit(gitlabMergeRequest, api);
if (lastJenkinsNote == null) {
_logger.info("Latest note from Jenkins is null");