use of argelbargel.jenkins.plugins.gitlab_branch_source.actions.GitLabSCMPublishAction in project gitlab-branch-source-plugin by Argelbargel.
the class GitLabSCMRunListener method onCompleted.
@Override
public void onCompleted(Run<?, ?> build, @Nonnull TaskListener listener) {
GitLabSCMHeadMetadataAction metadata = getMetadataAction(build);
GitLabSCMPublishAction publishAction = build.getParent().getAction(GitLabSCMPublishAction.class);
if (metadata != null && publishAction != null) {
publishAction.publishResult(build, metadata);
}
if (build.getResult() == SUCCESS) {
GitLabSCMAcceptMergeRequestAction acceptAction = build.getParent().getAction(GitLabSCMAcceptMergeRequestAction.class);
if (acceptAction != null) {
acceptAction.acceptMergeRequest(build, listener);
}
}
}
use of argelbargel.jenkins.plugins.gitlab_branch_source.actions.GitLabSCMPublishAction in project gitlab-branch-source-plugin by Argelbargel.
the class SourceActions method retrieve.
@Nonnull
private List<Action> retrieve(@Nonnull GitLabSCMHead head, @CheckForNull SCMHeadEvent event, @Nonnull TaskListener listener) throws IOException, InterruptedException {
List<Action> actions = new ArrayList<>();
actions.add(new GitLabSCMPublishAction(head, source.getSourceSettings()));
Action linkAction;
if (head instanceof ChangeRequestSCMHead) {
GitLabMergeRequest mr = retrieveMergeRequest((ChangeRequestSCMHead) head, listener);
linkAction = GitLabLinkAction.toMergeRequest(mr.getWebUrl());
actions.add(createAuthorMetadataAction(mr));
actions.add(createHeadMetadataAction(((GitLabSCMMergeRequestHead) head).getDescription(), ((GitLabSCMMergeRequestHead) head).getSource(), null, linkAction.getUrlName()));
if (acceptMergeRequest(head)) {
boolean removeSourceBranch = mr.getRemoveSourceBranch() || removeSourceBranch(head);
actions.add(new GitLabSCMAcceptMergeRequestAction(mr, mr.getIid(), source.getSourceSettings().getMergeCommitMessage(), removeSourceBranch));
}
} else {
linkAction = (head instanceof TagSCMHead) ? GitLabLinkAction.toTag(source.getProject(), head.getName()) : GitLabLinkAction.toBranch(source.getProject(), head.getName());
if (head instanceof GitLabSCMBranchHead && StringUtils.equals(source.getProject().getDefaultBranch(), head.getName())) {
actions.add(new PrimaryInstanceMetadataAction());
}
}
actions.add(linkAction);
return actions;
}
use of argelbargel.jenkins.plugins.gitlab_branch_source.actions.GitLabSCMPublishAction in project gitlab-branch-source-plugin by Argelbargel.
the class GitLabSCMRunListener method onStarted.
@Override
public void onStarted(Run<?, ?> build, TaskListener listener) {
GitLabSCMHeadMetadataAction metadata = getMetadataAction(build);
GitLabSCMPublishAction publishAction = build.getParent().getAction(GitLabSCMPublishAction.class);
if (metadata != null && publishAction != null) {
GitLabSCMCauseAction cause = build.getAction(GitLabSCMCauseAction.class);
String description = (cause != null) ? cause.getDescription() : "";
publishAction.updateBuildDescription(build, description, listener);
publishAction.publishStarted(build, metadata, description);
}
}
Aggregations