ostree: define type for handling ostree remote config
A new struct in ostree can be used to define configuration options for the ostree remote of an image. So far remotes were always set up with the remote URL used to pull the commit. Now we support setting a different remote with extra configuration options. This is used by the fedora-iot-raw-image to set up the remote configuration of the final image, separately from the source of the commit. Test manifests updated.
This commit is contained in:
parent
0386d68db4
commit
1de55c73e6
10 changed files with 70 additions and 25 deletions
|
|
@ -8,6 +8,7 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/internal/image"
|
||||
"github.com/osbuild/osbuild-composer/internal/manifest"
|
||||
"github.com/osbuild/osbuild-composer/internal/osbuild"
|
||||
"github.com/osbuild/osbuild-composer/internal/ostree"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
"github.com/osbuild/osbuild-composer/internal/workload"
|
||||
)
|
||||
|
|
@ -290,7 +291,12 @@ func iotRawImage(workload workload.Workload,
|
|||
img.Platform = t.platform
|
||||
img.Workload = workload
|
||||
|
||||
img.Remote = "fedora-iot"
|
||||
img.Remote = ostree.Remote{
|
||||
Name: "fedora-iot",
|
||||
URL: "https://ostree.fedoraproject.org/iot",
|
||||
ContentURL: "mirrorlist=https://ostree.fedoraproject.org/iot/mirrorlist",
|
||||
GPGKeyPaths: []string{"/etc/pki/rpm-gpg/"},
|
||||
}
|
||||
img.OSName = "fedora-iot"
|
||||
|
||||
img.OSTreeURL = options.OSTree.URL
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/internal/artifact"
|
||||
"github.com/osbuild/osbuild-composer/internal/disk"
|
||||
"github.com/osbuild/osbuild-composer/internal/manifest"
|
||||
"github.com/osbuild/osbuild-composer/internal/ostree"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
"github.com/osbuild/osbuild-composer/internal/rpmmd"
|
||||
"github.com/osbuild/osbuild-composer/internal/runner"
|
||||
|
|
@ -23,7 +24,7 @@ type OSTreeRawImage struct {
|
|||
OSTreeRef string
|
||||
OSTreeCommit string
|
||||
|
||||
Remote string
|
||||
Remote ostree.Remote
|
||||
OSName string
|
||||
|
||||
KernelOptionsAppend []string
|
||||
|
|
@ -46,8 +47,9 @@ func (img *OSTreeRawImage) InstantiateManifest(m *manifest.Manifest,
|
|||
buildPipeline := manifest.NewBuild(m, runner, repos)
|
||||
buildPipeline.Checkpoint()
|
||||
|
||||
osPipeline := manifest.NewOSTreeDeployment(m, buildPipeline, img.OSTreeRef, img.OSTreeCommit, img.OSTreeURL, img.OSName, img.Remote, img.Platform)
|
||||
osPipeline := manifest.NewOSTreeDeployment(m, buildPipeline, img.OSTreeRef, img.OSTreeCommit, img.OSTreeURL, img.OSName, img.Platform)
|
||||
osPipeline.PartitionTable = img.PartitionTable
|
||||
osPipeline.Remote = img.Remote
|
||||
osPipeline.KernelOptionsAppend = img.KernelOptionsAppend
|
||||
osPipeline.Keyboard = img.Keyboard
|
||||
osPipeline.Locale = img.Locale
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import (
|
|||
"github.com/osbuild/osbuild-composer/internal/common"
|
||||
"github.com/osbuild/osbuild-composer/internal/disk"
|
||||
"github.com/osbuild/osbuild-composer/internal/osbuild"
|
||||
"github.com/osbuild/osbuild-composer/internal/ostree"
|
||||
"github.com/osbuild/osbuild-composer/internal/platform"
|
||||
)
|
||||
|
||||
|
|
@ -14,6 +15,8 @@ import (
|
|||
type OSTreeDeployment struct {
|
||||
Base
|
||||
|
||||
Remote ostree.Remote
|
||||
|
||||
OSVersion string
|
||||
|
||||
osTreeCommit string
|
||||
|
|
@ -21,7 +24,6 @@ type OSTreeDeployment struct {
|
|||
osTreeRef string
|
||||
|
||||
osName string
|
||||
remote string
|
||||
|
||||
KernelOptionsAppend []string
|
||||
Keyboard string
|
||||
|
|
@ -40,7 +42,6 @@ func NewOSTreeDeployment(m *Manifest,
|
|||
commit string,
|
||||
url string,
|
||||
osName string,
|
||||
remote string,
|
||||
platform platform.Platform) *OSTreeDeployment {
|
||||
|
||||
p := &OSTreeDeployment{
|
||||
|
|
@ -49,7 +50,6 @@ func NewOSTreeDeployment(m *Manifest,
|
|||
osTreeURL: url,
|
||||
osTreeRef: ref,
|
||||
osName: osName,
|
||||
remote: remote,
|
||||
platform: platform,
|
||||
}
|
||||
buildPipeline.addDependent(p)
|
||||
|
|
@ -80,7 +80,7 @@ func (p *OSTreeDeployment) serialize() osbuild.Pipeline {
|
|||
|
||||
pipeline.AddStage(osbuild.OSTreeInitFsStage())
|
||||
pipeline.AddStage(osbuild.NewOSTreePullStage(
|
||||
&osbuild.OSTreePullStageOptions{Repo: repoPath, Remote: p.remote},
|
||||
&osbuild.OSTreePullStageOptions{Repo: repoPath, Remote: p.Remote.Name},
|
||||
osbuild.NewOstreePullStageInputs("org.osbuild.source", p.osTreeCommit, p.osTreeRef),
|
||||
))
|
||||
pipeline.AddStage(osbuild.NewOSTreeOsInitStage(
|
||||
|
|
@ -114,7 +114,7 @@ func (p *OSTreeDeployment) serialize() osbuild.Pipeline {
|
|||
&osbuild.OSTreeDeployStageOptions{
|
||||
OsName: p.osName,
|
||||
Ref: p.osTreeRef,
|
||||
Remote: p.remote,
|
||||
Remote: p.Remote.Name,
|
||||
Mounts: []string{"/boot", "/boot/efi"},
|
||||
Rootfs: osbuild.Rootfs{
|
||||
Label: "root",
|
||||
|
|
@ -123,19 +123,24 @@ func (p *OSTreeDeployment) serialize() osbuild.Pipeline {
|
|||
},
|
||||
))
|
||||
|
||||
if p.osTreeURL != "" { // TODO: this should never be empty; fail early instead
|
||||
pipeline.AddStage(osbuild.NewOSTreeRemotesStage(
|
||||
&osbuild.OSTreeRemotesStageOptions{
|
||||
Repo: "/ostree/repo",
|
||||
Remotes: []osbuild.OSTreeRemote{
|
||||
{
|
||||
Name: p.remote,
|
||||
URL: p.osTreeURL,
|
||||
},
|
||||
remoteURL := p.Remote.URL
|
||||
if remoteURL == "" {
|
||||
// if the remote URL for the image is not specified, use the source commit URL
|
||||
remoteURL = p.osTreeURL
|
||||
}
|
||||
pipeline.AddStage(osbuild.NewOSTreeRemotesStage(
|
||||
&osbuild.OSTreeRemotesStageOptions{
|
||||
Repo: "/ostree/repo",
|
||||
Remotes: []osbuild.OSTreeRemote{
|
||||
{
|
||||
Name: p.Remote.Name,
|
||||
URL: remoteURL,
|
||||
ContentURL: p.Remote.ContentURL,
|
||||
GPGKeyPaths: p.Remote.GPGKeyPaths,
|
||||
},
|
||||
},
|
||||
))
|
||||
}
|
||||
},
|
||||
))
|
||||
|
||||
pipeline.AddStage(osbuild.NewOSTreeFillvarStage(
|
||||
&osbuild.OSTreeFillvarStageOptions{
|
||||
|
|
|
|||
|
|
@ -24,6 +24,14 @@ type CommitSource struct {
|
|||
URL string
|
||||
}
|
||||
|
||||
// Remote defines the options that can be set for an OSTree Remote configuration.
|
||||
type Remote struct {
|
||||
Name string
|
||||
URL string
|
||||
ContentURL string
|
||||
GPGKeyPaths []string
|
||||
}
|
||||
|
||||
func VerifyRef(ref string) bool {
|
||||
return len(ref) > 0 && ostreeRefRE.MatchString(ref)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1843,7 +1843,11 @@
|
|||
"remotes": [
|
||||
{
|
||||
"name": "fedora-iot",
|
||||
"url": "http://fedora.example.com/repo"
|
||||
"url": "https://ostree.fedoraproject.org/iot",
|
||||
"contenturl": "mirrorlist=https://ostree.fedoraproject.org/iot/mirrorlist",
|
||||
"gpgkeypaths": [
|
||||
"/etc/pki/rpm-gpg/"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1867,7 +1867,11 @@
|
|||
"remotes": [
|
||||
{
|
||||
"name": "fedora-iot",
|
||||
"url": "http://fedora.example.com/repo"
|
||||
"url": "https://ostree.fedoraproject.org/iot",
|
||||
"contenturl": "mirrorlist=https://ostree.fedoraproject.org/iot/mirrorlist",
|
||||
"gpgkeypaths": [
|
||||
"/etc/pki/rpm-gpg/"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2091,7 +2091,11 @@
|
|||
"remotes": [
|
||||
{
|
||||
"name": "fedora-iot",
|
||||
"url": "http://fedora.example.com/repo"
|
||||
"url": "https://ostree.fedoraproject.org/iot",
|
||||
"contenturl": "mirrorlist=https://ostree.fedoraproject.org/iot/mirrorlist",
|
||||
"gpgkeypaths": [
|
||||
"/etc/pki/rpm-gpg/"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2115,7 +2115,11 @@
|
|||
"remotes": [
|
||||
{
|
||||
"name": "fedora-iot",
|
||||
"url": "http://fedora.example.com/repo"
|
||||
"url": "https://ostree.fedoraproject.org/iot",
|
||||
"contenturl": "mirrorlist=https://ostree.fedoraproject.org/iot/mirrorlist",
|
||||
"gpgkeypaths": [
|
||||
"/etc/pki/rpm-gpg/"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2099,7 +2099,11 @@
|
|||
"remotes": [
|
||||
{
|
||||
"name": "fedora-iot",
|
||||
"url": "http://fedora.example.com/repo"
|
||||
"url": "https://ostree.fedoraproject.org/iot",
|
||||
"contenturl": "mirrorlist=https://ostree.fedoraproject.org/iot/mirrorlist",
|
||||
"gpgkeypaths": [
|
||||
"/etc/pki/rpm-gpg/"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2123,7 +2123,11 @@
|
|||
"remotes": [
|
||||
{
|
||||
"name": "fedora-iot",
|
||||
"url": "http://fedora.example.com/repo"
|
||||
"url": "https://ostree.fedoraproject.org/iot",
|
||||
"contenturl": "mirrorlist=https://ostree.fedoraproject.org/iot/mirrorlist",
|
||||
"gpgkeypaths": [
|
||||
"/etc/pki/rpm-gpg/"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue