File tree Expand file tree Collapse file tree 7 files changed +50
-92
lines changed
test/image-blueprints-bootc Expand file tree Collapse file tree 7 files changed +50
-92
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ set -euo pipefail
3+
4+ function get_kernel_ver() {
5+ KERNEL_VER=$( rpm -q --qf " %{VERSION}-%{RELEASE}\n" kernel | sort | tail -1)
6+ KERNEL_VER_ARCH=" ${KERNEL_VER} .$( uname -m) "
7+ export KERNEL_VER
8+ export KERNEL_VER_ARCH
9+ }
10+
11+ # Upgrade the kernel only if necessary to align the procedure with both RHEL and CentOS.
12+ #
13+ # On CentOS, a kernel upgrade may be required due to its different package
14+ # retention policy, which can cause the kernel in the base bootc image to be
15+ # unavailable in the repositories.
16+ get_kernel_ver
17+ if ! dnf --quiet list available " kernel-devel-${KERNEL_VER} " > /dev/null 2>&1 ; then
18+ dnf install -y kernel-devel-matched
19+ get_kernel_ver
20+ else
21+ dnf install -y " kernel-devel-${KERNEL_VER} "
22+ fi
23+
24+ # Install the necessary dependencies and clean up.
25+ dnf install -y git make python3-pyserial
26+ dnf clean all
27+
28+ # Clone the serialsim repository and build the serialsim module.
29+ git clone https://github.com/pmtk/serialsim.git /tmp/serialsim
30+ cd /tmp/serialsim
31+ make KERNEL=" ${KERNEL_VER_ARCH} " all install
32+ rm -rf /tmp/serialsim
Original file line number Diff line number Diff line change @@ -47,20 +47,7 @@ RUN firewall-offline-cmd --zone=public --add-port=22/tcp && \
4747 firewall-offline-cmd --zone=public --add-port=30000-32767/tcp && \
4848 firewall-offline-cmd --zone=public --add-port=30000-32767/udp
4949
50- # Prepare system for testing Generic Device Plugin.
51- # Upgrade the kernel to keep the same procedure with RHEL and CentOS.
52- # CentOS requires upgrade because of a different package retention policy
53- # which means that the kernel in the base bootc image might no longer
54- # be available in the repositories.
55- # hadolint ignore=DL3003
56- RUN dnf upgrade kernel -y && \
57- KERNEL_VER=$(rpm -q --qf "%{VERSION}-%{RELEASE}" kernel); \
58- KERNEL_VER_ARCH="${KERNEL_VER}.$(uname -m)" ; \
59- dnf install -y git make "kernel-devel-${KERNEL_VER}" python3-pyserial && \
60- dnf clean all && \
61- git clone https://github.com/pmtk/serialsim.git /tmp/serialsim && \
62- cd /tmp/serialsim && \
63- make KERNEL="${KERNEL_VER_ARCH}" all install && \
64- rm -rf /tmp/serialsim
65-
50+ # Prepare system for testing Generic Device Plugin
51+ COPY --chmod=755 ./bootc-images/build-serialsim.sh /tmp/build-serialsim.sh
52+ RUN /tmp/build-serialsim.sh && rm -f /tmp/build-serialsim.sh
6653# {{- end -}}
Original file line number Diff line number Diff line change @@ -47,20 +47,7 @@ RUN firewall-offline-cmd --zone=public --add-port=22/tcp && \
4747 firewall-offline-cmd --zone=public --add-port=30000-32767/tcp && \
4848 firewall-offline-cmd --zone=public --add-port=30000-32767/udp
4949
50- # Prepare system for testing Generic Device Plugin.
51- # Upgrade the kernel to keep the same procedure with RHEL and CentOS.
52- # CentOS requires upgrade because of a different package retention policy
53- # which means that the kernel in the base bootc image might no longer
54- # be available in the repositories.
55- # hadolint ignore=DL3003
56- RUN dnf upgrade kernel -y && \
57- KERNEL_VER=$(rpm -q --qf "%{VERSION}-%{RELEASE}" kernel); \
58- KERNEL_VER_ARCH="${KERNEL_VER}.$(uname -m)" ; \
59- dnf install -y git make "kernel-devel-${KERNEL_VER}" python3-pyserial && \
60- dnf clean all && \
61- git clone https://github.com/pmtk/serialsim.git /tmp/serialsim && \
62- cd /tmp/serialsim && \
63- make KERNEL="${KERNEL_VER_ARCH}" all install && \
64- rm -rf /tmp/serialsim
65-
50+ # Prepare system for testing Generic Device Plugin
51+ COPY --chmod=755 ./bootc-images/build-serialsim.sh /tmp/build-serialsim.sh
52+ RUN /tmp/build-serialsim.sh && rm -f /tmp/build-serialsim.sh
6653# {{- end -}}
Original file line number Diff line number Diff line change @@ -47,19 +47,7 @@ RUN firewall-offline-cmd --zone=public --add-port=22/tcp && \
4747 firewall-offline-cmd --zone=public --add-port=30000-32767/tcp && \
4848 firewall-offline-cmd --zone=public --add-port=30000-32767/udp
4949
50- # Prepare system for testing Generic Device Plugin.
51- # Upgrade the kernel to keep the same procedure with RHEL and CentOS.
52- # CentOS requires upgrade because of a different package retention policy
53- # which means that the kernel in the base bootc image might no longer
54- # be available in the repositories.
55- # hadolint ignore=DL3003
56- RUN dnf upgrade kernel -y && \
57- KERNEL_VER=$(rpm -q --qf "%{VERSION}-%{RELEASE}" kernel); \
58- KERNEL_VER_ARCH="${KERNEL_VER}.$(uname -m)" ; \
59- dnf install -y git make "kernel-devel-${KERNEL_VER}" python3-pyserial && \
60- dnf clean all && \
61- git clone https://github.com/pmtk/serialsim.git /tmp/serialsim && \
62- cd /tmp/serialsim && \
63- make KERNEL="${KERNEL_VER_ARCH}" all install && \
64- rm -rf /tmp/serialsim
50+ # Prepare system for testing Generic Device Plugin
51+ COPY --chmod=755 ./bootc-images/build-serialsim.sh /tmp/build-serialsim.sh
52+ RUN /tmp/build-serialsim.sh && rm -f /tmp/build-serialsim.sh
6553# {{- end -}}
Original file line number Diff line number Diff line change @@ -47,20 +47,7 @@ RUN firewall-offline-cmd --zone=public --add-port=22/tcp && \
4747 firewall-offline-cmd --zone=public --add-port=30000-32767/tcp && \
4848 firewall-offline-cmd --zone=public --add-port=30000-32767/udp
4949
50- # Prepare system for testing Generic Device Plugin.
51- # Upgrade the kernel to keep the same procedure with RHEL and CentOS.
52- # CentOS requires upgrade because of a different package retention policy
53- # which means that the kernel in the base bootc image might no longer
54- # be available in the repositories.
55- # hadolint ignore=DL3003
56- RUN dnf upgrade kernel -y && \
57- KERNEL_VER=$(rpm -q --qf "%{VERSION}-%{RELEASE}" kernel); \
58- KERNEL_VER_ARCH="${KERNEL_VER}.$(uname -m)" ; \
59- dnf install -y git make "kernel-devel-${KERNEL_VER}" python3-pyserial && \
60- dnf clean all && \
61- git clone https://github.com/pmtk/serialsim.git /tmp/serialsim && \
62- cd /tmp/serialsim && \
63- make KERNEL="${KERNEL_VER_ARCH}" all install && \
64- rm -rf /tmp/serialsim
65-
50+ # Prepare system for testing Generic Device Plugin
51+ COPY --chmod=755 ./bootc-images/build-serialsim.sh /tmp/build-serialsim.sh
52+ RUN /tmp/build-serialsim.sh && rm -f /tmp/build-serialsim.sh
6653# {{- end -}}
Original file line number Diff line number Diff line change @@ -28,18 +28,6 @@ RUN dnf repoinfo --enabled && \
2828 rm -rvf $USHIFT_RPM_REPO_PATH && \
2929 dnf clean all
3030
31- # Prepare system for testing Generic Device Plugin.
32- # Upgrade the kernel to keep the same procedure with RHEL and CentOS.
33- # CentOS requires upgrade because of a different package retention policy
34- # which means that the kernel in the base bootc image might no longer
35- # be available in the repositories.
36- # hadolint ignore=DL3003
37- RUN dnf upgrade kernel -y && \
38- KERNEL_VER=$(rpm -q --qf "%{VERSION}-%{RELEASE}" kernel); \
39- KERNEL_VER_ARCH="${KERNEL_VER}.$(uname -m)" ; \
40- dnf install -y git make "kernel-devel-${KERNEL_VER}" python3-pyserial && \
41- dnf clean all && \
42- git clone https://github.com/pmtk/serialsim.git /tmp/serialsim && \
43- cd /tmp/serialsim && \
44- make KERNEL="${KERNEL_VER_ARCH}" all install && \
45- rm -rf /tmp/serialsim
31+ # Prepare system for testing Generic Device Plugin
32+ COPY --chmod=755 ./bootc-images/build-serialsim.sh /tmp/build-serialsim.sh
33+ RUN /tmp/build-serialsim.sh && rm -f /tmp/build-serialsim.sh
Original file line number Diff line number Diff line change @@ -28,17 +28,6 @@ RUN dnf repoinfo --enabled && \
2828 rm -rvf $USHIFT_RPM_REPO_PATH && \
2929 dnf clean all
3030
31- # Prepare system for testing Generic Device Plugin.
32- # CentOS' package retention policy is different from RHEL's.
33- # It's possible that kernel-devel for kernel already installed in the centos9 bootc image
34- # is no longer available, therefore we upgrade the kernel and install matching kernel-devel.
35- # hadolint ignore=DL3003
36- RUN dnf upgrade kernel -y && \
37- KERNEL_VER=$(rpm -q --qf "%{VERSION}-%{RELEASE}" kernel); \
38- KERNEL_VER_ARCH="${KERNEL_VER}.$(uname -m)" ; \
39- dnf install -y git make "kernel-devel-${KERNEL_VER}" python3-pyserial && \
40- dnf clean all && \
41- git clone https://github.com/pmtk/serialsim.git /tmp/serialsim && \
42- cd /tmp/serialsim && \
43- make KERNEL="${KERNEL_VER_ARCH}" all install && \
44- rm -rf /tmp/serialsim
31+ # Prepare system for testing Generic Device Plugin
32+ COPY --chmod=755 ./bootc-images/build-serialsim.sh /tmp/build-serialsim.sh
33+ RUN /tmp/build-serialsim.sh && rm -f /tmp/build-serialsim.sh
You can’t perform that action at this time.
0 commit comments