From 60a3885b91c0bced8ae14014c0006dce95837b35 Mon Sep 17 00:00:00 2001 From: Neil Hanlon Date: Thu, 5 Jan 2023 18:12:53 -0500 Subject: [PATCH 1/2] Catch error for debugging purposes --- peridot/builder/v1/workflow/sync.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/peridot/builder/v1/workflow/sync.go b/peridot/builder/v1/workflow/sync.go index f734b894..aa2f0a55 100644 --- a/peridot/builder/v1/workflow/sync.go +++ b/peridot/builder/v1/workflow/sync.go @@ -568,6 +568,9 @@ func kindCatalogGroupInstallOptions(tx peridotdb.Access, req *peridotpb.SyncCata return nil, fmt.Errorf("failed to parse build groupinstall options: %w", err) } err = tx.SetBuildRootPackages(req.ProjectId.Value, srpmPackages, buildPackages) + if err != nil { + return nil, fmt.Errorf("failed to set buildroot packages for project: %w", err) + } ret.SrpmPackages = append(ret.SrpmPackages, srpmPackages...) ret.BuildPackages = append(ret.BuildPackages, buildPackages...) From aa3a97cb87d7cf3a263902d256927a78ee00960e Mon Sep 17 00:00:00 2001 From: Neil Hanlon Date: Thu, 5 Jan 2023 18:17:51 -0500 Subject: [PATCH 2/2] change SetBuildRootPackages to use proper pq types and set defaults on nil --- peridot/db/db.go | 2 +- peridot/db/psql/project.go | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/peridot/db/db.go b/peridot/db/db.go index f86a8df2..51d04a06 100644 --- a/peridot/db/db.go +++ b/peridot/db/db.go @@ -46,7 +46,7 @@ type Access interface { CreateProject(project *peridotpb.Project) (*models.Project, error) UpdateProject(id string, project *peridotpb.Project) (*models.Project, error) SetProjectKeys(projectId string, username string, password string) error - SetBuildRootPackages(projectId string, srpmPackages []string, buildPackages []string) error + SetBuildRootPackages(projectId string, srpmPackages pq.StringArray, buildPackages pq.StringArray) error CreateBuild(packageId string, packageVersionId string, taskId string, projectId string) (*models.Build, error) GetArtifactsForBuild(buildId string) (models.TaskArtifacts, error) diff --git a/peridot/db/psql/project.go b/peridot/db/psql/project.go index f93acdb7..afe6ffa7 100644 --- a/peridot/db/psql/project.go +++ b/peridot/db/psql/project.go @@ -339,7 +339,14 @@ func (a *Access) SetProjectKeys(projectId string, username string, password stri return err } -func (a *Access) SetBuildRootPackages(projectId string, srpmPackages []string, buildPackages []string) error { +func (a *Access) SetBuildRootPackages(projectId string, srpmPackages pq.StringArray, buildPackages pq.StringArray) error { + if srpmPackages == nil { + srpmPackages = pq.StringArray{} + } + if buildPackages == nil { + buildPackages = pq.StringArray{} + } + _, err := a.query.Exec( ` update projects set srpm_stage_packages = $2, build_stage_packages = $3