feat: github cicd enricher from run to pipeline#2680
Closed
abeizn wants to merge 10 commits into
Closed
Conversation
warren830
requested changes
Aug 4, 2022
| if entity.Status == "completed" { | ||
| entity.Duration = float64(item.GithubUpdatedAt.Sub(*item.GithubCreatedAt).Seconds()) | ||
| } | ||
| entity.Results = item.Conclusion |
Contributor
There was a problem hiding this comment.
Our result should be a enum value
| FinishedDate *time.Time `json:"finished_time"` | ||
| Duration float64 `json:"duration"` | ||
| Status string `json:"status" gorm:"type:varchar(255)"` | ||
| Results string `json:"results" gorm:"type:varchar(255)"` |
| @@ -29,7 +29,6 @@ import ( | |||
| type GithubRun20220728 struct { | |||
| archived.NoPKModel | |||
| ConnectionId uint64 `gorm:"primaryKey"` | |||
| GithubId int `gorm:"primaryKey"` | |||
Contributor
There was a problem hiding this comment.
doesn't this one have a githubId?
| FinishedDate *time.Time `json:"finished_time"` | ||
| Duration float64 `json:"duration"` | ||
| Status string `json:"status" gorm:"type:varchar(255)"` | ||
| Results string `json:"results" gorm:"type:varchar(255)"` |
| type GithubRun struct { | ||
| common.NoPKModel | ||
| ConnectionId uint64 `gorm:"primaryKey"` | ||
| GithubId int `gorm:"primaryKey"` |
|
|
||
| entity := &githubModels.GithubPipeline{} | ||
| cursor, err := db.Cursor( | ||
| dal.Select("head_sha, head_branch, status, conclusion, github_created_at, github_updated_at, run_attempt, run_started_at"), |
Contributor
There was a problem hiding this comment.
I think we can also order by github_created_at, then you can get the earliest github_created_at easily
| entity.Results = item.Conclusion | ||
| // TODO | ||
| entity.Type = "CI/CD" | ||
| } else { |
Contributor
There was a problem hiding this comment.
I think you'd better create a new entity, for this, I'm wondering if there is a bug. In my thought, if err := db.CreateOrUpdate(entity) is doing batch save, the value of entity might be the last one
warren830
reviewed
Aug 5, 2022
| if entity.Status == "completed" { | ||
| entity.Duration = float64(item.GithubUpdatedAt.Sub(*item.GithubCreatedAt).Seconds()) | ||
| } | ||
| entity.Result = item.Conclusion |
Contributor
There was a problem hiding this comment.
Please modify Result and Status after #2683 get merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
enricher : from _tool_github_runs to _tool_github_pipelines
Does this close any open issues?
related to #2584
Screenshots
Include any relevant screenshots here.
Other Information
Any other information that is important to this PR.