From 829e28eaa65dfc08ed7af8cf791393f8b2ef608b Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Wed, 4 Sep 2024 15:28:53 +0100 Subject: [PATCH] ansible: add rhel9_arm_cross containers --- ansible/roles/docker/files/cc-selector.sh | 17 +++-- .../templates/rhel9_arm_cross.Dockerfile.j2 | 66 +++++++++++++++++++ jenkins/scripts/VersionSelectorScript.groovy | 2 + 3 files changed, 78 insertions(+), 7 deletions(-) create mode 100644 ansible/roles/docker/templates/rhel9_arm_cross.Dockerfile.j2 diff --git a/ansible/roles/docker/files/cc-selector.sh b/ansible/roles/docker/files/cc-selector.sh index 9ca761838..e9a2eea06 100755 --- a/ansible/roles/docker/files/cc-selector.sh +++ b/ansible/roles/docker/files/cc-selector.sh @@ -9,6 +9,7 @@ # cross-compiler-ubuntu1804-armv7-gcc-8 # cross-compiler-rhel8-armv7-gcc-8-glibc-2.28 # cross-compiler-rhel8-armv7-gcc-10-glibc-2.28 +# cross-compiler-rhel9-armv7-gcc-12-glibc-2.28 rpi_newer_tools_base="/opt/raspberrypi/rpi-newer-crosstools/" base_4_9_4="${rpi_newer_tools_base}x64-gcc-4.9.4-binutils-2.28/arm-rpi-linux-gnueabihf/bin/arm-rpi-linux-gnueabihf-" @@ -16,6 +17,7 @@ base_6="${rpi_newer_tools_base}x64-gcc-6.5.0/arm-rpi-linux-gnueabihf/bin/arm-rpi base_8="${rpi_newer_tools_base}x64-gcc-8.3.0/arm-rpi-linux-gnueabihf/bin/arm-rpi-linux-gnueabihf-" base_8_glibc_2_28="${rpi_newer_tools_base}x64-gcc-8.3.0-glibc-2.28/arm-rpi-linux-gnueabihf/bin/arm-rpi-linux-gnueabihf-" base_10_glibc_2_28="${rpi_newer_tools_base}x64-gcc-10.3.0-glibc-2.28/arm-rpi-linux-gnueabihf/bin/arm-rpi-linux-gnueabihf-" +base_12_glibc_2_28="${rpi_newer_tools_base}x64-gcc-12.3.0-glibc-2.28/arm-rpi-linux-gnueabihf/bin/arm-rpi-linux-gnueabihf-" flags_armv6="-march=armv6zk" flags_armv7="-march=armv7-a" @@ -23,17 +25,17 @@ flags_armv7="-march=armv7-a" function run { local label="$1" - export arm_type=$(echo $label | sed -E 's/^cross-compiler-(ubuntu1[68]04|rhel8)-(armv[67])-gcc-.*$/\2/') - export gcc_version=$(echo $label | sed -E 's/^cross-compiler-(ubuntu1[68]04|rhel8)-armv[67]-gcc-(4\.9\.4|6|8|10)/\2/') + export arm_type=$(echo $label | sed -E 's/^cross-compiler-(ubuntu1[68]04|rhel[89])-(armv[67])-gcc-.*$/\2/') + export gcc_version=$(echo $label | sed -E 's/^cross-compiler-(ubuntu1[68]04|rhel[89])-armv[67]-gcc-(4\.9\.4|6|8|10|12)/\2/') export git_branch="cc-${arm_type}" - export host_os=$(echo $label | sed -E 's/^cross-compiler-(ubuntu1[68]04|rhel8)-(armv[67])-gcc-.*$/\1/') + export host_os=$(echo $label | sed -E 's/^cross-compiler-(ubuntu1[68]04|rhel[89])-(armv[67])-gcc-.*$/\1/') if [[ ! "$arm_type" =~ ^armv[67]$ ]]; then echo "Could not determine ARM type from '$label'" exit 1 fi - if [[ ! "$gcc_version" =~ ^(4\.9\.4|6|8|8-glibc-2.28|10-glibc-2.28)$ ]]; then - echo "Could not determine ARM type from '$label'" + if [[ ! "$gcc_version" =~ ^(4\.9\.4|6|8|8-glibc-2\.28|10-glibc-2\.28|12-glibc-2\.28)$ ]]; then + echo "Could not determine gcc version from '$label'" exit 1 fi @@ -49,10 +51,11 @@ function run { export ARCH="${arm_type}l" export DESTCPU=arm - if [ "$host_os" = "rhel8" ]; then + if [ "$host_os" = "rhel8" ] || [ "$host_os" = "rhel9" ]; then current_gcc_version="$(gcc -dumpversion)" # Additional gcc versions are installed via gcc-toolset- packages. - # No such package exists for the default gcc version (8 on RHEL 8). + # No such package exists for the default gcc version (8 on RHEL 8, + # 11 on RHEL 9). if [ "${current_gcc_version}" != "${gcc_host_version}" ]; then if ! . /opt/rh/gcc-toolset-${gcc_host_version}/enable; then echo "Host gcc version mismatch (wanted ${gcc_host_version} but got ${current_gcc_version})." diff --git a/ansible/roles/docker/templates/rhel9_arm_cross.Dockerfile.j2 b/ansible/roles/docker/templates/rhel9_arm_cross.Dockerfile.j2 new file mode 100644 index 000000000..71595177a --- /dev/null +++ b/ansible/roles/docker/templates/rhel9_arm_cross.Dockerfile.j2 @@ -0,0 +1,66 @@ +FROM registry.access.redhat.com/ubi9:latest + +ENV LC_ALL C +ENV USER {{ server_user }} +ENV JOBS {{ server_jobs | default(ansible_processor_vcpus) }} +ENV SHELL /bin/bash +ENV PATH /usr/lib64/ccache:/usr/lib/ccache:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin +ENV NODE_COMMON_PIPE /home/{{ server_user }}/test.pipe +ENV NODE_TEST_DIR /home/{{ server_user }}/tmp +ENV OSTYPE linux-gnu +ENV OSVARIANT docker +ENV DESTCPU {{ arch }} +ENV ARCH {{ arch }} + +# ccache is not in the default repositories so get it from EPEL 8. +RUN dnf install --disableplugin=subscription-manager -y \ + https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm \ + && dnf update --disableplugin=subscription-manager -y \ + && dnf install --disableplugin=subscription-manager -y \ + ccache \ + gcc-c++ \ + gcc-toolset-12 \ + gcc-toolset-12-libstdc++-devel \ + gcc-toolset-12-libstdc++-devel.i686 \ + git \ + glibc-devel.i686 \ + java-17-openjdk-headless \ + libatomic.i686 \ + libstdc++-devel \ + libstdc++-devel.i686 \ + make \ + python3 \ + procps-ng \ + xz \ + && dnf --disableplugin=subscription-manager clean all + +RUN groupadd -r -g {{ server_user_gid.stdout_lines[0] }} {{ server_user }} \ + && adduser -r -m -d /home/{{ server_user }}/ \ + -g {{ server_user_gid.stdout_lines[0] }} \ + -u {{ server_user_uid.stdout_lines[0] }} {{ server_user }} + +VOLUME /home/{{ server_user }}/ /home/{{ server_user }}/.ccache + +ENV PYTHON /usr/bin/python3 + +RUN pip3 install tap2junit=={{ tap2junit_version }} + +RUN git clone --depth=1 https://github.com/rvagg/rpi-newer-crosstools.git /opt/raspberrypi/rpi-newer-crosstools + +COPY cc-selector.sh /opt/raspberrypi/cc-selector.sh + +RUN chmod 755 /opt/raspberrypi/cc-selector.sh + +USER {{ server_user }}:{{ server_user }} + +ENV CCACHE_TEMPDIR /home/{{ server_user }}/.ccache/{{ item.name }} + +WORKDIR /home/{{ server_user }} + +CMD cd /home/{{ server_user }} \ + && curl https://ci.nodejs.org/jnlpJars/agent.jar -O \ + && java -Xmx{{ server_ram|default('128m') }} \ + -jar /home/{{ server_user }}/agent.jar \ + -url {{ jenkins_url }} \ + -name {{ item.name }} \ + -secret {{ item.secret }} diff --git a/jenkins/scripts/VersionSelectorScript.groovy b/jenkins/scripts/VersionSelectorScript.groovy index bee53b778..efd21ceb4 100644 --- a/jenkins/scripts/VersionSelectorScript.groovy +++ b/jenkins/scripts/VersionSelectorScript.groovy @@ -42,6 +42,8 @@ def buildExclusions = [ [ /^cross-compiler-ubuntu1804-armv7-gcc-8/, anyType, gte(18) ], [ /^cross-compiler-rhel8-armv7-gcc-8-glibc-2.28/, anyType, gte(20) ], [ /^cross-compiler-rhel8-armv7-gcc-10-glibc-2.28/, anyType, lt(20) ], + [ /^cross-compiler-rhel8-armv7-gcc-10-glibc-2.28/, anyType, gte(23) ], + [ /^cross-compiler-rhel9-armv7-gcc-12-glibc-2.28/, anyType, lt(23) ], // Windows ----------------------------------------------- // https://github.com/nodejs/build/blob/main/doc/windows-visualstudio-supported-versions.md