osbuild-pipeline: use repo name from the request if provided

Almost all repo configurations used for generating image test cases
using `osbuild-pipeline` have `name` defined. Make sure that the repo
name provided in the compose request is used when depsolving.

Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
Tomas Hozza 2022-03-11 13:50:00 +01:00 committed by Tom Gundersen
parent 13a9022fd8
commit 562225af4c

View file

@ -18,6 +18,7 @@ import (
)
type repository struct {
Name string `json:"name,omitempty"`
BaseURL string `json:"baseurl,omitempty"`
Metalink string `json:"metalink,omitempty"`
MirrorList string `json:"mirrorlist,omitempty"`
@ -102,8 +103,12 @@ func main() {
repos := make([]rpmmd.RepoConfig, len(composeRequest.Repositories))
for i, repo := range composeRequest.Repositories {
repoName := repo.Name
if repoName == "" {
repoName = fmt.Sprintf("repo-%d", i)
}
repos[i] = rpmmd.RepoConfig{
Name: fmt.Sprintf("repo-%d", i),
Name: repoName,
BaseURL: repo.BaseURL,
Metalink: repo.Metalink,
MirrorList: repo.MirrorList,