use of argelbargel.jenkins.plugins.gitlab_branch_source.actions.GitLabSCMCauseAction 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.actions.GitLabSCMCauseAction 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