sigs.k8s.io/prow@v0.0.0-20240503223140-c5e374dc7eb1/pkg/bugzilla/types.go (about) 1 /* 2 Copyright 2019 The Kubernetes Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package bugzilla 18 19 import "time" 20 21 // Bug is a record of a bug. See API documentation at: 22 // https://bugzilla.readthedocs.io/en/latest/api/core/v1/bug.html#get-bug 23 type Bug struct { 24 // ActualTime is the total number of hours that this bug has taken so far. If you are not in the time-tracking group, this field will not be included in the return value. 25 ActualTime int `json:"actual_time,omitempty"` 26 // Alias is the unique aliases of this bug. An empty array will be returned if this bug has no aliases. 27 Alias []string `json:"alias,omitempty"` 28 // AssignedTo is the login name of the user to whom the bug is assigned. 29 AssignedTo string `json:"assigned_to,omitempty"` 30 // AssignedToDetail is an object containing detailed user information for the assigned_to. To see the keys included in the user detail object, see below. 31 AssignedToDetail *User `json:"assigned_to_detail,omitempty"` 32 // Blocks is the IDs of bugs that are "blocked" by this bug. 33 Blocks []int `json:"blocks,omitempty"` 34 // CC is the login names of users on the CC list of this bug. 35 CC []string `json:"cc,omitempty"` 36 // CCDetail is array of objects containing detailed user information for each of the cc list members. To see the keys included in the user detail object, see below. 37 CCDetail []User `json:"cc_detail,omitempty"` 38 // Classification is the name of the current classification the bug is in. 39 Classification string `json:"classification,omitempty"` 40 // Component is an array of names of the current components of this bug. 41 Component []string `json:"component,omitempty"` 42 // CreationTime is when the bug was created. 43 CreationTime string `json:"creation_time,omitempty"` 44 // Creator is the login name of the person who filed this bug (the reporter). 45 Creator string `json:"creator,omitempty"` 46 // CreatorDetail is an object containing detailed user information for the creator. To see the keys included in the user detail object, see below. 47 CreatorDetail *User `json:"creator_detail,omitempty"` 48 // Deadline is the day that this bug is due to be completed, in the format YYYY-MM-DD. 49 Deadline string `json:"deadline,omitempty"` 50 // DependsOn is the IDs of bugs that this bug "depends on". 51 DependsOn []int `json:"depends_on,omitempty"` 52 // DupeOf is the bug ID of the bug that this bug is a duplicate of. If this bug isn't a duplicate of any bug, this will be null. 53 DupeOf int `json:"dupe_of,omitempty"` 54 // EstimatedTime is the number of hours that it was estimated that this bug would take. If you are not in the time-tracking group, this field will not be included in the return value. 55 EstimatedTime int `json:"estimated_time,omitempty"` 56 // Flags is an array of objects containing the information about flags currently set for the bug. Each flag objects contains the following items 57 Flags []Flag `json:"flags,omitempty"` 58 // Groups is the names of all the groups that this bug is in. 59 Groups []string `json:"groups,omitempty"` 60 // ID is the unique numeric ID of this bug. 61 ID int `json:"id,omitempty"` 62 // IsCCAccessible is if true, this bug can be accessed by members of the CC list, even if they are not in the groups the bug is restricted to. 63 IsCCAccessible bool `json:"is_cc_accessible,omitempty"` 64 // IsConfirmed is true if the bug has been confirmed. Usually this means that the bug has at some point been moved out of the UNCONFIRMED status and into another open status. 65 IsConfirmed bool `json:"is_confirmed,omitempty"` 66 // IsOpen is true if this bug is open, false if it is closed. 67 IsOpen bool `json:"is_open,omitempty"` 68 // IsCreatorAccessible is if true, this bug can be accessed by the creator of the bug, even if they are not a member of the groups the bug is restricted to. 69 IsCreatorAccessible bool `json:"is_creator_accessible,omitempty"` 70 // Keywords is each keyword that is on this bug. 71 Keywords []string `json:"keywords,omitempty"` 72 // LastChangeTime is when the bug was last changed. 73 LastChangeTime string `json:"last_change_time,omitempty"` 74 // OperatingSystem is the name of the operating system that the bug was filed against. 75 OperatingSystem string `json:"op_sys,omitempty"` 76 // Platform is the name of the platform (hardware) that the bug was filed against. 77 Platform string `json:"platform,omitempty"` 78 // Priority is the priority of the bug. 79 Priority string `json:"priority,omitempty"` 80 // Product is the name of the product this bug is in. 81 Product string `json:"product,omitempty"` 82 // QAContact is the login name of the current QA Contact on the bug. 83 QAContact string `json:"qa_contact,omitempty"` 84 // QAContactDetail is an object containing detailed user information for the qa_contact. To see the keys included in the user detail object, see below. 85 QAContactDetail *User `json:"qa_contact_detail,omitempty"` 86 // RemainingTime is the number of hours of work remaining until work on this bug is complete. If you are not in the time-tracking group, this field will not be included in the return value. 87 RemainingTime int `json:"remaining_time,omitempty"` 88 // Resolution is the current resolution of the bug, or an empty string if the bug is open. 89 Resolution string `json:"resolution,omitempty"` 90 // SeeAlso is the URLs in the See Also field on the bug. 91 SeeAlso []string `json:"see_also,omitempty"` 92 // Severity is the current severity of the bug. 93 Severity string `json:"severity,omitempty"` 94 // Status is the current status of the bug. 95 Status string `json:"status,omitempty"` 96 // Summary is the summary of this bug. 97 Summary string `json:"summary,omitempty"` 98 // TargetMilestone is the milestone that this bug is supposed to be fixed by, or for closed bugs, the milestone that it was fixed for. 99 TargetMilestone string `json:"target_milestone,omitempty"` 100 // TargetRelease are the releases that the bug will be fixed in. 101 TargetRelease []string `json:"target_release,omitempty"` 102 // UpdateToken is the token that you would have to pass to the process_bug.cgi page in order to update this bug. This changes every time the bug is updated. This field is not returned to logged-out users. 103 UpdateToken string `json:"update_token,omitempty"` 104 // URL is a URL that demonstrates the problem described in the bug, or is somehow related to the bug report. 105 URL string `json:"url,omitempty"` 106 // Verified is a custom field in redhat bugzilla that indicates the status of verification by QA 107 Verified []string `json:"cf_verified,omitempty"` 108 // Version are the versions the bug was reported against. 109 Version []string `json:"version,omitempty"` 110 // Whiteboard is he value of the "status whiteboard" field on the bug. 111 Whiteboard string `json:"whiteboard,omitempty"` 112 // PRs holds the links to the pull requests associated with the bug. 113 PRs []ExternalBug `json:"external_bug,omitempty"` 114 } 115 116 // BugCreate holds the info needed to create a new bug 117 // https://bugzilla.readthedocs.io/en/latest/api/core/v1/bug.html#create-bug 118 type BugCreate struct { 119 // Alias is an optional list of unique aliases of this bug. 120 Alias []string `json:"alias,omitempty"` 121 // AssignedTo is the login name of the user to whom the bug is assigned. 122 AssignedTo string `json:"assigned_to,omitempty"` 123 // CC is the login names of users on the CC list of this bug. 124 CC []string `json:"cc,omitempty"` 125 // CommentIsPrivate sets the description to private. Otherwise it is assumed to be public. 126 CommentIsPrivate bool `json:"comment_is_private,omitempty"` 127 // CommentTags is an array of strings to add as comment tags for the description 128 CommentTags []string `json:"comment_tags,omitempty"` 129 // Component is an array of names of the current components of this bug. 130 Component []string `json:"component,omitempty"` 131 // Description is the initial description for this bug 132 Description string `json:"description,omitempty"` 133 // Flags is an array of objects containing the information about flags currently set for the bug. 134 Flags []Flag `json:"flags,omitempty"` 135 // Groups is the names of all the groups that this bug is in. 136 Groups []string `json:"groups,omitempty"` 137 // IsMarkdown should be set if the description has Markdown structures; otherwise it is normal text. 138 IsMarkdown bool `json:"is_markdown,omitempty"` 139 // Keywords is each keyword that is on this bug. 140 Keywords []string `json:"keywords,omitempty"` 141 // OperatingSystem is the name of the operating system that the bug was filed against. 142 OperatingSystem string `json:"op_sys,omitempty"` 143 // Platform is the name of the platform (hardware) that the bug was filed against. 144 Platform string `json:"platform,omitempty"` 145 // Priority is the priority of the bug. 146 Priority string `json:"priority,omitempty"` 147 // Product is the name of the product this bug is in. 148 Product string `json:"product,omitempty"` 149 // QAContact is the login name of the current QA Contact on the bug. 150 QAContact string `json:"qa_contact,omitempty"` 151 // Resolution is the current resolution of the bug, or an empty string if the bug is open. 152 Resolution string `json:"resolution,omitempty"` 153 // Severity is the current severity of the bug. 154 Severity string `json:"severity,omitempty"` 155 // Status is the current status of the bug. 156 Status string `json:"status,omitempty"` 157 // SubComponents are the subcomponents of the component for the bug. The key is the Component name, while the value is an array of length 1 containing the subcomponent name. 158 // This is a Red Hat bugzilla specific extra field. 159 SubComponents map[string][]string `json:"sub_components,omitempty"` 160 // Summary is the summary of this bug. 161 Summary string `json:"summary,omitempty"` 162 // TargetMilestone is the milestone that this bug is supposed to be fixed by, or for closed bugs, the milestone that it was fixed for. 163 TargetMilestone string `json:"target_milestone,omitempty"` 164 // Version are the versions the bug was reported against. 165 Version []string `json:"version,omitempty"` 166 // TargetRelease are the releases that the bug will be fixed in. 167 TargetRelease []string `json:"target_release,omitempty"` 168 } 169 170 // Comment holds information about a comment 171 type Comment struct { 172 // ID is the globally unique ID for the comment. 173 ID int `json:"id,omitempty"` 174 // BugID is the ID of the bug that this comment is on. 175 BugID int `json:"bug_id,omitempty"` 176 // AttachmentID is the ID of the attachment if this comment was made on an attachment. 177 AttachmentID *int `json:"attachment_id,omitempty"` 178 // Count is the number of the comment local to the bug. The Description is 0, comments start with 1. 179 Count int `json:"count,omitempty"` 180 // Text is the actual text of the comment. 181 Text string `json:"text,omitempty"` 182 // Creator is the login name of the comment's author. 183 Creator string `json:"creator,omitempty"` 184 // Time is the time (in Bugzilla's timezone) that the comment was added. 185 Time time.Time `json:"time,omitempty"` 186 // CreationTime is exactly same as the time key. Use this field instead of time for consistency with other methods including Get Bug and Get Attachment. 187 // For compatibility, time is still usable. However, please note that time may be deprecated and removed in a future release. 188 CreationTime time.Time `json:"creation_time,omitempty"` 189 // IsPrivate is true if this comment is private (only visible to a certain group called the "insidergroup"), false otherwise. 190 IsPrivate bool `json:"is_private,omitempty"` 191 // IsMarkdown is true if this comment needs Markdown processing; false otherwise. 192 IsMarkdown bool `json:"is_markdown,omitempty"` 193 // Tags is an array of comment tags currently set for the comment. 194 Tags []string `json:"tags,omitempty"` 195 } 196 197 // CommentCreate holds information needed to create a comment 198 type CommentCreate struct { 199 // ID is the ID of the bug this comment is on. 200 ID int `json:"id,omitempty"` 201 // Comment is the text of the comment being created. 202 Comment string `json:"comment,omitempty"` 203 // IsPrivate is true if this comment is private (only visible to a certain group called the "insidergroup"), false otherwise. 204 IsPrivate bool `json:"is_private,omitempty"` 205 } 206 207 // User holds information about a user 208 type User struct { 209 // The user ID for this user. 210 ID int `json:"id,omitempty"` 211 // The 'real' name for this user, if any. 212 RealName string `json:"real_name,omitempty"` 213 // The user's Bugzilla login. 214 Name string `json:"name,omitempty"` 215 // The user's e-mail. 216 Email string `json:"email,omitempty"` 217 } 218 219 // Flag holds information about a flag set on a bug 220 type Flag struct { 221 // The ID of the flag. 222 ID int `json:"id,omitempty"` 223 // The name of the flag. 224 Name string `json:"name,omitempty"` 225 // The type ID of the flag. 226 TypeID int `json:"type_id,omitempty"` 227 // The timestamp when this flag was originally created. 228 CreationDate string `json:"creation_date,omitempty"` 229 // The timestamp when the flag was last modified. 230 ModificationDate string `json:"modification_date,omitempty"` 231 // The current status of the flag. 232 Status string `json:"status,omitempty"` 233 // The login name of the user who created or last modified the flag. 234 Setter string `json:"setter,omitempty"` 235 // The login name of the user this flag has been requested to be granted or denied. Note, this field is only returned if a requestee is set. 236 Requestee string `json:"requestee,omitempty"` 237 } 238 239 // BugUpdate contains fields to update on a Bug. See API documentation at: 240 // https://bugzilla.readthedocs.io/en/latest/api/core/v1/bug.html#update-bug 241 type BugUpdate struct { 242 // DependsOn specifies the bugs that this bug depends on 243 DependsOn *IDUpdate `json:"depends_on,omitempty"` 244 Blocks *IDUpdate `json:"blocks,omitempty"` 245 Resolution string `json:"resolution,omitempty"` 246 // Status is the current status of the bug. 247 Status string `json:"status,omitempty"` 248 // TargetRelease is the release version this bugfix is targeting 249 TargetRelease []string `json:"target_release,omitempty"` 250 // Version is the version the bug was reported against. 251 Version string `json:"version,omitempty"` 252 // The Status Whiteboard field of a bug. 253 Whiteboard string `json:"whiteboard,omitempty"` 254 } 255 256 // IDUpdate is the struct used in Update calls to update fields that are arrays of IDs (ex. DependsOn) 257 type IDUpdate struct { 258 // Add contains Bug IDs to add to this field. 259 Add []int `json:"add,omitempty"` 260 // Remove specifies Bug IDs to remove from this field. If the bug IDs are not already in the field, they will be ignored. 261 Remove []int `json:"remove,omitempty"` 262 // Set is An exact set of bug IDs to set this field to, overriding the current value. If Set is specified, then Add and Remove will be ignored. 263 Set []int `json:"set,omitempty"` 264 } 265 266 // ExternalBug contains details about an external bug linked to a Bugzilla bug. 267 // See API documentation at: 268 // https://bugzilla.redhat.com/docs/en/html/integrating/api/Bugzilla/Extension/ExternalBugs/WebService.html 269 type ExternalBug struct { 270 // Type holds more metadata for the external bug tracker 271 Type ExternalBugType `json:"type"` 272 // BugzillaBugID is the ID of the Bugzilla bug this external bug is linked to 273 BugzillaBugID int `json:"bug_id"` 274 // ExternalBugID is a unique identifier for the bug under the tracker 275 ExternalBugID string `json:"ext_bz_bug_id"` 276 // The following fields are parsed from the external bug identifier 277 Org, Repo string 278 Num int 279 // Status holds the status of the PR (ie closed, merged, open) 280 Status string `json:"ext_status"` 281 } 282 283 // ExternalBugType holds identifying metadata for a tracker 284 type ExternalBugType struct { 285 // URL is the identifying URL for this tracker 286 URL string `json:"url"` 287 } 288 289 // AddExternalBugParameters are the parameters required to add an external 290 // tracker bug to a Bugzilla bug 291 type AddExternalBugParameters struct { 292 // BugIDs are the IDs of Bugzilla bugs to update 293 BugIDs []int `json:"bug_ids"` 294 // ExternalBugs are the external bugs to add 295 ExternalBugs []ExternalBugIdentifier `json:"external_bugs"` 296 } 297 298 // ExternalBugIdentifier holds fields used to identify external bugs when 299 // modifying them using the JSONRPC API 300 type ExternalBugIdentifier struct { 301 // Type is the URL prefix that identifies the external bug tracker type. 302 // For GitHub, this is commonly https://github.com/ 303 Type string `json:"ext_type_url,omitempty"` 304 // TrackerID is the internal identifier for the external bug tracker type. 305 // This should be passed instead of the ext_type_url when there is more 306 // than one external tracker for https://github.com/ 307 TrackerID int `json:"ext_type_id,omitempty"` 308 // ID is the identifier of the external bug within the bug tracker type. 309 // For GitHub issues and pull requests, this ID is commonly the path 310 // like `org/repo/pull/number` or `org/repo/issue/number`. 311 ID string `json:"ext_bz_bug_id"` 312 } 313 314 // RemoveExternalBugParameters are the parameters required to remove an external 315 // tracker bug from a Bugzilla bug 316 type RemoveExternalBugParameters struct { 317 // BugIDs are the IDs of Bugzilla bugs to update 318 BugIDs []int `json:"bug_ids"` 319 // The inline identifier for which external bug to remove 320 ExternalBugIdentifier 321 }