Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDBF-695 - add srpm tests as in the old bb #720

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from

Conversation

RazvanLiviuVarzaru
Copy link
Collaborator

@RazvanLiviuVarzaru RazvanLiviuVarzaru commented Feb 28, 2025

As per MDBF-695, rpm builders should do the srpm build step as the old buildbot does, to make sure source rpms are usable and a build from a source rpm produces packages identical to official.

Please follow the commits [asc] for implementation details.

Summary:

  • buildbot-configuration:
    • new list of builders BUILDERS_SRPMS for every OS / arch (no s390x) with has_srpm: True
    • new scheduler s_srpms triggered by autobake builders for release / main branches
    • builders/ workers (based on BUILDERS_SRPMS ) defined in non-standard master with dedicated worker pool (should be RedHat hosts). #TODO
    • dedicated f_srpm factory for fetching / running rebuild-from-srpm.sh
  • CI-configuration
    • defined srpm.Dockerfile able to build minimal container images for every OS
    • defined GitHub workflow to handle the container image build and publish to QUAY/GHCR

How to test?

  1. Build the image, a few examples:
docker build --tag local:fedora39-srpm  --build-arg BASE_IMAGE=fedora:39 --build-arg INSTALL_WORKER_FROM_PIP=N .
docker build --tag local:opensuse1506-srpm --build-arg BASE_IMAGE="opensuse/leap:15.6" --build-arg INSTALL_WORKER_FROM_PIP=Y .
docker build --tag local:rhel8-srpm --build-arg BASE_IMAGE=registry.access.redhat.com/ubi8 --build-arg INSTALL_WORKER_FROM_PIP=N .
  1. Run the container and copy rebuild-from-srpm.sh over
  2. Run the script. An example from AMD64 / Fedora-40 with parallel=7
    bash rebuild-from-srpm.sh https://ci.mariadb.org 54438 amd64-fedora-39-rpm-autobake 7

Mysteries of the day:

  • should include alma / rocky? If yes, should be tested with RH packages?
  • should include RHEL 7?
  • should include OpenEuler?

⚠️ I still need to manually bring the code on buildbot.dev.mariadb.org and test the framework. I tested the images / script in isolation but not integrated with buildbot.

Mark all OS's for which we re-build from source RPM.
has_srpm on Alma & Rocky can never be true if install_only=True (no autobake builders).
For each OS marked with has_srpm=True, define a builder list with extra information on arch,image,version and os.
We don't have enough infrastructure available on s390x to afford an srpm test.
- add an extra step to the rpm factory for triggering the newly defined "s_srpms" scheduler

An srpm builder can be triggered if:
- the parent builder (autobake) has a corresponding srpm builder, same os / os-version / arch
- branch is a main branch or release
- packages were generated

Later we will see that the srpm builder must download the rpm packages from ci.mariadb.org
re-build them from the source RPM and then compare CI vs produced packages.

Scheduler
- each autobake build instance has it's own instance of the "s_srpms" scheduler, a list of 1 item (the corresponding srpm builder)
The decision to define them in one of the /2 non-standard masters is based on the need for fine-grained control over worker allocation.
It is crucial to use RedHat based hosts so that RedHat containers are subscribed to the redhat.repo repositories.

The worker and builder allocation is governed by the BUILDERS_SRPMS constant.
While defining volumes for addWorker might seem repetitive, it was necessary,
as it is the only method to pass subscription data to the container in a Docker environment.

#FIXME Items:

We still need PPC and ARM-based Red Hat hosts to be subscribed.
The f_srpm factory is in progress.

(note): black master-docker-nonstandard/master.cfg does more than intended
@RazvanLiviuVarzaru RazvanLiviuVarzaru force-pushed the feature/MDBF-695 branch 2 times, most recently from ee139e4 to 3b49d0f Compare March 4, 2025 08:56
Minimal container images with:
- rpm tools installed
- extra repositories
- buildbot user
- buildbot-worker (pip or distro)

srpm.Dockerfile
- start with an upgrade to keep the image up to date (from standard repositories)
- capable to build any image that is in the supported $PLATFORM_ID / $ID lists
- wget: needed to retrieve RPMS/SRPMS from CI
- which: needed for checking the twistd version after installing from PIP
- sudo: some OS's do not come with sudo. Needed for buildbot user when building src.rpm deps
- perl-generators: server cannot compile without it, the same workaround found in old-bb. Ideally, building deps should retrieve this package
- rpm-build / yum-utils: tools needed to re-build RPM's
- dumb-init: needed to launch buildbot-worker process as PID 1 in container
If you don't need buildbot-worker just remove all code under #BUILDBOT-WORKER SETUP

