bugzilla

package
v0.0.0-...-b322a3a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 20, 2022 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package bugzilla can get bugs, attachments and update them Instead of the nice XMLRPC interface, it uses the web interface, in order to allow changing flags (AFAIR) not available in the API.

Index

Constants

This section is empty.

Variables

View Source
var PriorityMap = map[string]string{
	"P0": "P0 - Crit Sit",
	"P1": "P1 - Urgent",
	"P2": "P2 - High",
	"P3": "P3 - Medium",
	"P4": "P4 - Low",
	"P5": "P5 - None",
}

PriorityMap maps short priority names to the longer ones, as provided by the Web Interface

Functions

This section is empty.

Types

type Attachment

type Attachment struct {
	IsObsolete int       `xml:"isobsolete,attr" json:"isobsolete"`
	IsPatch    int       `xml:"ispatch,attr" json:"ispatch"`
	IsPrivate  int       `xml:"isprivate,attr" json:"isprivate"`
	AttachID   int       `xml:"attachid" json:"attachid"`
	Date       time.Time // `xml:"date" json:"date"`
	DeltaTS    time.Time // `xml:"delta_ts" json:"delta_ts"`
	Desc       string    `xml:"desc" json:"desc"`
	Filename   string    `xml:"filename" json:"filename"`
	Type       string    `xml:"type" json:"type"`
	Size       int       `xml:"size" json:"size"`
	Attacher   User      `xml:"attacher" json:"attacher"`
	Token      string    `xml:"token" json:"token"`
}

Attachment as provided by the bug information page. This struct has only name, size and attachid set when coming from DownloadAttachment, as it's extracted from the HTTP headers.

type Bug

type Bug struct {
	Reporter   User `xml:"reporter" json:"reporter"`
	AssignedTo User `xml:"assigned_to" json:"assigned_to"`
	QAContact  User `xml:"qa_contact" json:"qa_contact"`

	Groups []Group `xml:"group" json:"group"`

	BugID              int       `xml:"bug_id" json:"bug_id"`                           // 1047068
	CreationTS         time.Time `json:"creation_ts"`                                   // 2017-07-03 13:29:00 +0000
	ShortDesc          string    `xml:"short_desc" json:"short_desc"`                   // L4: test cloud bug
	DeltaTS            time.Time `json:"delta_ts"`                                      // 2019-03-27 10:45:20 +0000
	ReporterAccessible int       `xml:"reporter_accessible" json:"reporter_accessible"` // 0
	CCListAccessible   int       `xml:"cclist_accessible" json:"cclist_accessible"`     // 0
	ClassificationID   int       `xml:"classification_id" json:"classification_id"`     // 111
	Classification     string    `xml:"classification" json:"classification"`           // foobar Frobnicator Cloud
	Product            string    `xml:"product" json:"product"`                         // foobar Frobnicator Cloud 7
	Component          string    `xml:"component" json:"component"`                     // Frobtool
	Version            string    `xml:"version" json:"version"`                         // Milestone 8
	RepPlatform        string    `xml:"rep_platform" json:"rep_platform"`               // Other
	OpSys              string    `xml:"op_sys" json:"op_sys"`                           // Other
	BugStatus          string    `xml:"bug_status" json:"bug_status"`                   // RESOLVED
	Resolution         string    `xml:"resolution" json:"resolution"`                   // FIXED
	DupID              int       `xml:"dup_id" json:"dup_id"`

	BugFileLoc       string `xml:"bug_file_loc" json:"bug_file_loc"`           //
	StatusWhiteboard string `xml:"status_whiteboard" json:"status_whiteboard"` // wasL3:48626  zzz
	Keywords         string `xml:"keywords" json:"keywords"`                   // DSLA_REQUIRED, DSLA_SOLUTION_PROVIDED
	Priority         string `xml:"priority" json:"priority"`                   // P5 - None
	BugSeverity      string `xml:"bug_severity" json:"bug_severity"`           // Normal
	TargetMilestone  string `xml:"target_milestone" json:"target_milestone"`   // ---

	EverConfirmed int      `xml:"everconfirmed" json:"everconfirmed"`   // 1
	Cc            []string `xml:"cc" json:"cc"`                         // user@foobar.com
	EstimatedTime string   `xml:"estimated_time" json:"estimated_time"` // 0.00
	RemainingTime string   `xml:"remaining_time" json:"remaining_time"` // 0.00
	ActualTime    string   `xml:"actual_time" json:"actual_time"`       // 0.00

	CfFoundby       []string `xml:"cf_foundby" json:"cf_foundby"`             // ---
	CfNtsPriority   []string `xml:"cf_nts_priority" json:"cf_nts_priority"`   //
	CfBizPriority   []string `xml:"cf_biz_priority" json:"cf_biz_priority"`   //
	CfBlocker       []string `xml:"cf_blocker" json:"cf_blocker"`             // ---
	CfIITDeployment []string `xml:"cf_it_deployment" json:"cf_it_deployment"` // ---
	Token           []string `xml:"token" json:"token"`

	Votes int `xml:"votes" json:"votes"` // 0

	Flags []Flag `xml:"flag" json:"flag"`

	CommentSortOrder string `xml:"comment_sort_order" json:"comment_sort_order"` // oldest_to_newest

	Comments    []*Comment
	Attachments []*Attachment
}

Bug is a Bug in Bugzilla

type Cacher

type Cacher interface {
	GetWriter(id string) io.WriteCloser
}

Cacher should be anything that takes the name of the object to be cached and returns something that can receive writes with the contents and then eventually be closed.

type Changes

type Changes struct {
	SetNeedinfo       string
	RemoveNeedinfo    string
	ClearNeedinfo     bool
	ClearAllNeedinfos bool

	AddComment       string
	CommentIsPrivate bool

	SetURL         string
	SetAssignee    string
	SetPriority    string
	SetDescription string
	SetWhiteboard  string
	SetStatus      string
	SetResolution  string
	SetDuplicate   int

	AddCc    string
	RemoveCc string
	CcMyself bool

	// DeltaTS should have the timestamp of the last change
	DeltaTS      time.Time
	CheckDeltaTS bool
}

Changes to be performed by Update() for a given bug

type Client

type Client struct {
	Config Config
	// contains filtered or unexported fields
}

Client keeps the state of the client.

func New

func New(config Config) (*Client, error)

New prepares a *Client for connecting to the Bugzilla Web interface

func (*Client) DownloadAttachment

func (c *Client) DownloadAttachment(id int) (*Attachment, io.ReadCloser, error)

DownloadAttachment an attachment for download Returns an Attachment with only the Size and Filename filled, a reader and error.

func (*Client) GetBug

func (c *Client) GetBug(id int) (*Bug, error)

GetBug gets a *Bug from the Bugzilla API (apibuzilla)

func (*Client) GetBugFromJSON

func (c *Client) GetBugFromJSON(source io.Reader) (*Bug, error)

GetBug gets a *Bug from a JSON blob

func (*Client) Update

func (c *Client) Update(id int, changes Changes) (err error)

Update changes a bug with the attribute to be modified provided by Changes

type Comment

type Comment struct {
	IsPrivate int  `xml:"isprivate,attr" json:"isprivate"`
	ID        int  `xml:"commentid" json:"commentid"`
	Count     int  `xml:"comment_count" json:"comment_count"`
	Who       User `xml:"who" json:"who"`
	BugWhen   time.Time
	TheText   string `xml:"thetext" json:"thetext"`
}

Comment as in bug comments

type Config

type Config struct {
	BaseURL  string
	User     string
	Password string
	Cacher   Cacher
}

Config sets the parameters needed to set up the client. Cacher can be left zeroed.

type ConnectionError

type ConnectionError struct {
	// contains filtered or unexported fields
}

ConnectionError happens when performing the request

func (ConnectionError) Error

func (e ConnectionError) Error() string

type ErrBugzilla

type ErrBugzilla struct {
	// contains filtered or unexported fields
}

ErrBugzilla is an error from Bugzilla

func (ErrBugzilla) Error

func (e ErrBugzilla) Error() string

type Flag

type Flag struct {
	Name      string `xml:"name,attr" json:"name"`
	ID        int    `xml:"id,attr" json:"id"`
	TypeID    int    `xml:"type_id,attr" json:"type_id"`
	Status    string `xml:"status,attr" json:"status"`
	Setter    string `xml:"setter,attr" json:"setter"`
	Requestee string `xml:"requestee,attr" json:"requestee"`
}

Flag represents flags such as needinfo

type Group

type Group struct {
	ID   int    `xml:"id,attr" json:"id"`
	Name string `xml:",chardata" json:"email"`
}

Group is a group as seen by Bugzilla

type RequestError

type RequestError struct {
	// contains filtered or unexported fields
}

RequestError happens when building the request

func (RequestError) Error

func (e RequestError) Error() string

type User

type User struct {
	Name  string `xml:"name,attr" json:"name"`
	Email string `xml:",chardata" json:"email"`
}

User represents user as used in assigned_to, comment author and other fields (except Cc.)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL