rcm: rework the API for submitting composes
The API allowed composes to have multiple architectures, image types and repositories. Turns out that's not exactly what we want it is not clear how to combine the lits of each. Each architecture might not combine with each image type, and it is not clear which repositories are need for each image build. Lastly, while allowing different image builds to have different distros in the same compose does not appear immediately useful, there is no particular reason to disallow that. This patch reworks the way composes are specified. The intention remains the same, to be able to submit several image builds as one compose. But rather than taking arrays of image types and architectures, take one array of image builds instead, each of which consists of one distro, one architecture, one image build and an array of repositories. In a follow-up patch they will also each contain an array of upload targets. This means that each image build will have the same sort of structure as a compose request in the weldr API. The reason we want to submit an array of them rather than have them as individual composes, is that in a follow-up patch we will introduce the concept of a "finalizer", or "call-back" or something to that effect, which will be triggered when all the images have been built successfully. The use-case is, as always, koji, which requires this. Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
1c0d951f54
commit
fa015a70f6
3 changed files with 226 additions and 74 deletions
|
|
@ -7,22 +7,31 @@ package main
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/google/uuid"
|
||||
"github.com/stretchr/testify/require"
|
||||
"net/http"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/google/uuid"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestRCM(t *testing.T) {
|
||||
// This is the first request the user sends to osbuild.
|
||||
submitBody := `
|
||||
{
|
||||
"distribution": "fedora-31",
|
||||
"image_types": ["qcow2"],
|
||||
"architectures":["x86_64"],
|
||||
"repositories": [
|
||||
{"url": "http://download.fedoraproject.org/pub/fedora/linux/releases/30/Everything/x86_64/os/"}
|
||||
"image_builds":
|
||||
[
|
||||
{
|
||||
"distribution": "fedora-31",
|
||||
"architecture": "x86_64",
|
||||
"image_type": "qcow2",
|
||||
"repositories":
|
||||
[
|
||||
{
|
||||
"baseurl": "http://download.fedoraproject.org/pub/fedora/linux/releases/30/Everything/x86_64/os/"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue