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

Add support for building and testing mariadb-container on RHEL10 #262

Merged
merged 4 commits into from
Jan 16, 2025

Conversation

phracek
Copy link
Member

@phracek phracek commented Jan 14, 2025

The pull request is separated into two commits.

The first commit adds support for building and testing mariadb-container especially version '10.11' on RHEL10.
The second commit updates README.md file with RHEL10 support.

Copy link

github-actions bot commented Jan 14, 2025

Pull Request validation

Success

🟢 CI - All checks have passed
🟢 Review - Reviewed by a member
🟢 Approval - Changes were approved


Auto Merge

Failed

🔴 Pull Request has unsupported target branch master, expected branches are: ''

Success

🟢 Pull Request is not marked as draft and it's not blocked by dont-merge label
🟢 Pull Request meet requirements, title has correct form
🟢 Pull Request meet requirements, mergeable is true
🟢 Pull Request meet requirements, mergeable_state is clean

@phracek
Copy link
Member Author

phracek commented Jan 14, 2025

Differences between C10S and RHEL10 are here:

diff -u 10.11/Dockerfile.c10s 10.11/Dockerfile.rhel10
--- 10.11/Dockerfile.c10s       2024-11-04 14:50:40
+++ 10.11/Dockerfile.rhel10     2025-01-14 10:21:43
@@ -1,4 +1,4 @@
-FROM quay.io/sclorg/s2i-core-c10s:c10s
+FROM registry.stage.redhat.io/ubi10/s2i-core

 # MariaDB image for OpenShift.
 #
@@ -29,9 +29,9 @@
       io.openshift.expose-services="3306:mysql" \
       io.openshift.tags="database,mysql,mariadb,mariadb1011,mariadb-1011" \
       com.redhat.component="$NAME-1011-container" \
-      name="sclorg/$NAME-1011-c10s" \
+      name="rhel10/mariadb-1011" \
       version="1" \
-      usage="podman run -d -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 quay.io/sclorg/$NAME-1011-c10s" \
+      usage="podman run -d -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 rhel10/mariadb-1011" \
       maintainer="SoftwareCollections.org <[email protected]>"

 EXPOSE 3306

Differences between RHEL9 and RHEL10 are:

diff -u 10.11/Dockerfile.rhel9 10.11/Dockerfile.rhel10
--- 10.11/Dockerfile.rhel9      2024-05-09 12:28:45
+++ 10.11/Dockerfile.rhel10     2025-01-14 10:21:43
@@ -1,4 +1,4 @@
-FROM ubi9/s2i-core
+FROM registry.stage.redhat.io/ubi10/s2i-core

 # MariaDB image for OpenShift.
 #
@@ -13,6 +13,9 @@
 ENV MYSQL_VERSION=10.11 \
     APP_DATA=/opt/app-root/src \
     HOME=/var/lib/mysql \
+    NAME=mariadb \
+    VERSION=10.11 \
+    ARCH=x86_64 \
     SUMMARY="MariaDB 10.11 SQL database server" \
     DESCRIPTION="MariaDB is a multi-user, multi-threaded SQL database server. The container \
 image provides a containerized packaging of the MariaDB mysqld daemon and client application. \
@@ -22,13 +25,13 @@
 LABEL summary="$SUMMARY" \
       description="$DESCRIPTION" \
       io.k8s.description="$DESCRIPTION" \
-      io.k8s.display-name="MariaDB 10.11" \
+      io.k8s.display-name="MariaDB $VERSION" \
       io.openshift.expose-services="3306:mysql" \
       io.openshift.tags="database,mysql,mariadb,mariadb1011,mariadb-1011" \
-      com.redhat.component="mariadb-1011-container" \
-      name="rhel9/mariadb-1011" \
+      com.redhat.component="$NAME-1011-container" \
+      name="rhel10/mariadb-1011" \
       version="1" \
-      usage="podman run -d -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 rhel9/mariadb-1011" \
+      usage="podman run -d -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 rhel10/mariadb-1011" \
       maintainer="SoftwareCollections.org <[email protected]>"

 EXPOSE 3306
@@ -36,12 +39,11 @@
 # This image must forever use UID 27 for mysql user so our volumes are
 # safe in the future. This should *never* change, the last test is there
 # to make sure of that.
-RUN yum -y module enable mariadb:$MYSQL_VERSION && \
-    INSTALL_PKGS="policycoreutils rsync tar gettext hostname bind-utils groff-base mariadb-server" && \
-    yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \
+RUN INSTALL_PKGS="policycoreutils rsync tar xz gettext hostname bind-utils groff-base mariadb-server" && \
+    dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \
     rpm -V $INSTALL_PKGS && \
     /usr/libexec/mysqld -V | grep -qe "$MYSQL_VERSION\." && echo "Found VERSION $MYSQL_VERSION" && \
-    yum -y clean all --enablerepo='*' && \
+    dnf -y clean all --enablerepo='*' && \
     mkdir -p /var/lib/mysql/data && chown -R mysql.0 /var/lib/mysql && \
     test "$(id mysql)" = "uid=27(mysql) gid=27(mysql) groups=27(mysql)"

@phracek
Copy link
Member Author

phracek commented Jan 14, 2025

Local tests PASSED:

==============================================
Tests were run for image rhel10/mariadb-1011:1
==============================================
Test cases results:

 [PASSED] for 'appnamenotset' run_container_creation_tests (00:00:06)
 [PASSED] for 'appnamenotset' run_configuration_tests (00:00:13)
 [PASSED] for 'appnamenotset' run_general_tests (00:00:41)
 [PASSED] for 'appnamenotset' run_change_password_test (00:00:10)
 [PASSED] for 'appnamenotset' run_change_password_new_user_test (00:00:10)
 [PASSED] for 'appnamenotset' run_replication_test (00:00:09)
 [PASSED] for 'appnamenotset' run_s2i_test (00:00:17)
 [PASSED] for 'appnamenotset' run_ssl_test (00:00:08)
 [PASSED] for 'appnamenotset' run_upgrade_test (00:00:33)
 [PASSED] for 'appnamenotset' run_plugin_test (00:00:06)

Tests for rhel10/mariadb-1011:1 succeeded.

@phracek
Copy link
Member Author

phracek commented Jan 14, 2025

Let's first shot.

[test]

Copy link

github-actions bot commented Jan 14, 2025

Testing Farm results

namecomposearchstatusstarted (UTC)timelogs
CentOS Stream 10 - 10.11CentOS-Stream-10x86_64✅ passed15.01.2025 09:59:396min 44stest pipeline
CentOS Stream 9 - 10.5CentOS-Stream-9x86_64✅ passed15.01.2025 09:59:487min 23stest pipeline
CentOS Stream 9 - 10.11CentOS-Stream-9x86_64✅ passed15.01.2025 09:59:397min 33stest pipeline
Fedora - 10.5Fedora-latestx86_64✅ passed15.01.2025 09:59:4712min 39stest pipeline
RHEL10 - 10.11RHEL-10-Nightlyx86_64✅ passed15.01.2025 09:59:3915min test pipeline
RHEL9 - 10.5RHEL-9.4.0-Nightlyx86_64✅ passed15.01.2025 09:59:5717min 10stest pipeline
RHEL9 - 10.11RHEL-9.4.0-Nightlyx86_64✅ passed15.01.2025 09:59:4018min 6stest pipeline
RHEL8 - 10.5RHEL-8.10.0-Nightlyx86_64✅ passed15.01.2025 09:59:5818min 49stest pipeline
RHEL8 - 10.11RHEL-8.10.0-Nightlyx86_64✅ passed15.01.2025 09:59:3919min 19stest pipeline
RHEL8 - 10.3RHEL-8.10.0-Nightlyx86_64✅ passed15.01.2025 09:59:3921min 1stest pipeline

10.11/Dockerfile.rhel10 Outdated Show resolved Hide resolved
@phracek
Copy link
Member Author

phracek commented Jan 14, 2025

[test]

Copy link
Member

@ljavorsk ljavorsk left a comment

Choose a reason for hiding this comment

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

LGTM

rpm -V $INSTALL_PKGS && \
/usr/libexec/mysqld -V | grep -qe "$MYSQL_VERSION\." && echo "Found VERSION $MYSQL_VERSION" && \
dnf -y clean all --enablerepo='*' && \
mkdir -p /var/lib/mysql/data && chown -R mysql.0 /var/lib/mysql && \

Choose a reason for hiding this comment

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

chown -R mysql.0
Is the user really named mysql.0, or is it just a typo from mysql or mysql:0 ?

Copy link
Member

@ljavorsk ljavorsk Jan 14, 2025

Choose a reason for hiding this comment

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

It's even present in every dockerfile (fedora, centos, rhel) in every version

Copy link
Member Author

@phracek phracek Jan 15, 2025

Choose a reason for hiding this comment

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

As you can see here. It is present for really long. time. I have google it find in 'coreutils'
https://serverfault.com/questions/194295/using-dot-as-delimiter-to-specify-group-in-chown

Some older scripts may still use '.' in place of the ':' separator. POSIX 1003.1-2001
(see [Standards conformance](http://www.gnu.org/software/coreutils/manual/html_node/Standards-conformance.html))
does not require support for that, but for backward compatibility GNU chown supports '.' so long as no ambiguity results.
New scripts should avoid the use of '.' because it is not portable,
and because it has undesirable results if the entire owner'.'group happens to identify a user whose name contains '.'.

Copy link
Member

Choose a reason for hiding this comment

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

Some older scripts may still use ‘.’ in place of the ‘:’ separator. POSIX 1003.1-2001 (see Standards conformance) does not require support for that, but for backward compatibility GNU chown supports ‘.’ so long as no ambiguity results, although it issues a warning and support may be removed in future versions. New scripts should avoid the use of ‘.’ because it is not portable, and because it has undesirable results if the entire owner‘.’group happens to identify a user whose name contains ‘.’.

From: https://www.gnu.org/software/coreutils/manual/html_node/chown-invocation.html#chown-invocation

Copy link
Member Author

Choose a reason for hiding this comment

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

After a discussion let's change it got ':' only for relevant Dockerfiles.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is fixed by 41d3ed4

Choose a reason for hiding this comment

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

While we are at it, I suggest to clear it up a bit more, and use the same data type in the whole expression, so either only integers 27:0 or preferably only strings mysql:root

----
Some older scripts may still use '.' in place of the ':' separator. POSIX 1003.1-2001
(see [Standards conformance](http://www.gnu.org/software/coreutils/manual/html_node/Standards-conformance.html))
does not require support for that, but for backward compatibility GNU chown supports '.' so long as no ambiguity results.
New scripts should avoid the use of '.' because it is not portable,
and because it has undesirable results if the entire owner'.'group happens to identify a user whose name contains '.'.
----

Signed-off-by: Petr "Stone" Hracek <[email protected]>
@phracek
Copy link
Member Author

phracek commented Jan 15, 2025

Let's test it again after change chown from '.' to ':'

[test]

@phracek phracek merged commit 5c55819 into master Jan 16, 2025
11 checks passed
@phracek phracek deleted the building_testing_rhel10 branch January 16, 2025 13:34
FaramosCZ added a commit to FaramosCZ/mariadb-container that referenced this pull request Jan 16, 2025
1) Use common ':' separator instead of unusual '.' one, as disscussed here:
   sclorg#262 (comment)

2) Use the same data type in the whole expression,
   so either only integers '27:0' or preferably only strings 'mysql:root'
   as suggested here:
   sclorg#262 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants