Merge pull request #84 from NeilHanlon/fix/83

Fix bug in setting build/srpm stage packages for project
This commit is contained in:
resf-prow[bot] 2023-01-06 06:20:09 +00:00 committed by GitHub
commit 95d7351c22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 2 deletions

View File

@ -568,6 +568,9 @@ func kindCatalogGroupInstallOptions(tx peridotdb.Access, req *peridotpb.SyncCata
return nil, fmt.Errorf("failed to parse build groupinstall options: %w", err) return nil, fmt.Errorf("failed to parse build groupinstall options: %w", err)
} }
err = tx.SetBuildRootPackages(req.ProjectId.Value, srpmPackages, buildPackages) 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.SrpmPackages = append(ret.SrpmPackages, srpmPackages...)
ret.BuildPackages = append(ret.BuildPackages, buildPackages...) ret.BuildPackages = append(ret.BuildPackages, buildPackages...)

View File

@ -46,7 +46,7 @@ type Access interface {
CreateProject(project *peridotpb.Project) (*models.Project, error) CreateProject(project *peridotpb.Project) (*models.Project, error)
UpdateProject(id string, project *peridotpb.Project) (*models.Project, error) UpdateProject(id string, project *peridotpb.Project) (*models.Project, error)
SetProjectKeys(projectId string, username string, password string) 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) CreateBuild(packageId string, packageVersionId string, taskId string, projectId string) (*models.Build, error)
GetArtifactsForBuild(buildId string) (models.TaskArtifacts, error) GetArtifactsForBuild(buildId string) (models.TaskArtifacts, error)

View File

@ -339,7 +339,14 @@ func (a *Access) SetProjectKeys(projectId string, username string, password stri
return err 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( _, err := a.query.Exec(
` `
update projects set srpm_stage_packages = $2, build_stage_packages = $3 update projects set srpm_stage_packages = $2, build_stage_packages = $3