-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ Kai support #631
✨ Kai support #631
Conversation
migration/v13/model/analysis.go
Outdated
type Analysis struct { | ||
Model | ||
Effort int | ||
Commit string `json:"commit"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hint: added Commit.
EnvAppName = "APP_NAME" | ||
EnvDisconnected = "DISCONNECTED" | ||
EnvAnalysisReportPath = "ANALYSIS_REPORT_PATH" | ||
EnvAnalysisArchiverEnabled = "ANALYSIS_ARCHIVER_ENABLED" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hint: added EnvAnalysisArchiverEnabled.
if err != nil { | ||
_ = ctx.Error(err) | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hint: Moved this code blocker here to use r.Model() to properly transfer analysis fields in the posted resource (like: Commit).
type Analysis struct { | ||
Model | ||
Effort int | ||
Commit string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hint: adds commit.
// @tags analyses | ||
// @produce json | ||
// @success 200 {object} []api.Analysis | ||
// @router /analyses [get] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hint: added for completeness.
// @produce octet-stream | ||
// @success 204 {object} | ||
// @router /analyses/{id}/archive [post] | ||
// @param id path int true "Analysis ID" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hint: added to support manual archiving (by kai service) when automatic archiver disabled.
@@ -185,6 +279,8 @@ func (h AnalysisHandler) AppList(ctx *gin.Context) { | |||
db := h.DB(ctx) | |||
db = db.Model(&model.Analysis{}) | |||
db = db.Where("ApplicationID = ?", id) | |||
db = db.Preload("Application") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hint: preload application so name is set in ref.
@@ -388,7 +482,7 @@ func (h AnalysisHandler) AppCreate(ctx *gin.Context) { | |||
} | |||
|
|||
db = h.DB(ctx) | |||
db = db.Preload(clause.Associations) | |||
db = db.Preload("Application") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hint: only preload app. Don't need/want issues.
// @produce json | ||
// @success 200 {object} []api.Issue | ||
// @router /analyses/{id}/issues [get] | ||
// @param id path int true "Analysis ID" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hint: needed by kai to fetch issues.
Signed-off-by: Jeff Ortel <[email protected]>
Signed-off-by: Jeff Ortel <[email protected]>
Signed-off-by: Jeff Ortel <[email protected]>
Signed-off-by: Jeff Ortel <[email protected]>
Signed-off-by: Jeff Ortel <[email protected]>
Signed-off-by: Jeff Ortel <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just little nits
// @summary Archive an analysis (report) by ID. | ||
// @description Archive an analysis (report) by ID. | ||
// @tags analyses | ||
// @produce octet-stream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@produce
line can be removed
// @description Archive an analysis (report) by ID. | ||
// @tags analyses | ||
// @produce octet-stream | ||
// @success 204 {object} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be @success 204
as there's no returned object
@@ -202,15 +298,11 @@ func (h AnalysisHandler) AppList(ctx *gin.Context) { | |||
} | |||
list = append(list, m) | |||
} | |||
err = h.WithCount(ctx, cursor.Count()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is WithCount
not necessary here to set the pagination header?
@@ -1683,6 +1936,16 @@ func (h *AnalysisHandler) appIDs(ctx *gin.Context, f qf.Filter) (q *gorm.DB) { | |||
} | |||
|
|||
// analysisIDs provides analysis IDs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be good to fix up the method name in the commend here
@@ -1900,6 +2158,7 @@ type Issue struct { | |||
// With updates the resource with the model. | |||
func (r *Issue) With(m *model.Issue) { | |||
r.Resource.With(&m.Model) | |||
r.Analysis = m.AnalysisID |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if these should be refs rather than bare IDs, unless these IDs aren't intended to be used to reference API resources?
"gorm.io/gorm" | ||
) | ||
|
||
var log = logr.WithName("migration|v13") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log message needs to be updated to v14
This is necessary for Kai to harvest historical data from the hub Related to konveyor/tackle2-hub/pull/631 Signed-off-by: Fabian von Feilitzsch <[email protected]>
closes #630
Added IssueWriter to support new endpoints.
migration/14