mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-14 11:03:09 +02:00
cb3fa7c293
* add sonarqube measurements * fetch measurements from API * add api for fetching issue counts * add debug outputs * add further severities * log number of issues * report failure * expose method to send request * Fixed what was broken. * add debug output * wip * correct opaque property * push client handling to apiClient.go * use correct API URL * correct log outputs * remove logging * remove option validation * extend search options * restructure * rename api client file * simplify client usage * simplify issue client * write sonar values to influx * extract issue service * reorder imports * add sonar integration test * allow unknown fields * add test case * add test case * remove * fix * Update http.go * Apply suggestions from code review * Update cmd/sonarExecuteScan.go * rework test cases * use explicit returns * add task service * add waitfortask * fix typo * remove fixme * expose poll interval * rename test cases * add test cases * use newAPIClient method * use waitForTask * rename services * finalize code * handle error * move defer * move types * add test case * use http.status... * add test case * expose api endpoint names * extract api client * adjust test cases * Update integration-tests-pr.yaml * Update integration-tests.yaml * improve require message * Update integration-tests-pr.yaml * Update integration-tests-pr.yaml
51 lines
6.0 KiB
Go
51 lines
6.0 KiB
Go
package sonar
|
|
|
|
// IssuesSearchOption is a copy from magicsong/sonargo plus the "internal" fields organization, branch and pullrequest.
|
|
type IssuesSearchOption struct {
|
|
Branch string `url:"branch,omitempty"` // Description:"Branch key"
|
|
Organization string `url:"organization,omitempty"` // Description:"Organization key"
|
|
PullRequest string `url:"pullRequest,omitempty"` // Description:"Pull request id"
|
|
// copied from https://github.com/magicsong/sonargo/blob/103eda7abc20bd192a064b6eb94ba26329e339f1/sonar/issues_service.go#L311
|
|
AdditionalFields string `url:"additionalFields,omitempty"` // Description:"Comma-separated list of the optional fields to be returned in response. Action plans are dropped in 5.5, it is not returned in the response.",ExampleValue:""
|
|
Asc string `url:"asc,omitempty"` // Description:"Ascending sort",ExampleValue:""
|
|
Assigned string `url:"assigned,omitempty"` // Description:"To retrieve assigned or unassigned issues",ExampleValue:""
|
|
Assignees string `url:"assignees,omitempty"` // Description:"Comma-separated list of assignee logins. The value '__me__' can be used as a placeholder for user who performs the request",ExampleValue:"admin,usera,__me__"
|
|
Authors string `url:"authors,omitempty"` // Description:"Comma-separated list of SCM accounts",ExampleValue:"torvalds@linux-foundation.org"
|
|
ComponentKeys string `url:"componentKeys,omitempty"` // Description:"Comma-separated list of component keys. Retrieve issues associated to a specific list of components (and all its descendants). A component can be a portfolio, project, module, directory or file.",ExampleValue:"my_project"
|
|
ComponentRootUuids string `url:"componentRootUuids,omitempty"` // Description:"If used, will have the same meaning as componentUuids AND onComponentOnly=false.",ExampleValue:""
|
|
ComponentRoots string `url:"componentRoots,omitempty"` // Description:"If used, will have the same meaning as componentKeys AND onComponentOnly=false.",ExampleValue:""
|
|
ComponentUuids string `url:"componentUuids,omitempty"` // Description:"To retrieve issues associated to a specific list of components their sub-components (comma-separated list of component IDs). This parameter is mostly used by the Issues page, please prefer usage of the componentKeys parameter. A component can be a project, module, directory or file.",ExampleValue:"584a89f2-8037-4f7b-b82c-8b45d2d63fb2"
|
|
Components string `url:"components,omitempty"` // Description:"If used, will have the same meaning as componentKeys AND onComponentOnly=true.",ExampleValue:""
|
|
CreatedAfter string `url:"createdAfter,omitempty"` // Description:"To retrieve issues created after the given date (inclusive). <br>Either a date (server timezone) or datetime can be provided. <br>If this parameter is set, createdSince must not be set",ExampleValue:"2017-10-19 or 2017-10-19T13:00:00+0200"
|
|
CreatedAt string `url:"createdAt,omitempty"` // Description:"Datetime to retrieve issues created during a specific analysis",ExampleValue:"2017-10-19T13:00:00+0200"
|
|
CreatedBefore string `url:"createdBefore,omitempty"` // Description:"To retrieve issues created before the given date (inclusive). <br>Either a date (server timezone) or datetime can be provided.",ExampleValue:"2017-10-19 or 2017-10-19T13:00:00+0200"
|
|
CreatedInLast string `url:"createdInLast,omitempty"` // Description:"To retrieve issues created during a time span before the current time (exclusive). Accepted units are 'y' for year, 'm' for month, 'w' for week and 'd' for day. If this parameter is set, createdAfter must not be set",ExampleValue:"1m2w (1 month 2 weeks)"
|
|
Issues string `url:"issues,omitempty"` // Description:"Comma-separated list of issue keys",ExampleValue:"5bccd6e8-f525-43a2-8d76-fcb13dde79ef"
|
|
Languages string `url:"languages,omitempty"` // Description:"Comma-separated list of languages. Available since 4.4",ExampleValue:"java,js"
|
|
P string `url:"p,omitempty"` // Description:"1-based page number",ExampleValue:"42"
|
|
Ps string `url:"ps,omitempty"` // Description:"Page size. Must be greater than 0 and less or equal than 500",ExampleValue:"20"
|
|
Resolutions string `url:"resolutions,omitempty"` // Description:"Comma-separated list of resolutions",ExampleValue:"FIXED,REMOVED"
|
|
Resolved string `url:"resolved,omitempty"` // Description:"To match resolved or unresolved issues",ExampleValue:""
|
|
Rules string `url:"rules,omitempty"` // Description:"Comma-separated list of coding rule keys. Format is <repository>:<rule>",ExampleValue:"squid:AvoidCycles"
|
|
S string `url:"s,omitempty"` // Description:"Sort field",ExampleValue:""
|
|
Severities string `url:"severities,omitempty"` // Description:"Comma-separated list of severities",ExampleValue:"BLOCKER,CRITICAL"
|
|
SinceLeakPeriod string `url:"sinceLeakPeriod,omitempty"` // Description:"To retrieve issues created since the leak period.<br>If this parameter is set to a truthy value, createdAfter must not be set and one component id or key must be provided.",ExampleValue:""
|
|
Statuses string `url:"statuses,omitempty"` // Description:"Comma-separated list of statuses",ExampleValue:"OPEN,REOPENED"
|
|
Tags string `url:"tags,omitempty"` // Description:"Comma-separated list of tags.",ExampleValue:"security,convention"
|
|
Types string `url:"types,omitempty"` // Description:"Comma-separated list of types.",ExampleValue:"CODE_SMELL,BUG"
|
|
}
|
|
|
|
type issueSeverity string
|
|
|
|
func (s issueSeverity) ToString() string {
|
|
return string(s)
|
|
}
|
|
|
|
const (
|
|
blocker issueSeverity = "BLOCKER"
|
|
critical issueSeverity = "CRITICAL"
|
|
major issueSeverity = "MAJOR"
|
|
minor issueSeverity = "MINOR"
|
|
info issueSeverity = "INFO"
|
|
)
|