Ensure builds work properly - architectures must match

* Actually use release version input to run build-iso command
* Buildstamp should be an epoch
* template out the job/pod names instead of doing them in the rendering
* label pods with toleration
This commit is contained in:
Neil Hanlon 2022-06-19 00:00:02 -04:00
parent 0603620773
commit 7a097fb302
Signed by untrusted user: neil
GPG Key ID: 705BC21EC3C70F34
3 changed files with 31 additions and 25 deletions

View File

@ -1,11 +1,7 @@
FROM ghcr.io/neilhanlon/skbn:latest as skbn
FROM quay.io/centos/centos:stream9 FROM quay.io/centos/centos:stream9
ADD images/get_arch /get_arch ADD images/get_arch /get_arch
COPY --from=skbn /usr/src/app/skbn.git/skbn /usr/local/bin/skbn
ENV TINI_VERSION v0.19.0 ENV TINI_VERSION v0.19.0
RUN curl -o /tini -L "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-$(/get_arch)" RUN curl -o /tini -L "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-$(/get_arch)"
RUN chmod +x /tini RUN chmod +x /tini
@ -62,7 +58,7 @@ RUN chown peridotbuilder:mock /etc/yum.conf && chown -R peridotbuilder:mock /etc
RUN pip install 'git+https://git.rockylinux.org/release-engineering/public/toolkit.git@feature/iso-kube#egg=empanadas&subdirectory=iso/empanadas' RUN pip install 'git+https://git.rockylinux.org/release-engineering/public/toolkit.git@feature/iso-kube#egg=empanadas&subdirectory=iso/empanadas'
RUN echo "nameserver 1.1.1.1" > /etc/resolv.conf RUN pip install awscli
ENV USER=1002 ENV USER=1002
USER 1002 USER 1002

View File

@ -1,6 +1,7 @@
# Launches the builds of ISOs # Launches the builds of ISOs
import argparse import argparse
import datetime
from empanadas.common import * from empanadas.common import *
from empanadas.common import _rootdir from empanadas.common import _rootdir
@ -29,15 +30,16 @@ def run():
elif results.env == "all": elif results.env == "all":
arches = EKSARCH+EXTARCH arches = EKSARCH+EXTARCH
command = ["build-iso", "--release", f"{results.release}", "--rc", "--isolation", "simple"]
out = "" out = ""
for arch in arches: for arch in arches:
out += job_template.render( out += job_template.render(
architecture=arch, architecture=arch,
backoffLimit=4, backoffLimit=4,
command=["build-iso", "--release", "9", "--rc", "--isolation", "simple"], buildTime=datetime.datetime.utcnow().strftime("%s"),
containerName=f"buildiso-{major}-{arch}", command=command,
imageName="ghcr.io/neilhanlon/sig-core-toolkit:latest", imageName="ghcr.io/neilhanlon/sig-core-toolkit:latest",
jobName=f"build-iso-{arch}",
namespace="empanadas", namespace="empanadas",
major=major, major=major,
restartPolicy="Never", restartPolicy="Never",

View File

@ -2,34 +2,35 @@
apiVersion: batch/v1 apiVersion: batch/v1
kind: Job kind: Job
metadata: metadata:
name: {{ jobName }} name: build-iso-{{ major }}-{{ architecture }}
namespace: {{ namespace }} namespace: {{ namespace }}
spec: spec:
template: template:
metadata:
labels:
peridot.rockylinux.org/workflow-tolerates-arch: {{ architecture }}
spec: spec:
containers: containers:
- name: {{ containerName }} - name: buildiso-{{ major }}-{{ architecture }}
image: {{ imageName }} image: {{ imageName }}
command: {{ command }} command: ["/bin/bash", "-c"]
lifecycle: args:
preStop: - |
exec: {{ command | join(' ') }}
command: [ aws s3 cp --recursive --exclude=* --include=lorax* \
"skbn", /var/lib/mock/rocky-{{ major }}-$(uname -m)/root/builddir/ \
"cp", "s3://resf-empanadas/buildiso-{{ major }}-{{ architecture }}/{{ buildTime }}/"
"--src",
"/var/lib/mock/rocky-{{ major }}-{{ architecture }}/root/builddir/lorax-*`",
"--dst",
"s3://resf-empanadas/{{ containerName }}/$(date +%s)/",
"--parallel",
"2"
]
securityContext: securityContext:
runAsUser: 0 runAsUser: 0
runAsGroup: 0 runAsGroup: 0
privileged: true privileged: true
runAsNonRoot: false runAsNonRoot: false
allowPrivilegeEscalation: true allowPrivilegeEscalation: true
volumeMounts:
- mountPath: /etc/resolv.conf
name: resolv-conf
- mountPath: /var/lib/mock/
name: mock
env: env:
- name: AWS_REGION - name: AWS_REGION
value: us-east-2 value: us-east-2
@ -49,5 +50,12 @@ spec:
operator: Equal operator: Equal
value: {{ architecture }} value: {{ architecture }}
restartPolicy: {{ restartPolicy }} restartPolicy: {{ restartPolicy }}
volumes:
- name: resolv-conf
hostPath:
path: /etc/resolv.conf
type: File
- name: mock
emptyDir: {}
backoffLimit: {{ backoffLimit }} backoffLimit: {{ backoffLimit }}