Notable exceptions:
- UBI (RHEL) needs CRB repository i.e. a valid RH subscription. Run UBI containers on RedHat (subscribed) hosts.

build-srpm.yml
- not using the yaml template because this a more basic setup
- the same dev_ tags principle used
- runner upgraded to ubuntu-24.04 to overcome qemu-user-static ssl bug https://gitlab.com/qemu-project/qemu/-/issues/1471
- platforms: is based on os_info.yaml, without s390x and only OS's marked to rebuild from SRPM
The factory will fetch the script from the master and launch it.

About the script:
- will compare the resulting RPM's vs CI (their deps via rpm -q --requires) << as in old-bb >>
- download the rpms/srmps from CI, wget is used, hence the required paramaters:
  -  tarball_number and autobake_builder - inherited from the trigger (autobake)
  -  ci_base_url : dev / prod, based on the runtime environment
  -  jobs - control the number of CPU's used for make via _smp_mflags

- rebuilding works the same on all platforms via rpmbuild --rebuild
- based on $PLATFORM_ID / $ID some operations are platform specific:
  - enabling CRB repository [only rhel] - should run on a subscribed RedHat host
  - installing build time dependencies from source RPM specs

If a platform is deprecated or added, CASE lists should be updated.
Some "hacks" were preserved from old-bb:
- compat (all OS's)
- judy-devel (sles)

For reference please see the old-bb implementation: https://github.com/MariaDB/mariadb.org-tools/blob/198abd77ee023b45132ff2c9a9bdaac371a5a7e7/buildbot/maria-master.cfg#L1873
@RazvanLiviuVarzaru RazvanLiviuVarzaru changed the title Feature/mdbf 695 MDBF-695 - add srpm tests as in the old bb Mar 4, 2025
- pre-commit
- SRPM worker pool dictionary
- use only required volumes in SRPM_CONTAINER_VOLUMES
- fix tags for srpm builders (e.g. fedora instead of fedora-40, rhel instead of rhel-8, etc)
@RazvanLiviuVarzaru RazvanLiviuVarzaru marked this pull request as ready for review March 4, 2025 16:00
@RazvanLiviuVarzaru
Copy link
Collaborator Author

RazvanLiviuVarzaru commented Mar 4, 2025

@cvicentiu To keep things in motion, we can also run the Limited Edition ®️ of this patch, meaning only amd64 (both hosts from amd are RedHat) and add ppc64le & aarch64 later.

@cvicentiu
Copy link
Member

@cvicentiu To keep things in motion, we can also run the Limited Edition ®️ of this patch, meaning only amd64 (both hosts from amd are RedHat) and add ppc64le & aarch64 later.

agree. Let's start with AMD64

Copy link
Member

@grooverdan grooverdan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Started test with the following until ci.mariadb.org is still slow:

[buildbot@684c29aea73b ~]$ /mnt/rebuild-from-srpm.sh https://ci.mariadb.org 54075 "amd64-fedora-41-rpm-autobake" 16
Downloading RPM files to 'rpms/' directory...

optional: can commit the rebuild-from-srpm.sh with +x permissions.

- name: Build image
if: ${{ env.MAIN_BRANCH == 'false' }}
run: |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The oneline version:

$ buildah bud --manifest   bb-worker:fedora39-srpm --jobs 4  --platform=linux/amd64 --platform=linux/arm64/v8   --build-arg BASE_IMAGE=fedora:39  --build-arg INSTALL_WORKER_FROM_PIP=  ci_build_images/srpm.Dockerfile

or

buildah bud --manifest   bb-worker:fedora39-srpm --jobs 4 $(IFS=", "; for p in ${{ matrix.platforms }} ; do echo --platform=$p\ ; done ) --build-arg BASE_IMAGE=fedora:39  --build-arg INSTALL_WORKER_FROM_PIP=  

- dockerfile: srpm.Dockerfile
image: fedora:39
tag: fedora39-srpm
platforms: linux/amd64, linux/arm64/v8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think we can drop Fedora 39 now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, that's EOL since November 2024. Thanks!
Should we prepare a separate task to remove it all together?

@grooverdan
Copy link
Member

grooverdan commented Mar 5, 2025

Mysteries of the day:
should include alma / rocky?

Edging towards "No"

If yes, should be tested with RH packages?

If "yes' then "Yes"

should include RHEL 7?

Only if we're releasing form it again.

should include OpenEuler?

As we don't release this, thinking No.

@grooverdan
Copy link
Member

Started test with the following until ci.mariadb.org is still slow:

[buildbot@684c29aea73b ~]$ /mnt/rebuild-from-srpm.sh https://ci.mariadb.org 54075 "amd64-fedora-41-rpm-autobake" 16
Downloading RPM files to 'rpms/' directory...

optional: can commit the rebuild-from-srpm.sh with +x permissions.

finished and failed with:

+ CXX=g++
+ export CXX
+ cd MariaDB-11.4.6
+ mkdir cpack_rpm_build_dir
+ cd cpack_rpm_build_dir
+ /usr/bin/cmake -DRPM=fedora41 -DMYSQL_MAINTAINER_MODE=AUTO -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_CONFIG=mysql_release -DWITH_SSL=system -DCPACK_PACKAGING_INSTALL_PREFIX=/ ../mariadb-11.4.6
-- The C compiler identification is GNU 14.2.1
CMake Error at /usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake:48 (message):
  Could not find compiler set in environment variable CXX:

  g++.

Call Stack (most recent call first):
  CMakeLists.txt:40 (PROJECT)


CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
error: Bad exit status from /var/tmp/rpm-tmp.PFGtIg (%build)

RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.PFGtIg (%build)
[buildbot@684c29aea73b ~]$ g++ --version
bash: g++: command not found
[buildbot@684c29aea73b ~]$ find / -name g++
# (not found)

@RazvanLiviuVarzaru
Copy link
Collaborator Author

Started test with the following until ci.mariadb.org is still slow:

[buildbot@684c29aea73b ~]$ /mnt/rebuild-from-srpm.sh https://ci.mariadb.org 54075 "amd64-fedora-41-rpm-autobake" 16
Downloading RPM files to 'rpms/' directory...

optional: can commit the rebuild-from-srpm.sh with +x permissions.

Though about that, yes, that's better. Thanks!

@RazvanLiviuVarzaru
Copy link
Collaborator Author

Started test with the following until ci.mariadb.org is still slow:

[buildbot@684c29aea73b ~]$ /mnt/rebuild-from-srpm.sh https://ci.mariadb.org 54075 "amd64-fedora-41-rpm-autobake" 16
Downloading RPM files to 'rpms/' directory...

optional: can commit the rebuild-from-srpm.sh with +x permissions.

finished and failed with:

+ CXX=g++
+ export CXX
+ cd MariaDB-11.4.6
+ mkdir cpack_rpm_build_dir
+ cd cpack_rpm_build_dir
+ /usr/bin/cmake -DRPM=fedora41 -DMYSQL_MAINTAINER_MODE=AUTO -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_CONFIG=mysql_release -DWITH_SSL=system -DCPACK_PACKAGING_INSTALL_PREFIX=/ ../mariadb-11.4.6
-- The C compiler identification is GNU 14.2.1
CMake Error at /usr/share/cmake/Modules/CMakeDetermineCXXCompiler.cmake:48 (message):
  Could not find compiler set in environment variable CXX:

  g++.

Call Stack (most recent call first):
  CMakeLists.txt:40 (PROJECT)


CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
error: Bad exit status from /var/tmp/rpm-tmp.PFGtIg (%build)

RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.PFGtIg (%build)
[buildbot@684c29aea73b ~]$ g++ --version
bash: g++: command not found
[buildbot@684c29aea73b ~]$ find / -name g++
# (not found)

@grooverdan Is true that I didn't had the chance to test on all platforms, in some, g++ was installed as part of building the dependencies from the source RPM.

How to classify this problem? Something wrong in the source RPM or should I have installed gcc in the image?

@RazvanLiviuVarzaru
Copy link
Collaborator Author

Mysteries of the day:
should include alma / rocky?

Edging towards "No"

If yes, should be tested with RH packages?

If "yes' then "Yes"

should include RHEL 7?

Only if we're releasing form it again.

should include OpenEuler?

As we don't release this, thinking No.

Thanks,
For RHEL 7 I am waiting on #719 to be reviewed by @cvicentiu , then merge and test.
If that patch gets validated, yes, I can add rh7.

@RazvanLiviuVarzaru
Copy link
Collaborator Author

RazvanLiviuVarzaru commented Mar 6, 2025

amd64-fedora-41-rpm-autobake

@grooverdan Looking on what we have on mirror,
I tested for Fedora-39, for our packages, no gcc-c++ in the list.
For the src.rpm from mirros, yes.

https://mirror.mariadb.org/yum/10.11/fedora39-amd64/srpms/MariaDB-10.11.11-1.fc39.src.rpm
sudo dnf --setopt=install_weak_deps=False builddep MariaDB-10.11.11-1.fc39.src.rpm

================================================================================================================================================
 Package                                     Architecture          Version                                         Repository              Size
================================================================================================================================================
Installing:
 Judy-devel                                  x86_64                1.0.5-32.fc39                                   fedora                  88 k
 bison                                       x86_64                3.8.2-5.fc39                                    fedora                 1.0 M
 boost-devel                                 x86_64                1.81.0-11.fc39                                  updates                 14 M
 bzip2-devel                                 x86_64                1.0.8-16.fc39                                   fedora                 214 k
 checkpolicy                                 x86_64                3.5-3.fc39                                      fedora                 349 k
 cmake                                       x86_64                3.30.5-1.fc39                                   updates                9.7 M
 cracklib-devel                              x86_64                2.9.11-2.fc39                                   fedora                  11 k
 flex                                        x86_64                2.6.4-13.fc39                                   fedora                 312 k
 gcc                                         x86_64                13.3.1-3.fc39                                   updates                 34 M
 gcc-c++                                     x86_64                13.3.1-3.fc39                                   updates                 13 M


https://mirror.mariadb.org/yum/11.4/fedora39-amd64/srpms/MariaDB-11.4.5-1.fc39.src.rpm
sudo dnf --setopt=install_weak_deps=False builddep MariaDB-11.4.5-1.fc39.src.rpm

================================================================================================================================================
Package                                     Architecture          Version                                         Repository              Size
================================================================================================================================================
Installing:
Judy-devel                                  x86_64                1.0.5-32.fc39                                   fedora                  88 k
bison                                       x86_64                3.8.2-5.fc39                                    fedora                 1.0 M
boost-devel                                 x86_64                1.81.0-11.fc39                                  updates                 14 M
bzip2-devel                                 x86_64                1.0.8-16.fc39                                   fedora                 214 k
checkpolicy                                 x86_64                3.5-3.fc39                                      fedora                 349 k
cmake                                       x86_64                3.30.5-1.fc39                                   updates                9.7 M
cracklib-devel                              x86_64                2.9.11-2.fc39                                   fedora                  11 k
flex                                        x86_64                2.6.4-13.fc39                                   fedora                 312 k
gcc                                         x86_64                13.3.1-3.fc39                                   updates                 34 M
gcc-c++                                     x86_64                13.3.1-3.fc39                                   updates                 13 M


Trying with an older tarball wget https://ci.mariadb.org/53090/amd64-fedora-39-rpm-autobake/srpms/MariaDB-10.11.11-1.fc39.src.rpm
gcc-c++ still missing. So I suspect something wrong with our build environment.

@RazvanLiviuVarzaru
Copy link
Collaborator Author

@grooverdan @cvicentiu
About the missing gcc-c++ in Fedora. See my tests below.

Test case:

  • OS: Fedora-39 (buildbot build environment from QUAY)
  • arch: doesn't matter
  • MariaDB Server: doesn't matter
  • Scope: Observing CPackSourceConfig.cmake

cmake . -DBUILD_CONFIG=mysql_release -DRPM=fedora39

    /home/buildbot/padding_for_CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX/cmake/build_depends.cmake(35):  FIND_DEP(${V} rpm -q --qf %{NAME} -f ${${V}} )
    /home/buildbot/padding_for_CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX/cmake/build_depends.cmake(3):  SET(out CMAKE_C_COMPILER_DEP ) 
    /home/buildbot/padding_for_CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX/cmake/build_depends.cmake(4):  IF(NOT DEFINED ${out} )
    /home/buildbot/padding_for_CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX/cmake/build_depends.cmake(5):  IF(EXISTS ${CMAKE_C_COMPILER} AND NOT IS_DIRECTORY ${CMAKE_C_COMPILER} )
    /home/buildbot/padding_for_CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX/cmake/build_depends.cmake(6):  EXECUTE_PROCESS(COMMAND rpm;-q;--qf;%{NAME};-f;/usr/lib64/ccache/cc RESULT_VARIABLE res OUTPUT_VARIABLE O OUTPUT_STRIP_TRAILING_WHITESPACE )
    /home/buildbot/padding_for_CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX/cmake/build_depends.cmake(3):  SET(out CMAKE_CXX_COMPILER_DEP )
    /home/buildbot/padding_for_CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX/cmake/build_depends.cmake(4):  IF(NOT DEFINED ${out} )
    /home/buildbot/padding_for_CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX/cmake/build_depends.cmake(5):  IF(EXISTS ${CMAKE_CXX_COMPILER} AND NOT IS_DIRECTORY ${CMAKE_CXX_COMPILER} )
    /home/buildbot/padding_for_CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX/cmake/build_depends.cmake(6):  EXECUTE_PROCESS(COMMAND rpm;-q;--qf;%{NAME};-f;/usr/lib64/ccache/c++ RESULT_VARIABLE res OUTPUT_VARIABLE O OUTPUT_STRIP_TRAILING_WHITESPACE )

Results => gcc+c++ missing, ccache instead

set(CPACK_RPM_BUILDREQUIRES "gawk bison boost-devel coreutils checkpolicy binutils cmake ccache gcc make libcurl-devel ncurses-devel systemtap-sdt-devel libevent-devel flex cracklib-devel glibc-devel zlib-devel lz4-devel xz-devel pcre2-devel systemd-devel libxcrypt-devel java-1.8.0-openjdk java-1.8.0-openjdk-headless Judy-devel krb5-devel libaio-devel libedit-devel libxml2-devel libxml2 unixODBC-devel openssl-devel pam-devel pkgconf-pkg-config readline-devel policycoreutils snappy-devel liburing-devel libzstd-devel")

Now:

[root@991de8514535 buildbot]# dnf remove ccache
========================================================================================================================================================================================
 Package                                    Architecture                              Version                                          Repository                                  Size
========================================================================================================================================================================================
Removing:
 ccache                                     x86_64                                    4.8.2-2.fc39                                     @fedora                                    1.5 M
Removing unused dependencies:
 hiredis                                    x86_64                                    1.0.2-5.fc39                                     @fedora                                     82 k

Problem partially solved, we have gcc-c++
but we can't use CCACHE anymore and we need it to speed up the builds.

set(CPACK_RPM_BUILDREQUIRES "gawk bison boost-devel coreutils checkpolicy binutils cmake gcc-c++ gcc make libcurl-devel ncurses-devel systemtap-sdt-devel libevent-devel flex cracklib-devel glibc-devel zlib-devel lz4-devel xz-devel pcre2-devel systemd-devel libxcrypt-devel java-1.8.0-openjdk java-1.8.0-openjdk-headless Judy-devel krb5-devel libaio-devel libedit-devel libxml2-devel libxml2 unixODBC-devel openssl-devel pam-devel pkgconf-pkg-config readline-devel policycoreutils snappy-devel liburing-devel libzstd-devel")

@RazvanLiviuVarzaru
Copy link
Collaborator Author

RazvanLiviuVarzaru commented Mar 6, 2025

Regarding the problem above, notable differences between OS's.

In this first case (OpenSuse)
compiler launcher is ccache indeed by

-DCMAKE_C_COMPILER_LAUNCHER=ccache 
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache

But the compilers will be indeed g++ and gcc as opposed to the second case (Fedora).

buildbot@cd22ebebdaed:~> echo $ID
opensuse-leap
buildbot@cd22ebebdaed:~> which gcc
/usr/bin/gcc
buildbot@cd22ebebdaed:~> which g++
/usr/bin/g++
buildbot@cd22ebebdaed:~> which ccache
/usr/bin/ccache

[buildbot@92bbd3214e59 ~]$ echo $ID
fedora
[buildbot@92bbd3214e59 ~]$ which gcc
/usr/lib64/ccache/gcc
[buildbot@92bbd3214e59 ~]$ which g++
/usr/lib64/ccache/g++
[buildbot@92bbd3214e59 ~]$ which ccache
/usr/bin/ccache

It's all about whether or not the ccache package creates the symlinks.
This should be addressed server side.

A possible workaround is to pin the compiler using environment variables like so:

export CXX=/usr/bin/g++
export CC=/usr/bin/gcc

Then, normally:
sh -c 'export PATH=/usr/lib/ccache:/usr/lib64/ccache:$PATH && cmake . -DBUILD_CONFIG=mysql_release -DRPM=fedora39 -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache '

Which results in the correct deps:

[buildbot@92bbd3214e59 padding_for_CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX]$ cat CPackSourceConfig.cmake | grep CPACK_RPM_BUILDREQUIRES
set(CPACK_RPM_BUILDREQUIRES "bison boost-devel coreutils checkpolicy binutils cmake gcc-c++ gcc make libcurl-devel ncurses-devel systemtap-sdt-devel libevent-devel libaio-devel cracklib-devel glibc-devel zlib-devel lz4-devel xz-devel pcre2-devel systemd-devel libxcrypt-devel java-1.8.0-openjdk java-1.8.0-openjdk-headless Judy-devel krb5-devel libedit-devel libxml2-devel libxml2 unixODBC-devel openssl-devel pam-devel pkgconf-pkg-config readline-devel policycoreutils libzstd-devel snappy-devel")

And Compiler Launcher is OK:
make -j2 VERBOSE=1

cd /home/buildbot/padding_for_CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX/libmariadb && ccache /usr/bin/gcc -DHAVE_CONFIG_H -DHAVE_EMBEDDED -DHAVE_OPENSSL -DHAVE_REMOTEIO=1 -DHAVE_TLS -DMARIADB_MACHINE_TYPE=\"x86_64\" -DMARIADB_SYSTEM_TYPE=\"Linux\" -D_FILE_OFFSET_BITS=64 -Dclient_ed25519_EXPORTS -I/home/buildbot/padding_for_CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX/libmariadb/include -I/home/buildbot/padding_for_CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX/libmariadb/plugins/auth -I/home/buildbot/padding_for_CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX/libmariadb/plugins/auth/ref10 -I/home/buildbot/padding_for_CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX/libmariadb/plugins/pvio -pie -fPIC -fstack-protector --param=ssp-buffer-size=4 -Wunused -Wlogical-op -Wno-uninitialized -Wall -Wextra -Wformat-security -Wno-init-self -Wwrite-strings -Wshift-count-overflow -Wdeclaration-after-statement -Wno-undef -Wno-unknown-pragmas -Wno-stringop-truncation -O3 -g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing  -Wno-uninitialized -fno-omit-frame-pointer -D_FORTIFY_SOURCE=2 -DDBUG_OFF -Wall -Wdeclaration-after-statement -Wenum-compare -Wenum-conversion -Wextra -Wno-format-truncation -Wno-init-self -Wno-nonnull-compare -Wno-unused-parameter -Wvla -Wwrite-strings -DDBUG_OFF -std=gnu99 -fPIC -DPLUGIN_DYNAMIC=1 -DMYSQL_CLIENT=1 -MD -MT libmariadb/CMakeFiles/client_ed25519.dir/plugins/auth/ref10/fe_neg.c.o -MF CMakeFiles/client_ed25519.dir/plugins/auth/ref10/fe_neg.c.o.d -o CMakeFiles/client_ed25519.dir/plugins/auth/ref10/fe_neg.c.o -c /home/buildbot/padding_for_CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX/libmariadb/plugins/auth/ref10/fe_neg.c

Copy link
Collaborator

@fauust fauust left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking very good, nice job @RazvanLiviuVarzaru. See my comments though (with my maintenance hat on).

set -eu

if [ $# -ne 4 ]; then
echo "Usage: $0 <ci_base_url> <tarball_number> <autobake_builder> <<no_of_jobs>>"
Copy link
Collaborator

@fauust fauust Mar 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the bash library (bash_lib.sh) and bb_log_* functions (also in the rest of the script).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mm, I need to copy it over alongside this script.
But I am worried more about sourcing a lot of settings around set - {x,e,u} and I can't predict the behavior in this script.
Any advice?

Copy link
Collaborator

@fauust fauust Mar 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mm, I need to copy it over alongside this script.

Yes but that's the default behavior anyway for all the tests.

Default options are sane, the script should be working with those (appart maybe the unbound which can be bypassed momentarily, see

).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then this is the way to go, I am not really afraid of unbound, because this srpm script won't grow to the point we can't keep track of variable allocations.

I really like the logging functions under bash_lib but I was a bit afraid to source such a big library of functions.

About the "default behavior" .
I changed a bit the way we use the script. It's now pushed by the master -> worker, not the worker taking it for GitHub. I did this because I am not 100 % on boarded with our current of way of working where updating a script in GitHub has immediate production impact.


# Download RPMS / SRPMS from CI
echo "Downloading RPM files to 'rpms/' directory..."
wget -r -l1 -H -nd -A "*.rpm" "$base_url/rpms/" -P rpms/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we use the mirror directly (like for rpm_upgrade and rpm_install steps). I took quite some time trying to skip fetching rpms during thoses steps because appart from testing that what we produce is alright it also tests that our mirrors are working correctly.

As a reminder, the final goal is to have BB testing the mirrors (on ci.buildbot.org) as they will look when we automate the releases.

Copy link
Collaborator Author

@RazvanLiviuVarzaru RazvanLiviuVarzaru Mar 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only need to download the RPM's and do nothing with them other than compare.
Is it worth to setup the repository? I think this implies sourcing bash_lib also and be extra careful at every << platform >> specific way of setting up the repository.

Let's say this is done.
But then what's the approach for downloading the RPM's not installing them?

I am not against the idea, thought about it in my plan but I felt that I over-complicate my life and we already officially test the mirrors properly on dedicated Install / Upgrade builders.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sufficiently expert with RPM (and even less with SRPM) to judge.
So, let's say this that way: how are our user consuming srpms, if they download them to build rpms then I am ok with your approach, if they just point to the correct repository (I believe like apt does with deb-src), then we might want to make sure that our repositories also works for that.

Copy link
Collaborator Author

@RazvanLiviuVarzaru RazvanLiviuVarzaru Mar 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They would probably (I am not sure, but makes sense) do it like that,

sudo dnf download --source <package-name>

or

yumdownloader --source <package-name>

Copy link
Collaborator Author

@RazvanLiviuVarzaru RazvanLiviuVarzaru Mar 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me check what I can accomplish around dnf download.

I see DNF has a download-dir also (good)
Zypper (SUSE) has a download, not a dir specification.

And these kind of differences makes everything painful.
But let's see.

&& echo 'buildbot ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers;

## BUILDBOT-WORKER SETUP
# Install worker from pip
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is duplicated code from pip.Dockerfile, can't we use it instead?

Copy link
Collaborator Author

@RazvanLiviuVarzaru RazvanLiviuVarzaru Mar 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer a standalone Dockerfile that can be built locally without cat << this >> << that >>

When we get rid of docker-latent-worker this will be simplified a lot so I am not expecting to keep anything under ## BUILDBOT-WORKER SETUP for too long.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about this approach moby/moby#735 (comment)?

Copy link
Collaborator Author

@RazvanLiviuVarzaru RazvanLiviuVarzaru Mar 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guess you are referring to the make approach in moby/moby#735 (comment) , right?

It sounds like a great idea to have something like a template-engine / pre-processor capable of much more.
It's better than our cat < this > < that > acting like a stone-age pre-processor.

But I will keep it for later, when we get rid of DockerLatentWorker.
Because the vast majority of our Dockerfiles are just adding up buildbot-worker and pip (which will be removed).

For the few exceptions that will remain after that we can either think of a pre-processor (really like the make approach) or use docker multi-stage where possible.


# Get buildbot.tac and use the right twistd
# some distributions install twistd3 instead of twistd \
RUN if ! which twistd >/dev/null; then \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment, duplicated code from ci_build_images/buildbot-worker.Dockerfile, can't we use it?

Copy link
Collaborator Author

@RazvanLiviuVarzaru RazvanLiviuVarzaru Mar 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as for pip with the following addition:
I modified the code to give sudo access for buildbot on RPM based systems + some workarounds near /etc/sudoers to make that happen.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if that's not duplicated code strictly then I am ok with it.

&& chmod +r /home/buildbot/buildbot.tac

# install dumb-init to launch worker process as pid 1
RUN curl -sLo /usr/local/bin/dumb-init "https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_$(uname -m)" \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment, and I see that this is already duplicated elsewhere.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually duplicated in every << os >>.Dockerfile , except the ones that actually have the dumb-init package.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

which makes upgrading dumb-init painfull...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't be needed when we get rid of docker-latent-worker. Which is far more painful :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants