use of argelbargel.jenkins.plugins.gitlab_branch_source.heads.GitLabSCMHead in project gitlab-branch-source-plugin by Argelbargel.
the class GitLabSCMSource method build.
@Nonnull
@Override
public SCM build(@Nonnull SCMHead head, @CheckForNull SCMRevision revision) {
GitSCM scm;
if (head instanceof GitLabSCMHead) {
scm = ((GitLabSCMHead) head).createSCM(this);
if (revision instanceof SCMRevisionImpl) {
scm.getExtensions().add(new BuildChooserSetting(new SpecificRevisionBuildChooser((SCMRevisionImpl) revision)));
}
} else {
scm = (GitSCM) super.build(head, revision);
scm.setBrowser(getBrowser());
}
return scm;
}
use of argelbargel.jenkins.plugins.gitlab_branch_source.heads.GitLabSCMHead in project gitlab-branch-source-plugin by Argelbargel.
the class SourceActions method retrieve.
@Nonnull
private List<Action> retrieve(@Nonnull SCMRevisionImpl revision, @CheckForNull SCMHeadEvent event, @Nonnull TaskListener listener) throws IOException, InterruptedException {
List<Action> actions = new ArrayList<>();
String hash = revision.getHash();
Action linkAction = GitLabLinkAction.toCommit(source.getProject(), hash);
actions.add(linkAction);
SCMHead head = revision.getHead();
if (head instanceof GitLabSCMMergeRequestHead) {
actions.add(createHeadMetadataAction(head.getName(), ((GitLabSCMMergeRequestHead) head).getSource(), hash, linkAction.getUrlName()));
} else if (head instanceof GitLabSCMHead) {
actions.add(createHeadMetadataAction(head.getName(), (GitLabSCMHead) head, hash, linkAction.getUrlName()));
}
if (event instanceof GitLabSCMEvent) {
actions.add(new GitLabSCMCauseAction(((GitLabSCMEvent) event).getCause()));
}
return actions;
}
use of argelbargel.jenkins.plugins.gitlab_branch_source.heads.GitLabSCMHead in project gitlab-branch-source-plugin by Argelbargel.
the class GitLabSCMMergeRequestEvent method heads.
@Override
Collection<? extends GitLabSCMHead> heads(@Nonnull GitLabSCMSource source) throws IOException, InterruptedException {
Collection<GitLabSCMHead> heads = new ArrayList<>();
MergeRequestObjectAttributes attributes = getAttributes();
Integer sourceProjectId = attributes.getSourceProjectId();
String sourceBranch = attributes.getSourceBranch();
String hash = attributes.getLastCommit().getId();
GitLabSCMMergeRequestHead head = createMergeRequest(attributes.getIid(), attributes.getTitle(), attributes.getIid(), createBranch(sourceProjectId, sourceBranch, hash), createBranch(attributes.getTargetProjectId(), attributes.getTargetBranch(), REVISION_HEAD));
if (source.getSourceSettings().buildUnmerged(head)) {
heads.add(head);
}
if (source.getSourceSettings().buildMerged(head)) {
heads.add(head.merged());
}
if (head.fromOrigin()) {
heads.add(createBranch(sourceProjectId, sourceBranch, hash));
}
return heads;
}
Aggregations