Compare commits
No commits in common. "767362acebeca22fbda2e7082726d5099d1a5908" and "a4ee9ecc02506c6c2595f6fd859507bc2c135220" have entirely different histories.
767362aceb
...
a4ee9ecc02
2
.github/workflows/imagefactory-image.yml
vendored
2
.github/workflows/imagefactory-image.yml
vendored
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
name: Build empanada images for imagefactory
|
name: Build empanada container images
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
2
.github/workflows/mix-empanadas.yml
vendored
2
.github/workflows/mix-empanadas.yml
vendored
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
name: Build empanada container images for lorax
|
name: Build empanada container images
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
@ -43,12 +43,6 @@ RUN dnf install -y \
|
|||||||
|
|
||||||
RUN sed -i -e 's/# memory = 1024/memory = 2048/' /etc/oz/oz.cfg
|
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 ssh-keygen -t rsa -q -f "$HOME/.ssh/id_rsa" -N ""
|
||||||
RUN dnf clean all
|
RUN dnf clean all
|
||||||
RUN rm -rf /etc/yum.repos.d/*.repo /get_arch
|
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
|
RUN pip install awscli
|
||||||
|
|
||||||
ENV BRANCH r9
|
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
|
# devel only
|
||||||
# COPY . /empanadas
|
# COPY . /empanadas
|
||||||
|
@ -103,7 +103,7 @@ for conf in glob.iglob(f"{_rootdir}/sig/*.yaml"):
|
|||||||
|
|
||||||
ALLOWED_TYPE_VARIANTS = {
|
ALLOWED_TYPE_VARIANTS = {
|
||||||
"Azure": None,
|
"Azure": None,
|
||||||
"Container": ["Base", "Minimal", "UBI"],
|
"Container": ["Base", "Minimal"],
|
||||||
"EC2": None,
|
"EC2": None,
|
||||||
"GenericCloud": None,
|
"GenericCloud": None,
|
||||||
"Vagrant": ["Libvirt", "VBox"]
|
"Vagrant": ["Libvirt", "VBox"]
|
||||||
|
@ -84,7 +84,8 @@ class ImageBuild:
|
|||||||
if not self.tdl_path:
|
if not self.tdl_path:
|
||||||
exit(2)
|
exit(2)
|
||||||
self.type_variant = self.type_variant_name()
|
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.out_type = self.image_format()
|
||||||
self.command_args = self._command_args()
|
self.command_args = self._command_args()
|
||||||
self.package_args = self._package_args()
|
self.package_args = self._package_args()
|
||||||
@ -93,29 +94,14 @@ class ImageBuild:
|
|||||||
|
|
||||||
self.metadata = pathlib.Path(self.outdir, "metadata.json")
|
self.metadata = pathlib.Path(self.outdir, "metadata.json")
|
||||||
|
|
||||||
# Yes, this is gross. I'll fix it later.
|
if self.image_type == "Container":
|
||||||
if self.image_type in ["Container"]:
|
|
||||||
self.stage_commands = [
|
self.stage_commands = [
|
||||||
["tar", "-C", f"{self.outdir}", "--strip-components=1", "-x", "-f", lambda: f"{STORAGE_DIR}/{self.target_uuid}.body", "*/layer.tar"]
|
["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 = [
|
self.stage_commands = [
|
||||||
["qemu-img", "convert", "-f", "raw", "-O", "qcow2", lambda: f"{STORAGE_DIR}/{self.target_uuid}.body", f"{self.outdir}/{self.outname}.qcow2"]
|
["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:
|
try:
|
||||||
os.mkdir(self.outdir)
|
os.mkdir(self.outdir)
|
||||||
@ -136,14 +122,11 @@ class ImageBuild:
|
|||||||
finally:
|
finally:
|
||||||
f.flush()
|
f.flush()
|
||||||
|
|
||||||
def output_name(self) -> Tuple[pathlib.Path, str]:
|
def output_name(self):
|
||||||
directory = f"Rocky-{self.architecture.major}-{self.type_variant}-{self.architecture.version}-{BUILDTIME.strftime('%Y%m%d')}.{self.release}"
|
return f"Rocky-{self.architecture.major}-{self.type_variant}-{self.architecture.version}-{BUILDTIME.strftime('%Y%m%d')}.{self.release}.{self.architecture.name}"
|
||||||
name = f"{directory}.{self.architecture.name}"
|
|
||||||
outdir = pathlib.Path(f"/tmp/", directory)
|
|
||||||
return outdir, name
|
|
||||||
|
|
||||||
def type_variant_name(self):
|
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):
|
def _command_args(self):
|
||||||
args_mapping = {
|
args_mapping = {
|
||||||
@ -224,9 +207,7 @@ class ImageBuild:
|
|||||||
|
|
||||||
def copy_command(self) -> List[str]:
|
def copy_command(self) -> List[str]:
|
||||||
|
|
||||||
copy_command = ["aws", "s3", "cp", "--recursive", f"{self.outdir}/",
|
copy_command = ["aws", "s3", "cp", "--recursive", f"{self.outdir}/", f"s3://resf-empanadas/buildimage-{ self.outname }/{ BUILDTIME.strftime('%s') }/"]
|
||||||
f"s3://resf-empanadas/buildimage-{self.architecture.version}-{self.architecture.name}/{ self.outname }/{ BUILDTIME.strftime('%s') }/"
|
|
||||||
]
|
|
||||||
|
|
||||||
return copy_command
|
return copy_command
|
||||||
|
|
||||||
@ -234,8 +215,6 @@ class ImageBuild:
|
|||||||
if self.base_uuid:
|
if self.base_uuid:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
self.fix_ks()
|
|
||||||
|
|
||||||
ret, out, err, uuid = self.runCmd(self.build_command())
|
ret, out, err, uuid = self.runCmd(self.build_command())
|
||||||
if uuid:
|
if uuid:
|
||||||
self.base_uuid = uuid.rstrip()
|
self.base_uuid = uuid.rstrip()
|
||||||
@ -259,11 +238,11 @@ class ImageBuild:
|
|||||||
|
|
||||||
def stage(self) -> int:
|
def stage(self) -> int:
|
||||||
""" Stage the artifacst from wherever they are (unpacking and converting if needed)"""
|
""" 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
|
return 0
|
||||||
|
|
||||||
returns = []
|
returns = []
|
||||||
for command in self.stage_commands: #type: ignore
|
for command in self.stage_commands:
|
||||||
ret, out, err, _ = self.runCmd(command, search=False)
|
ret, out, err, _ = self.runCmd(command, search=False)
|
||||||
returns.append(ret)
|
returns.append(ret)
|
||||||
|
|
||||||
@ -339,9 +318,6 @@ class ImageBuild:
|
|||||||
if stderr:
|
if stderr:
|
||||||
log_lines("Command STDERR", 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):
|
def render_kubernetes_job(self):
|
||||||
commands = [self.build_command(), self.package_command(), self.copy_command()]
|
commands = [self.build_command(), self.package_command(), self.copy_command()]
|
||||||
if not self.job_template:
|
if not self.job_template:
|
||||||
|
@ -7,11 +7,10 @@
|
|||||||
<install type='url'>
|
<install type='url'>
|
||||||
<url>https://dl.rockylinux.org/stg/rocky/{{major}}/BaseOS/{{architecture}}/{{installdir}}</url>
|
<url>https://dl.rockylinux.org/stg/rocky/{{major}}/BaseOS/{{architecture}}/{{installdir}}</url>
|
||||||
</install>
|
</install>
|
||||||
<icicle>
|
<icicle>
|
||||||
<extra_command>rpm -qa --qf '%{NAME},%{VERSION},%{RELEASE},%{ARCH},%{EPOCH},%{SIZE},%{SIGMD5},%{BUILDTIME}
|
<extra_command>rpm -qa --qf '%{NAME},%{VERSION},%{RELEASE},%{ARCH},%{EPOCH},%{SIZE},%{SIGMD5},%{BUILDTIME}
|
||||||
'</extra_command>
|
'</extra_command>
|
||||||
</icicle>
|
</icicle>
|
||||||
<kernelparam>console=tty0 inst.usefbx</kernelparam>
|
|
||||||
</os>
|
</os>
|
||||||
<description>Rocky-{{major}}-{{type}}-{{version_variant}}.{{iso8601date}}.{{release}}.{{architecture}} Generated on {{utcnow}}</description>
|
<description>Rocky-{{major}}-{{type}}-{{version_variant}}.{{iso8601date}}.{{release}}.{{architecture}} Generated on {{utcnow}}</description>
|
||||||
<disk>
|
<disk>
|
||||||
|
@ -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.
Loading…
Reference in New Issue
Block a user