distro: insert custom sources into pipeline
This is an additional argument on `distro.Pipeline` right now. In the future, we probably want this per-blueprint.
This commit is contained in:
parent
d9ad5d7062
commit
2b42612336
7 changed files with 21 additions and 15 deletions
|
|
@ -57,7 +57,7 @@ func main() {
|
|||
panic(err.Error())
|
||||
}
|
||||
|
||||
pipeline, err := d.Pipeline(blueprint, checksums, archArg, format)
|
||||
pipeline, err := d.Pipeline(blueprint, nil, checksums, archArg, format)
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ type Distro interface {
|
|||
// Returns an osbuild pipeline that generates an image in the given
|
||||
// output format with all packages and customizations specified in the
|
||||
// given blueprint.
|
||||
Pipeline(b *blueprint.Blueprint, checksums map[string]string, outputArchitecture, outputFormat string) (*pipeline.Pipeline, error)
|
||||
Pipeline(b *blueprint.Blueprint, additionalRepos []rpmmd.RepoConfig, checksums map[string]string, outputArchitecture, outputFormat string) (*pipeline.Pipeline, error)
|
||||
|
||||
// Returns a osbuild runner that can be used on this distro.
|
||||
Runner() string
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ func TestDistro_Pipeline(t *testing.T) {
|
|||
t.Errorf("unknown distro: %v", tt.Compose.Distro)
|
||||
return
|
||||
}
|
||||
got, err := d.Pipeline(tt.Compose.Blueprint, tt.Compose.Checksums, tt.Compose.Arch, tt.Compose.OutputFormat)
|
||||
got, err := d.Pipeline(tt.Compose.Blueprint, nil, tt.Compose.Checksums, tt.Compose.Arch, tt.Compose.OutputFormat)
|
||||
if (err != nil) != (tt.Pipeline == nil) {
|
||||
t.Errorf("distro.Pipeline() error = %v", err)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -270,7 +270,7 @@ func (r *Fedora30) FilenameFromType(outputFormat string) (string, string, error)
|
|||
return "", "", errors.New("invalid output format: " + outputFormat)
|
||||
}
|
||||
|
||||
func (r *Fedora30) Pipeline(b *blueprint.Blueprint, checksums map[string]string, outputArchitecture, outputFormat string) (*pipeline.Pipeline, error) {
|
||||
func (r *Fedora30) Pipeline(b *blueprint.Blueprint, additionalRepos []rpmmd.RepoConfig, checksums map[string]string, outputArchitecture, outputFormat string) (*pipeline.Pipeline, error) {
|
||||
output, exists := r.outputs[outputFormat]
|
||||
if !exists {
|
||||
return nil, errors.New("invalid output format: " + outputFormat)
|
||||
|
|
@ -284,7 +284,7 @@ func (r *Fedora30) Pipeline(b *blueprint.Blueprint, checksums map[string]string,
|
|||
p.SetBuild(r.buildPipeline(checksums), "org.osbuild.fedora30")
|
||||
|
||||
packages := append(output.Packages, b.GetPackages()...)
|
||||
p.AddStage(pipeline.NewDNFStage(r.dnfStageOptions(checksums, packages, output.ExcludedPackages)))
|
||||
p.AddStage(pipeline.NewDNFStage(r.dnfStageOptions(additionalRepos, checksums, packages, output.ExcludedPackages)))
|
||||
p.AddStage(pipeline.NewFixBLSStage())
|
||||
|
||||
// TODO support setting all languages and install corresponding langpack-* package
|
||||
|
|
@ -361,16 +361,17 @@ func (r *Fedora30) buildPipeline(checksums map[string]string) *pipeline.Pipeline
|
|||
"tar",
|
||||
}
|
||||
p := &pipeline.Pipeline{}
|
||||
p.AddStage(pipeline.NewDNFStage(r.dnfStageOptions(checksums, packages, nil)))
|
||||
p.AddStage(pipeline.NewDNFStage(r.dnfStageOptions(nil, checksums, packages, nil)))
|
||||
return p
|
||||
}
|
||||
|
||||
func (r *Fedora30) dnfStageOptions(checksums map[string]string, packages, excludedPackages []string) *pipeline.DNFStageOptions {
|
||||
func (r *Fedora30) dnfStageOptions(additionalRepos []rpmmd.RepoConfig, checksums map[string]string, packages, excludedPackages []string) *pipeline.DNFStageOptions {
|
||||
options := &pipeline.DNFStageOptions{
|
||||
ReleaseVersion: "30",
|
||||
BaseArchitecture: "x86_64",
|
||||
}
|
||||
for _, repo := range r.Repositories() {
|
||||
|
||||
for _, repo := range append(r.Repositories(), additionalRepos...) {
|
||||
options.AddRepository(&pipeline.DNFRepository{
|
||||
BaseURL: repo.BaseURL,
|
||||
MetaLink: repo.Metalink,
|
||||
|
|
|
|||
|
|
@ -294,7 +294,7 @@ func (r *RHEL82) FilenameFromType(outputFormat string) (string, string, error) {
|
|||
return "", "", errors.New("invalid output format: " + outputFormat)
|
||||
}
|
||||
|
||||
func (r *RHEL82) Pipeline(b *blueprint.Blueprint, checksums map[string]string, outputArchitecture, outputFormat string) (*pipeline.Pipeline, error) {
|
||||
func (r *RHEL82) Pipeline(b *blueprint.Blueprint, additionalRepos []rpmmd.RepoConfig, checksums map[string]string, outputArchitecture, outputFormat string) (*pipeline.Pipeline, error) {
|
||||
output, exists := r.outputs[outputFormat]
|
||||
if !exists {
|
||||
return nil, errors.New("invalid output format: " + outputFormat)
|
||||
|
|
@ -308,7 +308,7 @@ func (r *RHEL82) Pipeline(b *blueprint.Blueprint, checksums map[string]string, o
|
|||
p.SetBuild(r.buildPipeline(checksums), "org.osbuild.rhel82")
|
||||
|
||||
packages := append(output.Packages, b.GetPackages()...)
|
||||
p.AddStage(pipeline.NewDNFStage(r.dnfStageOptions(checksums, packages, output.ExcludedPackages)))
|
||||
p.AddStage(pipeline.NewDNFStage(r.dnfStageOptions(additionalRepos, checksums, packages, output.ExcludedPackages)))
|
||||
p.AddStage(pipeline.NewFixBLSStage())
|
||||
|
||||
if output.IncludeFSTab {
|
||||
|
|
@ -394,17 +394,17 @@ func (r *RHEL82) buildPipeline(checksums map[string]string) *pipeline.Pipeline {
|
|||
"xfsprogs",
|
||||
}
|
||||
p := &pipeline.Pipeline{}
|
||||
p.AddStage(pipeline.NewDNFStage(r.dnfStageOptions(checksums, packages, nil)))
|
||||
p.AddStage(pipeline.NewDNFStage(r.dnfStageOptions(nil, checksums, packages, nil)))
|
||||
return p
|
||||
}
|
||||
|
||||
func (r *RHEL82) dnfStageOptions(checksums map[string]string, packages, excludedPackages []string) *pipeline.DNFStageOptions {
|
||||
func (r *RHEL82) dnfStageOptions(additionalRepos []rpmmd.RepoConfig, checksums map[string]string, packages, excludedPackages []string) *pipeline.DNFStageOptions {
|
||||
options := &pipeline.DNFStageOptions{
|
||||
ReleaseVersion: "8",
|
||||
BaseArchitecture: "x86_64",
|
||||
ModulePlatformId: "platform:el8",
|
||||
}
|
||||
for _, repo := range r.Repositories() {
|
||||
for _, repo := range append(r.Repositories(), additionalRepos...) {
|
||||
options.AddRepository(&pipeline.DNFRepository{
|
||||
BaseURL: repo.BaseURL,
|
||||
MetaLink: repo.Metalink,
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ func (d *TestDistro) FilenameFromType(outputFormat string) (string, string, erro
|
|||
return "", "", errors.New("invalid output format: " + outputFormat)
|
||||
}
|
||||
|
||||
func (d *TestDistro) Pipeline(b *blueprint.Blueprint, checksums map[string]string, outputArch, outputFormat string) (*pipeline.Pipeline, error) {
|
||||
func (d *TestDistro) Pipeline(b *blueprint.Blueprint, additionalRepos []rpmmd.RepoConfig, checksums map[string]string, outputArch, outputFormat string) (*pipeline.Pipeline, error) {
|
||||
return nil, errors.New("invalid output format or arch: " + outputFormat + " @ " + outputArch)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -430,7 +430,12 @@ func (s *Store) PushCompose(composeID uuid.UUID, bp *blueprint.Blueprint, checks
|
|||
targets = append(targets, uploadTarget)
|
||||
}
|
||||
|
||||
pipeline, err := s.distro.Pipeline(bp, checksums, arch, composeType)
|
||||
repos := []rpmmd.RepoConfig{}
|
||||
for _, source := range s.Sources {
|
||||
repos = append(repos, source.RepoConfig())
|
||||
}
|
||||
|
||||
pipeline, err := s.distro.Pipeline(bp, repos, checksums, arch, composeType)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue