rhel84: new image type: rhel-edge-installer
New image type that generates a Boot ISO. The ISO contains a RHEL Edge commit and an installer. On Boot, it sets up a new RHEL Edge system with the commit. The RHEL Edge commit (ostree commit) is downloaded during build from a URL that should be supplied with the compose request. The commit's hash and URL need to be added to the Sources list in the Manifest. Unlike other types, the new image type defines its own "build" package set that is added to the distro and arch build package lists.
This commit is contained in:
parent
2edb057f3b
commit
bacba210b0
4 changed files with 553 additions and 32 deletions
|
|
@ -167,6 +167,7 @@ func (a *architecture) addS2ImageTypes(imageTypes ...imageTypeS2) {
|
||||||
bootable: it.bootable,
|
bootable: it.bootable,
|
||||||
rpmOstree: it.rpmOstree,
|
rpmOstree: it.rpmOstree,
|
||||||
defaultSize: it.defaultSize,
|
defaultSize: it.defaultSize,
|
||||||
|
bootISO: it.bootISO,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1254,6 +1255,228 @@ func newDistro(isCentos bool) distro.Distro {
|
||||||
},
|
},
|
||||||
enabledServices: edgeImgTypeX86_64.enabledServices,
|
enabledServices: edgeImgTypeX86_64.enabledServices,
|
||||||
rpmOstree: true,
|
rpmOstree: true,
|
||||||
|
bootISO: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
edgeBuildPkgs := []string{
|
||||||
|
"dnf",
|
||||||
|
"dosfstools",
|
||||||
|
"e2fsprogs",
|
||||||
|
"grub2-pc",
|
||||||
|
"policycoreutils",
|
||||||
|
"python36",
|
||||||
|
"python3-iniparse",
|
||||||
|
"qemu-img",
|
||||||
|
"rpm-ostree",
|
||||||
|
"systemd",
|
||||||
|
"tar",
|
||||||
|
"xfsprogs",
|
||||||
|
"xz",
|
||||||
|
"selinux-policy-targeted",
|
||||||
|
"genisoimage",
|
||||||
|
"isomd5sum",
|
||||||
|
"xorriso",
|
||||||
|
"syslinux",
|
||||||
|
"lorax-templates-generic",
|
||||||
|
"lorax-templates-rhel",
|
||||||
|
"syslinux-nonlinux",
|
||||||
|
"squashfs-tools",
|
||||||
|
"grub2-pc-modules",
|
||||||
|
"grub2-tools",
|
||||||
|
"grub2-efi-x64",
|
||||||
|
"shim-x64",
|
||||||
|
"efibootmgr",
|
||||||
|
"grub2-tools-minimal",
|
||||||
|
"grub2-tools-extra",
|
||||||
|
"grub2-tools-efi",
|
||||||
|
"grub2-efi-x64",
|
||||||
|
"grub2-efi-x64-cdboot",
|
||||||
|
"shim-ia32",
|
||||||
|
"grub2-efi-ia32-cdboot",
|
||||||
|
}
|
||||||
|
|
||||||
|
edgeInstallerPkgs := []string{
|
||||||
|
"anaconda",
|
||||||
|
"anaconda-widgets",
|
||||||
|
"kdump-anaconda-addon",
|
||||||
|
"anaconda-install-env-deps",
|
||||||
|
"oscap-anaconda-addon",
|
||||||
|
"redhat-release-eula",
|
||||||
|
"dnf",
|
||||||
|
"rpm-ostree",
|
||||||
|
"ostree",
|
||||||
|
"ostree",
|
||||||
|
"pigz",
|
||||||
|
"kernel",
|
||||||
|
"kernel-modules",
|
||||||
|
"kernel-modules-extra",
|
||||||
|
"grubby",
|
||||||
|
"iwl100-firmware",
|
||||||
|
"iwl1000-firmware",
|
||||||
|
"iwl105-firmware",
|
||||||
|
"iwl135-firmware",
|
||||||
|
"iwl2000-firmware",
|
||||||
|
"iwl2030-firmware",
|
||||||
|
"iwl3160-firmware",
|
||||||
|
"iwl3945-firmware",
|
||||||
|
"iwl4965-firmware",
|
||||||
|
"iwl5000-firmware",
|
||||||
|
"iwl5150-firmware",
|
||||||
|
"iwl6000-firmware",
|
||||||
|
"iwl6000g2a-firmware",
|
||||||
|
"iwl6000g2b-firmware",
|
||||||
|
"iwl6050-firmware",
|
||||||
|
"iwl7260-firmware",
|
||||||
|
"libertas-sd8686-firmware",
|
||||||
|
"libertas-sd8787-firmware",
|
||||||
|
"libertas-usb8388-firmware",
|
||||||
|
"libertas-usb8388-olpc-firmware",
|
||||||
|
"linux-firmware",
|
||||||
|
"alsa-firmware",
|
||||||
|
"alsa-tools-firmware",
|
||||||
|
"glibc-all-langpacks",
|
||||||
|
"grub2-tools-efi",
|
||||||
|
"efibootmgr",
|
||||||
|
"shim-x64",
|
||||||
|
"grub2-efi-x64-cdboot",
|
||||||
|
"shim-ia32",
|
||||||
|
"grub2-efi-ia32-cdboot",
|
||||||
|
"biosdevname",
|
||||||
|
"memtest86+",
|
||||||
|
"syslinux",
|
||||||
|
"grub2-tools",
|
||||||
|
"grub2-tools-minimal",
|
||||||
|
"grub2-tools-extra",
|
||||||
|
"plymouth",
|
||||||
|
"anaconda-dracut",
|
||||||
|
"dracut-network",
|
||||||
|
"dracut-config-generic",
|
||||||
|
"initscripts",
|
||||||
|
"cryptsetup",
|
||||||
|
"rpcbind",
|
||||||
|
"kbd",
|
||||||
|
"kbd-misc",
|
||||||
|
"tar",
|
||||||
|
"xz",
|
||||||
|
"curl",
|
||||||
|
"bzip2",
|
||||||
|
"systemd",
|
||||||
|
"systemd",
|
||||||
|
"rsyslog",
|
||||||
|
"xorg-x11-drivers",
|
||||||
|
"xorg-x11-server-Xorg",
|
||||||
|
"xorg-x11-server-utils",
|
||||||
|
"xorg-x11-xauth",
|
||||||
|
"dbus-x11",
|
||||||
|
"metacity",
|
||||||
|
"metacity",
|
||||||
|
"gsettings-desktop-schemas",
|
||||||
|
"gsettings-desktop-schemas",
|
||||||
|
"nm-connection-editor",
|
||||||
|
"librsvg2",
|
||||||
|
"librsvg2",
|
||||||
|
"xfsprogs",
|
||||||
|
"xfsprogs",
|
||||||
|
"gfs2-utils",
|
||||||
|
"system-storage-manager",
|
||||||
|
"device-mapper-persistent-data",
|
||||||
|
"xfsdump",
|
||||||
|
"udisks2",
|
||||||
|
"udisks2-iscsi",
|
||||||
|
"hostname",
|
||||||
|
"libblockdev-lvm-dbus",
|
||||||
|
"libblockdev-lvm-dbus",
|
||||||
|
"volume_key",
|
||||||
|
"nss-tools",
|
||||||
|
"selinux-policy-targeted",
|
||||||
|
"audit",
|
||||||
|
"ethtool",
|
||||||
|
"openssh-server",
|
||||||
|
"nfs-utils",
|
||||||
|
"openssh-clients",
|
||||||
|
"tigervnc-server-minimal",
|
||||||
|
"tigervnc-server-module",
|
||||||
|
"net-tools",
|
||||||
|
"nmap-ncat",
|
||||||
|
"prefixdevname",
|
||||||
|
"pciutils",
|
||||||
|
"usbutils",
|
||||||
|
"ipmitool",
|
||||||
|
"mt-st",
|
||||||
|
"smartmontools",
|
||||||
|
"hdparm",
|
||||||
|
"libibverbs",
|
||||||
|
"libibverbs",
|
||||||
|
"rdma-core",
|
||||||
|
"rdma-core",
|
||||||
|
"rng-tools",
|
||||||
|
"dmidecode",
|
||||||
|
"bitmap-fangsongti-fonts",
|
||||||
|
"dejavu-sans-fonts",
|
||||||
|
"dejavu-sans-mono-fonts",
|
||||||
|
"kacst-farsi-fonts",
|
||||||
|
"kacst-qurn-fonts",
|
||||||
|
"lklug-fonts",
|
||||||
|
"lohit-assamese-fonts",
|
||||||
|
"lohit-bengali-fonts",
|
||||||
|
"lohit-devanagari-fonts",
|
||||||
|
"lohit-gujarati-fonts",
|
||||||
|
"lohit-gurmukhi-fonts",
|
||||||
|
"lohit-kannada-fonts",
|
||||||
|
"lohit-odia-fonts",
|
||||||
|
"lohit-tamil-fonts",
|
||||||
|
"lohit-telugu-fonts",
|
||||||
|
"madan-fonts",
|
||||||
|
"smc-meera-fonts",
|
||||||
|
"thai-scalable-waree-fonts",
|
||||||
|
"sil-abyssinica-fonts",
|
||||||
|
"xorg-x11-fonts-misc",
|
||||||
|
"aajohan-comfortaa-fonts",
|
||||||
|
"abattis-cantarell-fonts",
|
||||||
|
"sil-scheherazade-fonts",
|
||||||
|
"jomolhari-fonts",
|
||||||
|
"khmeros-base-fonts",
|
||||||
|
"sil-padauk-fonts",
|
||||||
|
"google-noto-sans-cjk-ttc-fonts",
|
||||||
|
"gdb-gdbserver",
|
||||||
|
"libreport-plugin-bugzilla",
|
||||||
|
"libreport-plugin-reportuploader",
|
||||||
|
"libreport-rhel-anaconda-bugzilla",
|
||||||
|
"python3-pyatspi",
|
||||||
|
"vim-minimal",
|
||||||
|
"strace",
|
||||||
|
"lsof",
|
||||||
|
"dump",
|
||||||
|
"xz",
|
||||||
|
"less",
|
||||||
|
"rsync",
|
||||||
|
"bind-utils",
|
||||||
|
"ftp",
|
||||||
|
"mtr",
|
||||||
|
"wget",
|
||||||
|
"spice-vdagent",
|
||||||
|
"gdisk",
|
||||||
|
"hexedit",
|
||||||
|
"sg3_utils",
|
||||||
|
"perl-interpreter",
|
||||||
|
}
|
||||||
|
edgeInstImgTypeX86_64 := imageTypeS2{
|
||||||
|
name: "rhel-edge-installer",
|
||||||
|
filename: "rhel84-boot.iso",
|
||||||
|
mimeType: "application/x-iso9660-image",
|
||||||
|
packageSets: map[string]rpmmd.PackageSet{
|
||||||
|
"build": {
|
||||||
|
Include: edgeBuildPkgs,
|
||||||
|
},
|
||||||
|
"packages": {
|
||||||
|
Include: edgeImgTypeX86_64.packages,
|
||||||
|
Exclude: edgeImgTypeX86_64.excludedPackages,
|
||||||
|
},
|
||||||
|
"installer": {Include: edgeInstallerPkgs},
|
||||||
|
},
|
||||||
|
enabledServices: edgeImgTypeX86_64.enabledServices,
|
||||||
|
rpmOstree: true,
|
||||||
|
bootISO: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
edgeOCIImgTypeAarch64 := imageTypeS2{
|
edgeOCIImgTypeAarch64 := imageTypeS2{
|
||||||
|
|
@ -1269,6 +1492,7 @@ func newDistro(isCentos bool) distro.Distro {
|
||||||
},
|
},
|
||||||
enabledServices: edgeImgTypeAarch64.enabledServices,
|
enabledServices: edgeImgTypeAarch64.enabledServices,
|
||||||
rpmOstree: true,
|
rpmOstree: true,
|
||||||
|
bootISO: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
x8664.addImageTypes(
|
x8664.addImageTypes(
|
||||||
|
|
@ -1282,7 +1506,7 @@ func newDistro(isCentos bool) distro.Distro {
|
||||||
|
|
||||||
if !isCentos {
|
if !isCentos {
|
||||||
x8664.addImageTypes(edgeImgTypeX86_64)
|
x8664.addImageTypes(edgeImgTypeX86_64)
|
||||||
x8664.addS2ImageTypes(edgeOCIImgTypeX86_64)
|
x8664.addS2ImageTypes(edgeOCIImgTypeX86_64, edgeInstImgTypeX86_64)
|
||||||
}
|
}
|
||||||
|
|
||||||
aarch64 := architecture{
|
aarch64 := architecture{
|
||||||
|
|
|
||||||
|
|
@ -443,6 +443,8 @@ func TestDistro_ManifestError(t *testing.T) {
|
||||||
_, err := imgType.Manifest(bp.Customizations, imgOpts, nil, nil, 0)
|
_, err := imgType.Manifest(bp.Customizations, imgOpts, nil, nil, 0)
|
||||||
if imgTypeName == "rhel-edge-commit" || imgTypeName == "rhel-edge-container" {
|
if imgTypeName == "rhel-edge-commit" || imgTypeName == "rhel-edge-container" {
|
||||||
assert.EqualError(t, err, "kernel boot parameter customizations are not supported for ostree types")
|
assert.EqualError(t, err, "kernel boot parameter customizations are not supported for ostree types")
|
||||||
|
} else if imgTypeName == "rhel-edge-installer" {
|
||||||
|
assert.EqualError(t, err, "boot ISO image type \"rhel-edge-installer\" requires specifying a URL from which to retrieve the OSTree commit")
|
||||||
} else {
|
} else {
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
}
|
}
|
||||||
|
|
@ -466,7 +468,7 @@ func TestArchitecture_ListImageTypes(t *testing.T) {
|
||||||
"vhd",
|
"vhd",
|
||||||
"vmdk",
|
"vmdk",
|
||||||
},
|
},
|
||||||
rhelAdditionalImageTypes: []string{"rhel-edge-commit", "rhel-edge-container"},
|
rhelAdditionalImageTypes: []string{"rhel-edge-commit", "rhel-edge-container", "rhel-edge-installer"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
arch: "aarch64",
|
arch: "aarch64",
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ type imageTypeS2 struct {
|
||||||
defaultTarget string
|
defaultTarget string
|
||||||
kernelOptions string
|
kernelOptions string
|
||||||
bootable bool
|
bootable bool
|
||||||
|
bootISO bool
|
||||||
rpmOstree bool
|
rpmOstree bool
|
||||||
defaultSize uint64
|
defaultSize uint64
|
||||||
}
|
}
|
||||||
|
|
@ -69,19 +70,18 @@ func (t *imageTypeS2) Packages(bp blueprint.Blueprint) ([]string, []string) {
|
||||||
if timezone != nil {
|
if timezone != nil {
|
||||||
packages = append(packages, "chrony")
|
packages = append(packages, "chrony")
|
||||||
}
|
}
|
||||||
if t.bootable {
|
|
||||||
packages = append(packages, t.arch.bootloaderPackages...)
|
|
||||||
}
|
|
||||||
|
|
||||||
return packages, t.packageSets["packages"].Exclude
|
return packages, t.packageSets["packages"].Exclude
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *imageTypeS2) BuildPackages() []string {
|
func (t *imageTypeS2) BuildPackages() []string {
|
||||||
packages := append(t.arch.distro.buildPackages, t.arch.buildPackages...)
|
buildPackages := append(t.arch.distro.buildPackages, t.arch.buildPackages...)
|
||||||
if t.rpmOstree {
|
if t.rpmOstree {
|
||||||
packages = append(packages, "rpm-ostree")
|
buildPackages = append(buildPackages, "rpm-ostree")
|
||||||
}
|
}
|
||||||
return packages
|
if t.bootISO {
|
||||||
|
buildPackages = append(buildPackages, t.packageSets["build"].Include...)
|
||||||
|
}
|
||||||
|
return buildPackages
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *imageTypeS2) PackageSets(bp blueprint.Blueprint) map[string]rpmmd.PackageSet {
|
func (t *imageTypeS2) PackageSets(bp blueprint.Blueprint) map[string]rpmmd.PackageSet {
|
||||||
|
|
@ -122,20 +122,32 @@ func (t *imageTypeS2) Manifest(c *blueprint.Customizations,
|
||||||
// flatten spec sets for sources
|
// flatten spec sets for sources
|
||||||
allPackageSpecs := make([]rpmmd.PackageSpec, 0)
|
allPackageSpecs := make([]rpmmd.PackageSpec, 0)
|
||||||
for _, specs := range packageSpecSets {
|
for _, specs := range packageSpecSets {
|
||||||
|
|
||||||
allPackageSpecs = append(allPackageSpecs, specs...)
|
allPackageSpecs = append(allPackageSpecs, specs...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var commits []ostreeCommit
|
||||||
|
if options.OSTree.Parent != "" && options.OSTree.URL != "" {
|
||||||
|
commit := ostreeCommit{Checksum: options.OSTree.Parent, URL: options.OSTree.URL}
|
||||||
|
commits = []ostreeCommit{commit}
|
||||||
|
}
|
||||||
return json.Marshal(
|
return json.Marshal(
|
||||||
osbuild.Manifest{
|
osbuild.Manifest{
|
||||||
Version: "2",
|
Version: "2",
|
||||||
Pipelines: pipelines,
|
Pipelines: pipelines,
|
||||||
Sources: t.sources(allPackageSpecs),
|
Sources: t.sources(allPackageSpecs, commits),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *imageTypeS2) sources(packages []rpmmd.PackageSpec) osbuild.Sources {
|
// local type for ostree sommit metadata used to define commit sources
|
||||||
source := &osbuild.CurlSource{
|
type ostreeCommit struct {
|
||||||
|
Checksum string
|
||||||
|
URL string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *imageTypeS2) sources(packages []rpmmd.PackageSpec, ostreeCommits []ostreeCommit) osbuild.Sources {
|
||||||
|
sources := osbuild.Sources{}
|
||||||
|
curl := &osbuild.CurlSource{
|
||||||
Items: make(map[string]osbuild.CurlSourceItem),
|
Items: make(map[string]osbuild.CurlSourceItem),
|
||||||
}
|
}
|
||||||
for _, pkg := range packages {
|
for _, pkg := range packages {
|
||||||
|
|
@ -146,35 +158,69 @@ func (t *imageTypeS2) sources(packages []rpmmd.PackageSpec) osbuild.Sources {
|
||||||
Name: "org.osbuild.rhsm",
|
Name: "org.osbuild.rhsm",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
source.Items[pkg.Checksum] = item
|
curl.Items[pkg.Checksum] = item
|
||||||
}
|
}
|
||||||
return osbuild.Sources{
|
if len(curl.Items) > 0 {
|
||||||
"org.osbuild.curl": source,
|
sources["org.osbuild.curl"] = curl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ostree := &osbuild.OSTreeSource{
|
||||||
|
Items: make(map[string]osbuild.OSTreeSourceItem),
|
||||||
|
}
|
||||||
|
for _, commit := range ostreeCommits {
|
||||||
|
item := new(osbuild.OSTreeSourceItem)
|
||||||
|
item.Remote.URL = commit.URL
|
||||||
|
ostree.Items[commit.Checksum] = *item
|
||||||
|
}
|
||||||
|
if len(ostree.Items) > 0 {
|
||||||
|
sources["org.osbuild.ostree"] = ostree
|
||||||
|
}
|
||||||
|
return sources
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *imageTypeS2) pipelines(c *blueprint.Customizations, options distro.ImageOptions, repos []rpmmd.RepoConfig, packageSetSpecs map[string][]rpmmd.PackageSpec, rng *rand.Rand) ([]osbuild.Pipeline, error) {
|
func (t *imageTypeS2) pipelines(customizations *blueprint.Customizations, options distro.ImageOptions, repos []rpmmd.RepoConfig, packageSetSpecs map[string][]rpmmd.PackageSpec, rng *rand.Rand) ([]osbuild.Pipeline, error) {
|
||||||
if kernelOpts := c.GetKernel(); kernelOpts.Append != "" && t.rpmOstree {
|
|
||||||
|
if t.bootISO {
|
||||||
|
if options.OSTree.Parent == "" {
|
||||||
|
return nil, fmt.Errorf("boot ISO image type %q requires specifying a URL from which to retrieve the OSTree commit", t.name)
|
||||||
|
}
|
||||||
|
if customizations != nil {
|
||||||
|
return nil, fmt.Errorf("boot ISO image type %q does not support blueprint customizations", t.name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if kernelOpts := customizations.GetKernel(); kernelOpts.Append != "" && t.rpmOstree {
|
||||||
return nil, fmt.Errorf("kernel boot parameter customizations are not supported for ostree types")
|
return nil, fmt.Errorf("kernel boot parameter customizations are not supported for ostree types")
|
||||||
}
|
}
|
||||||
|
|
||||||
pipelines := make([]osbuild.Pipeline, 0, 5)
|
pipelines := make([]osbuild.Pipeline, 0)
|
||||||
|
|
||||||
pipelines = append(pipelines, *t.buildPipeline(repos, packageSetSpecs["build-packages"]))
|
pipelines = append(pipelines, *t.buildPipeline(repos, packageSetSpecs["build-packages"]))
|
||||||
|
|
||||||
if t.rpmOstree {
|
if t.bootISO {
|
||||||
// NOTE(akoutsou) 1to2t: Currently all images of type imageTypeS2 are ostree
|
var kernelPkg rpmmd.PackageSpec
|
||||||
treePipeline, err := t.ostreeTreePipeline(repos, packageSetSpecs["packages"], c)
|
for _, pkg := range packageSetSpecs["installer"] {
|
||||||
|
if pkg.Name == "kernel" {
|
||||||
|
kernelPkg = pkg
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// TODO: panic if not found
|
||||||
|
kernelVer := fmt.Sprintf("%s-%s.%s", kernelPkg.Version, kernelPkg.Release, kernelPkg.Arch)
|
||||||
|
pipelines = append(pipelines, *t.anacondaTreePipeline(repos, packageSetSpecs["installer"], options, kernelVer))
|
||||||
|
pipelines = append(pipelines, *t.bootISOTreePipeline(kernelVer))
|
||||||
|
pipelines = append(pipelines, *t.bootISOPipeline())
|
||||||
|
} else {
|
||||||
|
treePipeline, err := t.ostreeTreePipeline(repos, packageSetSpecs["packages"], customizations)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
pipelines = append(pipelines, *treePipeline)
|
pipelines = append(pipelines, *treePipeline)
|
||||||
pipelines = append(pipelines, *t.ostreeCommitPipeline(options))
|
pipelines = append(pipelines, *t.ostreeCommitPipeline(options))
|
||||||
|
pipelines = append(pipelines, *t.containerTreePipeline(repos, packageSetSpecs["container"], options, customizations))
|
||||||
|
pipelines = append(pipelines, *t.containerPipeline())
|
||||||
}
|
}
|
||||||
|
|
||||||
pipelines = append(pipelines, *t.containerTreePipeline(repos, packageSetSpecs["container"], options, c))
|
|
||||||
pipelines = append(pipelines, *t.containerPipeline())
|
|
||||||
|
|
||||||
return pipelines, nil
|
return pipelines, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -236,7 +282,9 @@ func (t *imageTypeS2) ostreeTreePipeline(repos []rpmmd.RepoConfig, packages []rp
|
||||||
p.AddStage(osbuild.NewFirewallStage(t.firewallStageOptions(firewall)))
|
p.AddStage(osbuild.NewFirewallStage(t.firewallStageOptions(firewall)))
|
||||||
}
|
}
|
||||||
|
|
||||||
p.AddStage(osbuild.NewSELinuxStage(t.selinuxStageOptions()))
|
if !t.bootISO {
|
||||||
|
p.AddStage(osbuild.NewSELinuxStage(t.selinuxStageOptions()))
|
||||||
|
}
|
||||||
|
|
||||||
// These are the current defaults for the sysconfig stage. This can be changed to be image type exclusive if different configs are needed.
|
// These are the current defaults for the sysconfig stage. This can be changed to be image type exclusive if different configs are needed.
|
||||||
p.AddStage(osbuild.NewSysconfigStage(&osbuild.SysconfigStageOptions{
|
p.AddStage(osbuild.NewSysconfigStage(&osbuild.SysconfigStageOptions{
|
||||||
|
|
@ -250,7 +298,7 @@ func (t *imageTypeS2) ostreeTreePipeline(repos []rpmmd.RepoConfig, packages []rp
|
||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
p.AddStage(osbuild.NewRPMOSTreePrepTreeStage(&osbuild.RPMOSTreePrepTreeStageOptions{
|
p.AddStage(osbuild.NewOSTreePrepTreeStage(&osbuild.OSTreePrepTreeStageOptions{
|
||||||
EtcGroupMembers: []string{
|
EtcGroupMembers: []string{
|
||||||
// NOTE: We may want to make this configurable.
|
// NOTE: We may want to make this configurable.
|
||||||
"wheel", "docker",
|
"wheel", "docker",
|
||||||
|
|
@ -296,7 +344,7 @@ func (t *imageTypeS2) containerTreePipeline(repos []rpmmd.RepoConfig, packages [
|
||||||
|
|
||||||
p.AddStage(osbuild.NewOSTreePullStage(
|
p.AddStage(osbuild.NewOSTreePullStage(
|
||||||
&osbuild.OSTreePullStageOptions{Repo: "/var/www/html/repo"},
|
&osbuild.OSTreePullStageOptions{Repo: "/var/www/html/repo"},
|
||||||
t.ostreePullStageInputs(options),
|
t.ostreePullStageInputs("org.osbuild.pipeline", "name:ostree-commit", t.OSTreeRef()),
|
||||||
))
|
))
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
@ -323,6 +371,74 @@ func (t *imageTypeS2) containerPipeline() *osbuild.Pipeline {
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *imageTypeS2) anacondaTreePipeline(repos []rpmmd.RepoConfig, packages []rpmmd.PackageSpec, options distro.ImageOptions, kernelVer string) *osbuild.Pipeline {
|
||||||
|
p := new(osbuild.Pipeline)
|
||||||
|
p.Name = "anaconda-tree"
|
||||||
|
p.Build = "name:build"
|
||||||
|
p.AddStage(osbuild.NewRPMStage(t.rpmStageOptions(repos), t.rpmStageInputs(packages)))
|
||||||
|
p.AddStage(osbuild.NewOSTreeInitStage(&osbuild.OSTreeInitStageOptions{Path: "/ostree/repo"}))
|
||||||
|
p.AddStage(osbuild.NewOSTreePullStage(
|
||||||
|
&osbuild.OSTreePullStageOptions{Repo: "/ostree/repo"},
|
||||||
|
t.ostreePullStageInputs("org.osbuild.source", options.OSTree.Parent, options.OSTree.Ref),
|
||||||
|
))
|
||||||
|
p.AddStage(osbuild.NewBuildstampStage(t.buildStampStageOptions()))
|
||||||
|
p.AddStage(osbuild.NewLocaleStage(&osbuild.LocaleStageOptions{Language: "en_US.UTF-8"}))
|
||||||
|
|
||||||
|
rootPassword := ""
|
||||||
|
rootUser := osbuild.UsersStageOptionsUser{
|
||||||
|
Password: &rootPassword,
|
||||||
|
}
|
||||||
|
|
||||||
|
installUID := 0
|
||||||
|
installGID := 0
|
||||||
|
installHome := "/root"
|
||||||
|
installShell := "/usr/libexec/anaconda/run-anaconda"
|
||||||
|
installPassword := ""
|
||||||
|
installUser := osbuild.UsersStageOptionsUser{
|
||||||
|
UID: &installUID,
|
||||||
|
GID: &installGID,
|
||||||
|
Home: &installHome,
|
||||||
|
Shell: &installShell,
|
||||||
|
Password: &installPassword,
|
||||||
|
}
|
||||||
|
usersStageOptions := &osbuild.UsersStageOptions{
|
||||||
|
Users: map[string]osbuild.UsersStageOptionsUser{
|
||||||
|
"root": rootUser,
|
||||||
|
"install": installUser,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
p.AddStage(osbuild.NewUsersStage(usersStageOptions))
|
||||||
|
p.AddStage(osbuild.NewAnacondaStage(t.anacondaStageOptions()))
|
||||||
|
p.AddStage(osbuild.NewLoraxScriptStage(t.loraxScriptStageOptions()))
|
||||||
|
p.AddStage(osbuild.NewDracutStage(t.dracutStageOptions(kernelVer)))
|
||||||
|
p.AddStage(osbuild.NewKickstartStage(t.kickstartStageOptions(options.OSTree.URL)))
|
||||||
|
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *imageTypeS2) bootISOTreePipeline(kernelVer string) *osbuild.Pipeline {
|
||||||
|
p := new(osbuild.Pipeline)
|
||||||
|
p.Name = "bootiso-tree"
|
||||||
|
p.Build = "name:build"
|
||||||
|
|
||||||
|
p.AddStage(osbuild.NewBootISOMonoStage(t.bootISOMonoStageOptions(kernelVer), t.bootISOMonoStageInputs()))
|
||||||
|
p.AddStage(osbuild.NewDiscinfoStage(t.discinfoStageOptions()))
|
||||||
|
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
func (t *imageTypeS2) bootISOPipeline() *osbuild.Pipeline {
|
||||||
|
p := new(osbuild.Pipeline)
|
||||||
|
// NOTE(akoutsou) 1to2t: final pipeline should always be named "assembler"
|
||||||
|
p.Name = "assembler"
|
||||||
|
p.Build = "name:build"
|
||||||
|
|
||||||
|
p.AddStage(osbuild.NewXorrisofsStage(t.xorrisofsStageOptions(), t.xorrisofsStageInputs()))
|
||||||
|
p.AddStage(osbuild.NewImplantisomd5Stage(&osbuild.Implantisomd5StageOptions{Filename: t.Filename()}))
|
||||||
|
|
||||||
|
return p
|
||||||
|
}
|
||||||
|
|
||||||
func (t *imageTypeS2) rpmStageInputs(specs []rpmmd.PackageSpec) *osbuild.RPMStageInputs {
|
func (t *imageTypeS2) rpmStageInputs(specs []rpmmd.PackageSpec) *osbuild.RPMStageInputs {
|
||||||
stageInput := new(osbuild.RPMStageInput)
|
stageInput := new(osbuild.RPMStageInput)
|
||||||
stageInput.Type = "org.osbuild.files"
|
stageInput.Type = "org.osbuild.files"
|
||||||
|
|
@ -339,13 +455,13 @@ func pkgRefs(specs []rpmmd.PackageSpec) osbuild.RPMStageReferences {
|
||||||
return refs
|
return refs
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *imageTypeS2) ostreePullStageInputs(options distro.ImageOptions) *osbuild.OSTreePullStageInputs {
|
func (t *imageTypeS2) ostreePullStageInputs(origin, source, commitRef string) *osbuild.OSTreePullStageInputs {
|
||||||
pullStageInput := new(osbuild.OSTreePullStageInput)
|
pullStageInput := new(osbuild.OSTreePullStageInput)
|
||||||
pullStageInput.Type = "org.osbuild.ostree"
|
pullStageInput.Type = "org.osbuild.ostree"
|
||||||
pullStageInput.Origin = "org.osbuild.pipeline"
|
pullStageInput.Origin = origin
|
||||||
|
|
||||||
inputRefs := make(map[string]osbuild.OSTreePullStageReference)
|
inputRefs := make(map[string]osbuild.OSTreePullStageReference)
|
||||||
inputRefs["name:ostree-commit"] = osbuild.OSTreePullStageReference{Ref: t.OSTreeRef()}
|
inputRefs[source] = osbuild.OSTreePullStageReference{Ref: commitRef}
|
||||||
pullStageInput.References = inputRefs
|
pullStageInput.References = inputRefs
|
||||||
return &osbuild.OSTreePullStageInputs{Commits: pullStageInput}
|
return &osbuild.OSTreePullStageInputs{Commits: pullStageInput}
|
||||||
}
|
}
|
||||||
|
|
@ -369,9 +485,17 @@ func (t *imageTypeS2) rpmStageOptions(repos []rpmmd.RepoConfig) *osbuild.RPMStag
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *imageTypeS2) selinuxStageOptions() *osbuild.SELinuxStageOptions {
|
func (t *imageTypeS2) selinuxStageOptions() *osbuild.SELinuxStageOptions {
|
||||||
return &osbuild.SELinuxStageOptions{
|
|
||||||
|
options := &osbuild.SELinuxStageOptions{
|
||||||
FileContexts: "etc/selinux/targeted/contexts/files/file_contexts",
|
FileContexts: "etc/selinux/targeted/contexts/files/file_contexts",
|
||||||
}
|
}
|
||||||
|
if t.bootISO {
|
||||||
|
options.Labels = map[string]string{
|
||||||
|
"/usr/bin/cp": "system_u:object_r:install_exec_t:s0",
|
||||||
|
"/usr/bin/tar": "system_u:object_r:install_exec_t:s0",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return options
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *imageTypeS2) userStageOptions(users []blueprint.UserCustomization) (*osbuild.UsersStageOptions, error) {
|
func (t *imageTypeS2) userStageOptions(users []blueprint.UserCustomization) (*osbuild.UsersStageOptions, error) {
|
||||||
|
|
@ -448,3 +572,173 @@ func (t *imageTypeS2) systemdStageOptions(enabledServices, disabledServices []st
|
||||||
DefaultTarget: target,
|
DefaultTarget: target,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *imageTypeS2) buildStampStageOptions() *osbuild.BuildstampStageOptions {
|
||||||
|
return &osbuild.BuildstampStageOptions{
|
||||||
|
Arch: t.Arch().Name(),
|
||||||
|
Product: "Red Hat Enterprise Linux",
|
||||||
|
Version: "8.4",
|
||||||
|
Variant: "edge",
|
||||||
|
Final: true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *imageTypeS2) anacondaStageOptions() *osbuild.AnacondaStageOptions {
|
||||||
|
return &osbuild.AnacondaStageOptions{
|
||||||
|
KickstartModules: []string{
|
||||||
|
"org.fedoraproject.Anaconda.Modules.Network",
|
||||||
|
"org.fedoraproject.Anaconda.Modules.Payloads",
|
||||||
|
"org.fedoraproject.Anaconda.Modules.Storage",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *imageTypeS2) loraxScriptStageOptions() *osbuild.LoraxScriptStageOptions {
|
||||||
|
return &osbuild.LoraxScriptStageOptions{
|
||||||
|
Path: "99-generic/runtime-postinstall.tmpl",
|
||||||
|
BaseArch: t.Arch().Name(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *imageTypeS2) dracutStageOptions(kernelVer string) *osbuild.DracutStageOptions {
|
||||||
|
kernel := []string{kernelVer}
|
||||||
|
modules := []string{
|
||||||
|
"bash",
|
||||||
|
"systemd",
|
||||||
|
"fips",
|
||||||
|
"systemd-initrd",
|
||||||
|
"modsign",
|
||||||
|
"nss-softokn",
|
||||||
|
"rdma",
|
||||||
|
"rngd",
|
||||||
|
"i18n",
|
||||||
|
"convertfs",
|
||||||
|
"network-manager",
|
||||||
|
"network",
|
||||||
|
"ifcfg",
|
||||||
|
"url-lib",
|
||||||
|
"drm",
|
||||||
|
"plymouth",
|
||||||
|
"prefixdevname",
|
||||||
|
"prefixdevname-tools",
|
||||||
|
"anaconda",
|
||||||
|
"crypt",
|
||||||
|
"dm",
|
||||||
|
"dmsquash-live",
|
||||||
|
"kernel-modules",
|
||||||
|
"kernel-modules-extra",
|
||||||
|
"kernel-network-modules",
|
||||||
|
"livenet",
|
||||||
|
"lvm",
|
||||||
|
"mdraid",
|
||||||
|
"multipath",
|
||||||
|
"qemu",
|
||||||
|
"qemu-net",
|
||||||
|
"fcoe",
|
||||||
|
"fcoe-uefi",
|
||||||
|
"iscsi",
|
||||||
|
"lunmask",
|
||||||
|
"nfs",
|
||||||
|
"resume",
|
||||||
|
"rootfs-block",
|
||||||
|
"terminfo",
|
||||||
|
"udev-rules",
|
||||||
|
"biosdevname",
|
||||||
|
"dracut-systemd",
|
||||||
|
"pollcdrom",
|
||||||
|
"usrmount",
|
||||||
|
"base",
|
||||||
|
"fs-lib",
|
||||||
|
"img-lib",
|
||||||
|
"shutdown",
|
||||||
|
"uefi-lib",
|
||||||
|
}
|
||||||
|
return &osbuild.DracutStageOptions{
|
||||||
|
Kernel: kernel,
|
||||||
|
Modules: modules,
|
||||||
|
Install: []string{"/.buildstamp"},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *imageTypeS2) kickstartStageOptions(ostreeURL string) *osbuild.KickstartStageOptions {
|
||||||
|
return &osbuild.KickstartStageOptions{
|
||||||
|
Path: "/usr/share/anaconda/interactive-defaults.ks",
|
||||||
|
OSTree: osbuild.OSTreeOptions{
|
||||||
|
OSName: "rhel",
|
||||||
|
URL: ostreeURL,
|
||||||
|
Ref: t.OSTreeRef(),
|
||||||
|
GPG: false,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *imageTypeS2) bootISOMonoStageOptions(kernelVer string) *osbuild.BootISOMonoStageOptions {
|
||||||
|
return &osbuild.BootISOMonoStageOptions{
|
||||||
|
Product: osbuild.Product{
|
||||||
|
Name: "Red Hat Enterprise Linux",
|
||||||
|
Version: "8.4",
|
||||||
|
},
|
||||||
|
ISOLabel: fmt.Sprintf("RHEL-8-4-0-BaseOS-%s", t.Arch().Name()),
|
||||||
|
Kernel: kernelVer,
|
||||||
|
EFI: osbuild.EFI{
|
||||||
|
Architectures: []string{
|
||||||
|
"IA32",
|
||||||
|
"X64",
|
||||||
|
},
|
||||||
|
Vendor: "redhat",
|
||||||
|
},
|
||||||
|
ISOLinux: osbuild.ISOLinux{
|
||||||
|
Enabled: true,
|
||||||
|
Debug: false,
|
||||||
|
},
|
||||||
|
Templates: "80-rhel",
|
||||||
|
RootFS: osbuild.RootFS{
|
||||||
|
Size: 4096,
|
||||||
|
Compression: osbuild.FSCompression{
|
||||||
|
Method: "xz",
|
||||||
|
Options: osbuild.FSCompressionOptions{
|
||||||
|
// TODO: based on image arch
|
||||||
|
BCJ: "x86",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *imageTypeS2) bootISOMonoStageInputs() *osbuild.BootISOMonoStageInputs {
|
||||||
|
rootfsInput := new(osbuild.BootISOMonoStageInput)
|
||||||
|
rootfsInput.Type = "org.osbuild.tree"
|
||||||
|
rootfsInput.Origin = "org.osbuild.pipeline"
|
||||||
|
rootfsInput.References = osbuild.BootISOMonoStageReferences{"name:anaconda-tree"}
|
||||||
|
return &osbuild.BootISOMonoStageInputs{
|
||||||
|
RootFS: rootfsInput,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *imageTypeS2) discinfoStageOptions() *osbuild.DiscinfoStageOptions {
|
||||||
|
return &osbuild.DiscinfoStageOptions{
|
||||||
|
BaseArch: t.Arch().Name(),
|
||||||
|
Release: "202010217.n.0",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *imageTypeS2) xorrisofsStageOptions() *osbuild.XorrisofsStageOptions {
|
||||||
|
return &osbuild.XorrisofsStageOptions{
|
||||||
|
Filename: t.Filename(),
|
||||||
|
VolID: fmt.Sprintf("RHEL-8-4-0-BaseOS-%s", t.Arch().Name()),
|
||||||
|
Boot: osbuild.XorrisofsBoot{
|
||||||
|
Image: "isolinux/isolinux.bin",
|
||||||
|
Catalog: "isolinux/boot.cat",
|
||||||
|
},
|
||||||
|
EFI: "images/efiboot.img",
|
||||||
|
IsohybridMBR: "/usr/share/syslinux/isohdpfx.bin",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *imageTypeS2) xorrisofsStageInputs() *osbuild.XorrisofsStageInputs {
|
||||||
|
input := new(osbuild.XorrisofsStageInput)
|
||||||
|
input.Type = "org.osbuild.tree"
|
||||||
|
input.Origin = "org.osbuild.pipeline"
|
||||||
|
input.References = osbuild.XorrisofsStageReferences{"name:bootiso-tree"}
|
||||||
|
return &osbuild.XorrisofsStageInputs{Tree: input}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -338,6 +338,7 @@ var imageTypeCompatMapping = map[string]string{
|
||||||
"fedora-iot-commit": "fedora-iot-commit",
|
"fedora-iot-commit": "fedora-iot-commit",
|
||||||
"rhel-edge-commit": "rhel-edge-commit",
|
"rhel-edge-commit": "rhel-edge-commit",
|
||||||
"rhel-edge-container": "rhen-edge-container",
|
"rhel-edge-container": "rhen-edge-container",
|
||||||
|
"rhel-edge-installer": "rhen-edge-installer",
|
||||||
"test_type": "test_type", // used only in json_test.go
|
"test_type": "test_type", // used only in json_test.go
|
||||||
"test_type_invalid": "test_type_invalid", // used only in json_test.go
|
"test_type_invalid": "test_type_invalid", // used only in json_test.go
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue