-
Notifications
You must be signed in to change notification settings - Fork 562
fix: auto_merge not working properly with orchestrator backend #1871
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
Changes from all commits
3c4e108
da512e3
d0c771c
547f50f
2665be8
c7b3788
fcc924e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
-- Modify "digger_batches" table | ||
ALTER TABLE "public"."digger_batches" ADD COLUMN "cover_all_impacted_projects" boolean NULL; | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,21 +24,22 @@ const DiggerVCSGitlab DiggerVCSType = "gitlab" | |
const DiggerVCSBitbucket DiggerVCSType = "bitbucket" | ||
|
||
type DiggerBatch struct { | ||
ID uuid.UUID `gorm:"primary_key"` | ||
VCS DiggerVCSType | ||
PrNumber int | ||
CommentId *int64 | ||
AiSummaryCommentId string | ||
Status orchestrator_scheduler.DiggerBatchStatus | ||
BranchName string | ||
DiggerConfig string | ||
GithubInstallationId int64 | ||
GitlabProjectId int | ||
RepoFullName string | ||
RepoOwner string | ||
RepoName string | ||
BatchType orchestrator_scheduler.DiggerCommand | ||
ReportTerraformOutputs bool | ||
ID uuid.UUID `gorm:"primary_key"` | ||
VCS DiggerVCSType | ||
PrNumber int | ||
CommentId *int64 | ||
AiSummaryCommentId string | ||
Status orchestrator_scheduler.DiggerBatchStatus | ||
BranchName string | ||
DiggerConfig string | ||
GithubInstallationId int64 | ||
GitlabProjectId int | ||
RepoFullName string | ||
RepoOwner string | ||
RepoName string | ||
BatchType orchestrator_scheduler.DiggerCommand | ||
ReportTerraformOutputs bool | ||
CoverAllImpactedProjects bool | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification
The 🔗 Analysis chainVerify serialization of Ensure that the new field 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Search for serialization of 'CoverAllImpactedProjects' in methods.
# Look for occurrences where DiggerBatch is converted without including 'CoverAllImpactedProjects'.
ast-grep --pattern $'func ($_ *DiggerBatch) MapToJsonStruct() {...}' --json | jq '.captures[] | select(.value | test("CoverAllImpactedProjects")) | .value'
Length of output: 224 Script: #!/bin/bash
# Find the MapToJsonStruct method implementation and surrounding context
rg -U "func.*MapToJsonStruct.*DiggerBatch" -A 20
# Search for struct definition and JSON tags
rg "CoverAllImpactedProjects.*\`json:"
# Look for test files that might verify serialization
rg "TestDiggerBatch.*MapToJsonStruct" -l
Length of output: 133 Script: #!/bin/bash
# Show the content of scheduler.go
cat backend/models/scheduler.go
# Find any JSON-related code in the models directory
rg "json" backend/models/ -A 5 -B 5
# Look for test files in the models directory
fd ".*_test.go" backend/models/
Length of output: 12644 |
||
// used for module source grouping comments | ||
SourceDetails []byte | ||
VCSConnectionId *uint `` | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ import ( | |
) | ||
|
||
// ConvertJobsToDiggerJobs jobs is map with project name as a key and a Job as a value | ||
func ConvertJobsToDiggerJobs(jobType scheduler.DiggerCommand, vcsType models.DiggerVCSType, organisationId uint, jobsMap map[string]scheduler.Job, projectMap map[string]configuration.Project, projectsGraph graph.Graph[string, configuration.Project], githubInstallationId int64, branch string, prNumber int, repoOwner string, repoName string, repoFullName string, commitSha string, commentId int64, diggerConfigStr string, gitlabProjectId int, aiSummaryCommentId string, reportTerraformOutput bool, VCSConnectionId *uint) (*uuid.UUID, map[string]*models.DiggerJob, error) { | ||
func ConvertJobsToDiggerJobs(jobType scheduler.DiggerCommand, vcsType models.DiggerVCSType, organisationId uint, jobsMap map[string]scheduler.Job, projectMap map[string]configuration.Project, projectsGraph graph.Graph[string, configuration.Project], githubInstallationId int64, branch string, prNumber int, repoOwner string, repoName string, repoFullName string, commitSha string, commentId int64, diggerConfigStr string, gitlabProjectId int, aiSummaryCommentId string, reportTerraformOutput bool, coverAllImpactedProjects bool, VCSConnectionId *uint) (*uuid.UUID, map[string]*models.DiggerJob, error) { | ||
Comment on lines
17
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: Function signature is getting quite long with 19 parameters. Consider grouping related parameters into a config struct to improve maintainability |
||
slog.Info("Converting jobs to Digger jobs", | ||
"jobType", jobType, | ||
"vcsType", vcsType, | ||
|
@@ -72,7 +72,7 @@ func ConvertJobsToDiggerJobs(jobType scheduler.DiggerCommand, vcsType models.Dig | |
) | ||
} | ||
|
||
batch, err := models.DB.CreateDiggerBatch(vcsType, githubInstallationId, repoOwner, repoName, repoFullName, prNumber, diggerConfigStr, branch, jobType, &commentId, gitlabProjectId, aiSummaryCommentId, reportTerraformOutput, VCSConnectionId) | ||
batch, err := models.DB.CreateDiggerBatch(vcsType, githubInstallationId, repoOwner, repoName, repoFullName, prNumber, diggerConfigStr, branch, jobType, &commentId, gitlabProjectId, aiSummaryCommentId, reportTerraformOutput, coverAllImpactedProjects, VCSConnectionId) | ||
if err != nil { | ||
slog.Error("Failed to create batch", "error", err) | ||
return nil, nil, fmt.Errorf("failed to create batch: %v", err) | ||
|
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.
style: Consider setting a default value for cover_all_impacted_projects since NULL could lead to ambiguous states