use of hudson.plugins.jira.JiraRestService.BUG_ISSUE_TYPE_ID in project jira-plugin by jenkinsci.
the class JiraCreateIssueNotifier method createJiraIssue.
/**
* It creates a issue in the given project, with the given description, assignee,components and summary.
* The created issue ID is saved to the file at "filename".
*
* @param build
* @param filename
* @return issue id
* @throws IOException
* @throws InterruptedException
*/
private Issue createJiraIssue(AbstractBuild<?, ?> build, String filename) throws IOException, InterruptedException {
EnvVars vars = build.getEnvironment(TaskListener.NULL);
JiraSession session = getJiraSession(build);
String buildName = getBuildName(vars);
String summary = String.format("Build %s failed", buildName);
String description = String.format("%s\n\nThe build %s has failed.\nFirst failed run: %s", (this.testDescription.equals("")) ? "No description is provided" : vars.expand(this.testDescription), buildName, getBuildDetailsString(vars));
Iterable<String> components = Arrays.stream(component.split(",")).filter(s -> !StringUtils.isEmpty(s)).map(s -> StringUtils.trim(s)).collect(Collectors.toList());
Long type = typeId;
if (type == null || type == 0) {
// zero is default / invalid selection
LOG.info("Returning default issue type id " + BUG_ISSUE_TYPE_ID);
type = BUG_ISSUE_TYPE_ID;
}
Long priority = priorityId;
if (priority != null && priority == 0) {
// remove invalid priority selection
priority = null;
}
Issue issue = session.createIssue(projectKey, description, assignee, components, summary, type, priority);
writeInFile(filename, issue);
return issue;
}
Aggregations