Compare commits

..

No commits in common. "767362acebeca22fbda2e7082726d5099d1a5908" and "a4ee9ecc02506c6c2595f6fd859507bc2c135220" have entirely different histories.

8 changed files with 15 additions and 62 deletions

View File

@ -1,5 +1,5 @@
---
name: Build empanada images for imagefactory
name: Build empanada container images
on:
push:

View File

@ -1,5 +1,5 @@
---
name: Build empanada container images for lorax
name: Build empanada container images
on:
push:

View File

@ -43,12 +43,6 @@ 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 </imagefactory.patch)
RUN ssh-keygen -t rsa -q -f "$HOME/.ssh/id_rsa" -N ""
RUN dnf clean all
RUN rm -rf /etc/yum.repos.d/*.repo /get_arch
@ -58,7 +52,7 @@ RUN rm -rf /etc/yum.repos.d/*.repo /get_arch
RUN pip install awscli
ENV BRANCH r9
RUN git clone https://git.resf.org/sig_core/kickstarts.git --branch $BRANCH /kickstarts
RUN git clone https://git.rockylinux.org/rocky/kickstarts.git --branch $BRANCH /kickstarts
# devel only
# COPY . /empanadas

View File

@ -103,7 +103,7 @@ for conf in glob.iglob(f"{_rootdir}/sig/*.yaml"):
ALLOWED_TYPE_VARIANTS = {
"Azure": None,
"Container": ["Base", "Minimal", "UBI"],
"Container": ["Base", "Minimal"],
"EC2": None,
"GenericCloud": None,
"Vagrant": ["Libvirt", "VBox"]

View File

@ -84,7 +84,8 @@ class ImageBuild:
if not self.tdl_path:
exit(2)
self.type_variant = self.type_variant_name()
self.outdir, self.outname = self.output_name()
self.outname = self.output_name()
self.outdir = pathlib.Path(f"/tmp/{self.outname}")
self.out_type = self.image_format()
self.command_args = self._command_args()
self.package_args = self._package_args()
@ -93,29 +94,14 @@ class ImageBuild:
self.metadata = pathlib.Path(self.outdir, "metadata.json")
# Yes, this is gross. I'll fix it later.
if self.image_type in ["Container"]:
if self.image_type == "Container":
self.stage_commands = [
["tar", "-C", f"{self.outdir}", "--strip-components=1", "-x", "-f", lambda: f"{STORAGE_DIR}/{self.target_uuid}.body", "*/layer.tar"]
]
if self.image_type in ["GenericCloud"]:
if self.image_type in ["GenericCloud", "EC2"]:
self.stage_commands = [
["qemu-img", "convert", "-f", "raw", "-O", "qcow2", lambda: f"{STORAGE_DIR}/{self.target_uuid}.body", f"{self.outdir}/{self.outname}.qcow2"]
]
if self.image_type in ["EC2"]:
self.stage_commands = [
["qemu-img", "convert", "-f", "raw", "-O", "qcow2", lambda: f"{STORAGE_DIR}/{self.target_uuid}.body", f"{self.outdir}/{self.outname}.qcow2"]
]
if self.image_type in ["Vagrant"]:
_map = {
"VBox": "vmdk",
"Libvirt": "qcow2"
}
output = f"{_map[self.variant]}" #type: ignore
self.stage_commands = [
["qemu-img", "convert", "-f", "raw", "-O", output, lambda: f"{STORAGE_DIR}/{self.target_uuid}.body", f"{self.outdir}/{self.outname}.{output}"]
]
try:
os.mkdir(self.outdir)
@ -136,14 +122,11 @@ class ImageBuild:
finally:
f.flush()
def output_name(self) -> 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 output_name(self):
return f"Rocky-{self.architecture.major}-{self.type_variant}-{self.architecture.version}-{BUILDTIME.strftime('%Y%m%d')}.{self.release}.{self.architecture.name}"
def type_variant_name(self):
return self.image_type if not self.variant else f"{self.image_type}-{self.variant}"
return self.image_type if not self.variant else f"{self.image_type}-{self.variant.capitalize()}"
def _command_args(self):
args_mapping = {
@ -224,9 +207,7 @@ class ImageBuild:
def copy_command(self) -> List[str]:
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') }/"
]
copy_command = ["aws", "s3", "cp", "--recursive", f"{self.outdir}/", f"s3://resf-empanadas/buildimage-{ self.outname }/{ BUILDTIME.strftime('%s') }/"]
return copy_command
@ -234,8 +215,6 @@ 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()
@ -259,11 +238,11 @@ class ImageBuild:
def stage(self) -> int:
""" Stage the artifacst from wherever they are (unpacking and converting if needed)"""
if not hasattr(self,'stage_commands'):
if not self.stage_commands:
return 0
returns = []
for command in self.stage_commands: #type: ignore
for command in self.stage_commands:
ret, out, err, _ = self.runCmd(command, search=False)
returns.append(ret)
@ -339,9 +318,6 @@ 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:

View File

@ -11,7 +11,6 @@
<extra_command>rpm -qa --qf '%{NAME},%{VERSION},%{RELEASE},%{ARCH},%{EPOCH},%{SIZE},%{SIGMD5},%{BUILDTIME}
'</extra_command>
</icicle>
<kernelparam>console=tty0 inst.usefbx</kernelparam>
</os>
<description>Rocky-{{major}}-{{type}}-{{version_variant}}.{{iso8601date}}.{{release}}.{{architecture}} Generated on {{utcnow}}</description>
<disk>

View File

@ -1,16 +0,0 @@
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.",

Binary file not shown.