Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ Note: Make sure MongoDB is running before starting mongo-express.
url: "https://your-jira-instance.com"
username: "your-username"
token: "your-api-token"
query: "project = FOO"

mongodb:
uri: "mongodb://admin:password@localhost:27017"
Expand Down
2 changes: 2 additions & 0 deletions config.yaml.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
jira:
url: "https://issues.redhat.com/"
query: |
project = OCPBUGS AND component in (Hypershift, "HyperShift / Agent", "HyperShift / ARO", "HyperShift / OCP Virtualization", "HyperShift / OpenStack", "HyperShift / ROSA") AND "Target Backport Versions" is not EMPTY AND issueLinkType not in ("depends on")
mongodb:
uri: "mongodb://mongodb:27017/"
database: "backport_dashboard"
Expand Down
8 changes: 7 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type Config struct {
Jira struct {
URL string `mapstructure:"url"`
Token string `mapstructure:"token"`
Query string `mapstructure:"query"`
} `mapstructure:"jira"`
MongoDB struct {
URI string `mapstructure:"uri"`
Expand Down Expand Up @@ -56,6 +57,11 @@ func loadConfig() (*Config, error) {
config.Server.Port = 8080
}

// Set default query if not provided
if config.Jira.Query == "" {
config.Jira.Query = `project = OCPBUGS AND component in (Hypershift, "HyperShift / Agent", "HyperShift / ARO", "HyperShift / OCP Virtualization", "HyperShift / OpenStack", "HyperShift / ROSA") AND "Target Backport Versions" is not EMPTY AND issueLinkType not in ("depends on")`
}

return &config, nil
}

Expand Down Expand Up @@ -263,7 +269,7 @@ func syncIssues(jiraClient *jira.Client, mongoClient *mongo.Client, config *Conf
updatedDocuments := make(map[string]bool)

// JQL query to get main issues
jql := `project = OCPBUGS AND component in (Hypershift, "HyperShift / Agent", "HyperShift / ARO", "HyperShift / OCP Virtualization", "HyperShift / OpenStack", "HyperShift / ROSA") AND "Target Backport Versions" is not EMPTY AND issueLinkType not in ("depends on")`
jql := config.Jira.Query

// Search issues in Jira
searchOptions := &jira.SearchOptions{
Expand Down
1 change: 1 addition & 0 deletions manifests/backport-dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ data:
jira:
url: https://issues.redhat.com
token: your-PAT-here
query: your-JQL-query-here
mongodb:
uri: "mongodb://mongodb:27017/"
database: backport_dashboard
Expand Down
1 change: 1 addition & 0 deletions manifests/backport-dashboard.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ data:
jira:
url: https://issues.redhat.com
token: your-PAT-here
query: your-JQL-query-here
mongodb:
uri: "mongodb://mongodb:27017/"
database: backport_dashboard
Expand Down