Tools: fetch image test case generation matrix from composer
Add a simple tool `osbuild-composer-image-definitions` which dumps the matrix of all distributions, architectures and image types names supported by composer as a JSON to the stdout. Default to fetching the image test case generation matrix directly from composer. This eliminates the need to update a JSON source file with this information every time a new distro or image type are added to composer. Delete the previously used JSON source file with the image test case generation matrix. Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
parent
035b616308
commit
40c095a850
3 changed files with 47 additions and 415 deletions
35
cmd/osbuild-composer-image-definitions/main.go
Normal file
35
cmd/osbuild-composer-image-definitions/main.go
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/distroregistry"
|
||||
)
|
||||
|
||||
func main() {
|
||||
definitions := map[string]map[string][]string{}
|
||||
distroRegistry := distroregistry.NewDefault()
|
||||
|
||||
for _, distroName := range distroRegistry.List() {
|
||||
distro := distroRegistry.GetDistro(distroName)
|
||||
for _, archName := range distro.ListArches() {
|
||||
arch, err := distro.GetArch(archName)
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("failed to get arch %q of distro %q listed in aches list", archName, distroName))
|
||||
}
|
||||
_, ok := definitions[distroName]
|
||||
if !ok {
|
||||
definitions[distroName] = map[string][]string{}
|
||||
}
|
||||
definitions[distroName][archName] = arch.ListImageTypes()
|
||||
}
|
||||
}
|
||||
|
||||
encoder := json.NewEncoder(os.Stdout)
|
||||
err := encoder.Encode(definitions)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue