Skip to content

Commit

Permalink
feat: jira accept issue-type and project ids (#5537)
Browse files Browse the repository at this point in the history
* feat: jira accept issue-type and project ids

* remove validation for project name

---------

Co-authored-by: sandeep <8293321+ehsandeep@users.noreply.github.com>
  • Loading branch information
Ice3man543 and ehsandeep authored Aug 19, 2024
1 parent 02fadbc commit 80b3cc0
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pkg/reporting/trackers/jira/jira.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,13 @@ type Options struct {
// Token is the token for jira instance.
Token string `yaml:"token" json:"token" validate:"required"`
// ProjectName is the name of the project.
ProjectName string `yaml:"project-name" json:"project_name" validate:"required"`
ProjectName string `yaml:"project-name" json:"project_name"`
// ProjectID is the ID of the project (optional)
ProjectID string `yaml:"project-id" json:"project_id"`
// IssueType (optional) is the name of the created issue type
IssueType string `yaml:"issue-type" json:"issue_type"`
// IssueTypeID (optional) is the ID of the created issue type
IssueTypeID string `yaml:"issue-type-id" json:"issue_type_id"`
// SeverityAsLabel (optional) sends the severity as the label of the created
// issue.
SeverityAsLabel bool `yaml:"severity-as-label" json:"severity_as_label"`
Expand Down Expand Up @@ -183,6 +187,7 @@ func (i *Integration) CreateNewIssue(event *output.ResultEvent) (*filters.Create
Project: jira.Project{Key: i.options.ProjectName},
Summary: summary,
}

// On-prem version of Jira server does not use AccountID
if !i.options.Cloud {
fields = &jira.IssueFields{
Expand All @@ -195,6 +200,12 @@ func (i *Integration) CreateNewIssue(event *output.ResultEvent) (*filters.Create
Unknowns: customFields,
}
}
if i.options.IssueTypeID != "" {
fields.Type = jira.IssueType{ID: i.options.IssueTypeID}
}
if i.options.ProjectID != "" {
fields.Project = jira.Project{ID: i.options.ProjectID}
}

issueData := &jira.Issue{
Fields: fields,
Expand Down

0 comments on commit 80b3cc0

Please sign in to comment.