diff --git a/iso/empanadas/Containerfile.imagefactory b/iso/empanadas/Containerfile.imagefactory index a66ccb6..f4f91cb 100644 --- a/iso/empanadas/Containerfile.imagefactory +++ b/iso/empanadas/Containerfile.imagefactory @@ -43,6 +43,12 @@ RUN dnf install -y \ RUN sed -i -e 's/# memory = 1024/memory = 2048/' /etc/oz/oz.cfg +COPY imagefactory.patch / +COPY oz.rpm / + +RUN dnf -y install /oz.rpm +RUN (cd /usr/lib/python3.10/site-packages/; patch -p1 Tuple[pathlib.Path, str]: + directory = f"Rocky-{self.architecture.major}-{self.type_variant}-{self.architecture.version}-{BUILDTIME.strftime('%Y%m%d')}.{self.release}" + name = f"{directory}.{self.architecture.name}" + outdir = pathlib.Path(f"/tmp/", directory) + return outdir, name def type_variant_name(self): - return self.image_type if not self.variant else f"{self.image_type}-{self.variant.capitalize()}" + return self.image_type if not self.variant else f"{self.image_type}-{self.variant}" def _command_args(self): args_mapping = { @@ -207,7 +224,9 @@ class ImageBuild: def copy_command(self) -> List[str]: - copy_command = ["aws", "s3", "cp", "--recursive", f"{self.outdir}/", f"s3://resf-empanadas/buildimage-{ self.outname }/{ BUILDTIME.strftime('%s') }/"] + copy_command = ["aws", "s3", "cp", "--recursive", f"{self.outdir}/", + f"s3://resf-empanadas/buildimage-{self.architecture.version}-{self.architecture.name}/{ self.outname }/{ BUILDTIME.strftime('%s') }/" + ] return copy_command @@ -215,6 +234,8 @@ class ImageBuild: if self.base_uuid: return 0 + self.fix_ks() + ret, out, err, uuid = self.runCmd(self.build_command()) if uuid: self.base_uuid = uuid.rstrip() @@ -238,11 +259,11 @@ class ImageBuild: def stage(self) -> int: """ Stage the artifacst from wherever they are (unpacking and converting if needed)""" - if not self.stage_commands: + if not hasattr(self,'stage_commands'): return 0 returns = [] - for command in self.stage_commands: + for command in self.stage_commands: #type: ignore ret, out, err, _ = self.runCmd(command, search=False) returns.append(ret) @@ -318,6 +339,9 @@ class ImageBuild: if stderr: log_lines("Command STDERR", stderr) + def fix_ks(self): + self.runCmd(["sed", "-i", f"s,$basearch,{self.architecture.name},", self.kickstart_arg[-1]]) + def render_kubernetes_job(self): commands = [self.build_command(), self.package_command(), self.copy_command()] if not self.job_template: diff --git a/iso/empanadas/empanadas/templates/icicle/tdl.xml.tmpl b/iso/empanadas/empanadas/templates/icicle/tdl.xml.tmpl index 73f99f7..900c17d 100644 --- a/iso/empanadas/empanadas/templates/icicle/tdl.xml.tmpl +++ b/iso/empanadas/empanadas/templates/icicle/tdl.xml.tmpl @@ -7,10 +7,11 @@ https://dl.rockylinux.org/stg/rocky/{{major}}/BaseOS/{{architecture}}/{{installdir}} - + rpm -qa --qf '%{NAME},%{VERSION},%{RELEASE},%{ARCH},%{EPOCH},%{SIZE},%{SIGMD5},%{BUILDTIME} ' + console=tty0 inst.usefbx Rocky-{{major}}-{{type}}-{{version_variant}}.{{iso8601date}}.{{release}}.{{architecture}} Generated on {{utcnow}} diff --git a/iso/empanadas/imagefactory.patch b/iso/empanadas/imagefactory.patch new file mode 100644 index 0000000..43254b8 --- /dev/null +++ b/iso/empanadas/imagefactory.patch @@ -0,0 +1,16 @@ +diff --git a/imagefactory_plugins/TinMan/TinMan.info b/imagefactory_plugins/TinMan/TinMan.info +index bd61a02..00a8112 100644 +--- a/imagefactory_plugins/TinMan/TinMan.info ++++ b/imagefactory_plugins/TinMan/TinMan.info +@@ -3,7 +3,10 @@ + "targets": [ ["Fedora", null, null], ["RHEL-6", null, null], ["RHEL-5", null, null], + ["Ubuntu", null, null], ["CentOS-6", null, null], ["CentOS-5", null, null], + ["ScientificLinux-6", null, null], ["ScientificLinux-5", null, null], ["OpenSUSE", null, null], +- [ "RHEL-7", null, null ], [ "CentOS-7", null, null ], [ "ScientificLinux-7", null, null ] ], ++ [ "RHEL-7", null, null ], [ "CentOS-7", null, null ], [ "ScientificLinux-7", null, null ], ++ [ "RHEL-8", null, null ], [ "CentOS-8", null, null ], [ "Rocky-8", null, null ], ++ [ "RHEL-9", null, null ], [ "CentOS-9", null, null ], [ "Rocky-9", null, null ] ++ ], + "description": "Plugin to support most Oz customize capable guest types", + "maintainer": { + "name": "Red Hat, Inc.", diff --git a/iso/empanadas/oz.rpm b/iso/empanadas/oz.rpm new file mode 100644 index 0000000..83e5a53 Binary files /dev/null and b/iso/empanadas/oz.rpm differ