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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Finds untriaged, unassigned Shiftstack bugs and assigns them to a team member.

Required environment variables:

* `JIRA_TOKEN`: a [Jira API token](https://issues.redhat.com/secure/ViewProfile.jspa?selectedTab=com.atlassian.pats.pats-plugin:jira-user-personal-access-tokens) of an account that can access the OCPBUGS project
* `JIRA_TOKEN`: a [Jira API token](https://id.atlassian.com/manage-profile/security/api-tokens) of an account that can access the OCPBUGS project
* `SLACK_HOOK`: a [Slack hook](https://api.slack.com/messaging/webhooks) URL
* `PEOPLE`: an address book. It is a YAML object in the form:

Expand Down Expand Up @@ -59,7 +59,7 @@ Reminds assignees about the bugs assigned to them for triage.

Required environment variables:

* `JIRA_TOKEN`: a [Jira API token](https://issues.redhat.com/secure/ViewProfile.jspa?selectedTab=com.atlassian.pats.pats-plugin:jira-user-personal-access-tokens) of an account that can access the OCPBUGS project
* `JIRA_TOKEN`: a [Jira API token](https://id.atlassian.com/manage-profile/security/api-tokens) of an account that can access the OCPBUGS project
* `SLACK_HOOK`: a [Slack hook](https://api.slack.com/messaging/webhooks) URL
* `PEOPLE` described [above][pretriage].

Expand All @@ -75,7 +75,7 @@ Resets the `Triaged` keyword on bugs that still need attention.

Required environment variables:

* `JIRA_TOKEN`: a [Jira API token](https://issues.redhat.com/secure/ViewProfile.jspa?selectedTab=com.atlassian.pats.pats-plugin:jira-user-personal-access-tokens) of an account that can access the OCPBUGS project
* `JIRA_TOKEN`: a [Jira API token](https://id.atlassian.com/manage-profile/security/api-tokens) of an account that can access the OCPBUGS project

## doctext

Expand All @@ -89,6 +89,6 @@ Finds resolved bugs lacking a doc text, and posts a reminder to Slack.

Required environment variables:

* `JIRA_TOKEN`: a [Jira API token](https://issues.redhat.com/secure/ViewProfile.jspa?selectedTab=com.atlassian.pats.pats-plugin:jira-user-personal-access-tokens) of an account that can access the OCPBUGS project
* `JIRA_TOKEN`: a [Jira API token](https://id.atlassian.com/manage-profile/security/api-tokens) of an account that can access the OCPBUGS project
* `SLACK_HOOK`: a [Slack hook](https://api.slack.com/messaging/webhooks) URL
* `PEOPLE` described [above][pretriage].
12 changes: 6 additions & 6 deletions cmd/doctext/checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ func docTextCheck(issue jira.Issue) (bool, string, error) {
// We must set the type and (optionally) the text for release notes. The
// text must always be set unless the type is "No Doc Update".
//
// Release Note Type -> customfield_12320850
// Release Note Text -> customfield_12317313
// Release Note Type -> customfield_10785
// Release Note Text -> customfield_10783

if issue.Fields.Unknowns["customfield_12320850"] != nil {
releaseNoteType, ok := issue.Fields.Unknowns["customfield_12320850"].(map[string]any)
if issue.Fields.Unknowns["customfield_10785"] != nil {
releaseNoteType, ok := issue.Fields.Unknowns["customfield_10785"].(map[string]any)
if !ok {
return false, "", fmt.Errorf("failed to parse release note type for issue %s", issue.Key)
}
releaseNoteText := issue.Fields.Unknowns["customfield_12317313"]
releaseNoteText := issue.Fields.Unknowns["customfield_10783"]

if releaseNoteType["id"] == "31862" { // No Doc Update
if releaseNoteType["id"] == "12510" { // Release Note Not Required
return true, "", nil
}
if releaseNoteText != nil {
Expand Down
22 changes: 11 additions & 11 deletions cmd/posttriage/checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
type triageCheck func(jira.Issue) (triaged bool, msg string, err error)

func isNotBug(issue jira.Issue) bool {
// Taken from https://issues.redhat.com/rest/api/2/resolution
// Taken from https://redhat.atlassian.net/rest/api/2/resolution
if issue.Fields.Resolution != nil {
switch issue.Fields.Resolution.Name {
case "Won't Do", "Cannot Reproduce", "Can't Do", "Duplicate", "Not a Bug", "Obsolete":
Expand Down Expand Up @@ -47,22 +47,22 @@ type releaseBlocker string
// ReleaseBlockerFromIssue parses releaseBlocker information from a Jira issue.
func ReleaseBlockerFromIssue(issue jira.Issue) (releaseBlocker, error) {
// https://confluence.atlassian.com/jirakb/how-to-find-any-custom-field-s-ids-744522503.html
if issue.Fields.Unknowns["customfield_12319743"] == nil {
if issue.Fields.Unknowns["customfield_10847"] == nil {
return releaseBlockerNone, nil
}

releaseBlockerMap, ok := issue.Fields.Unknowns["customfield_12319743"].(map[string]any)
releaseBlockerMap, ok := issue.Fields.Unknowns["customfield_10847"].(map[string]any)
if !ok {
return releaseBlockerNone, fmt.Errorf("failed to parse (not a map)")
}

// https://confluence.atlassian.com/jirakb/how-to-retrieve-available-options-for-a-multi-select-customfield-via-jira-rest-api-815566715.html
switch releaseBlockerMap["id"] {
case "25755":
case "16772":
return releaseBlockerApproved, nil
case "25756":
case "16773":
return releaseBlockerProposed, nil
case "25757":
case "16774":
return releaseBlockerRejected, nil
default:
return releaseBlockerNone, fmt.Errorf("unknown Release Blocker value: %s", releaseBlockerMap["id"])
Expand Down Expand Up @@ -93,11 +93,11 @@ type testCoverage byte
// TestCoverageFromIssue parses testCoverage information from a Jira issue.
func TestCoverageFromIssue(issue jira.Issue) (testCoverage, error) {
// https://confluence.atlassian.com/jirakb/how-to-find-any-custom-field-s-ids-744522503.html
if issue.Fields.Unknowns["customfield_12320940"] == nil {
if issue.Fields.Unknowns["customfield_10638"] == nil {
return testCoverageNone, nil
}

testCoverageSlice, err := issue.Fields.Unknowns.Slice("customfield_12320940")
testCoverageSlice, err := issue.Fields.Unknowns.Slice("customfield_10638")
if err != nil {
return testCoverageNone, err
}
Expand All @@ -112,11 +112,11 @@ func TestCoverageFromIssue(issue jira.Issue) (testCoverage, error) {

// https://confluence.atlassian.com/jirakb/how-to-retrieve-available-options-for-a-multi-select-customfield-via-jira-rest-api-815566715.html
switch testCoverageMap["id"] {
case "27678":
case "15875":
return testCoverageAutomated, nil
case "27679":
case "15876":
return testCoverageManual, nil
case "27680":
case "15877":
return testCoverageNoCoverage, nil
default:
return testCoverageNone, fmt.Errorf("unknown test coverage value: %s", testCoverageMap["id"])
Expand Down
2 changes: 1 addition & 1 deletion cmd/pretriage/cve.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

// CVEFieldID is the JIRA custom field ID for the CVE identifier
const CVEFieldID = "customfield_12324749"
const CVEFieldID = "customfield_10667"

// CVEGroup represents a group of related CVE issues
type CVEGroup struct {
Expand Down
1 change: 1 addition & 0 deletions cmd/pretriage/isbackport.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
jira "github.com/andygrunwald/go-jira"
)

// FIXME(mandre) I can't find the new jira ID for this field :-/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checking the API I believe the new ID for that is 10000

const isBlockedBy = "12310720"

// returns the first detected blocking issue. Note that the returned Jira issue
Expand Down
4 changes: 2 additions & 2 deletions cmd/pretriage/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ func main() {
"set": map[string]any{"name": "Normal"},
},
},
"customfield_12320850": []map[string]any{ // Release Note Type
"customfield_10785": []map[string]any{ // Release Note Type
{
"set": map[string]any{"value": "Release Note Not Required"},
},
},
"customfield_12320940": []map[string]any{ // Test Coverage
"customfield_10638": []map[string]any{ // Test Coverage
{
"set": []map[string]any{
{"value": "-"},
Expand Down
2 changes: 1 addition & 1 deletion pkg/query/query.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package query

const JiraBaseURL = "https://issues.redhat.com/"
const JiraBaseURL = "https://redhat.atlassian.net/"

const ShiftStack = `project = "OpenShift Bugs"
AND (
Expand Down