You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by mc...@apache.org on 2022/02/01 14:47:50 UTC

[cassandra-builds] branch trunk updated: For rpm packaging replace centos8 docker images with almalinux

This is an automated email from the ASF dual-hosted git repository.

mck pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra-builds.git


The following commit(s) were added to refs/heads/trunk by this push:
     new c29f680  For rpm packaging replace centos8 docker images with almalinux
c29f680 is described below

commit c29f6802329df0ef40f4a415e9e9fa2ad94c2c7e
Author: Mick Semb Wever <mc...@apache.org>
AuthorDate: Tue Feb 1 00:00:11 2022 +0100

    For rpm packaging replace centos8 docker images with almalinux
    
     patch by Mick Semb Wever; reviewed by Brandon Williams for CASSANDRA-17331
---
 README.md                                |  4 +--
 build-scripts/cassandra-rpm-packaging.sh |  8 +++---
 docker/almalinux-image.docker            | 48 ++++++++++++++++++++++++++++++++
 docker/build-rpms.sh                     |  2 +-
 4 files changed, 55 insertions(+), 7 deletions(-)

diff --git a/README.md b/README.md
index 9a1597a..2d79a87 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,7 @@ Prior to release, make sure to edit:
    * Debian:
    ```docker build -t cass-build-debs -f docker/jessie-image.docker docker/```
    * RPM:
-   ```docker build -t cass-build-rpms -f docker/centos8-image.docker docker/```
+   ```docker build -t cass-build-rpms -f docker/almalinux-image.docker docker/```
    The image will contain a clone of the Apache git repository by default. Using a different repository is possible by adding the `--build-arg CASSANDRA_GIT_URL=https://github.com/myuser/cassandra.git` parameter. All successive builds will be executed based on the repository cloned during docker image creation.
 2. Run build script through docker (specify branch, e.g. cassandra-3.0 and version, e.g. 3.0.11):
    * Debian Jessie:
@@ -33,7 +33,7 @@ Prior to release, make sure to edit:
    * Debian Buster
     ```docker run --rm -v `pwd`/dist:/dist `docker images -f label=org.cassandra.buildenv=buster -q` /home/build/build-debs.sh <branch/tag>```
    * RPM:
-    ```docker run --rm -v `pwd`/dist:/dist `docker images -f label=org.cassandra.buildenv=centos -q` /home/build/build-rpms.sh <branch/tag>```
+    ```docker run --rm -v `pwd`/dist:/dist `docker images -f label=org.cassandra.buildenv=almalinux -q` /home/build/build-rpms.sh <branch/tag>```
 
 For the build by Debian Buster, you have the possibility to build Cassandra either by Java 8 (default) or by Java 11. You control the Java version like following. If you want to build with Java 8, just omit that last option.
 
diff --git a/build-scripts/cassandra-rpm-packaging.sh b/build-scripts/cassandra-rpm-packaging.sh
index 7321613..8737d4b 100755
--- a/build-scripts/cassandra-rpm-packaging.sh
+++ b/build-scripts/cassandra-rpm-packaging.sh
@@ -26,19 +26,19 @@ java_version=$2
 command -v docker >/dev/null 2>&1 || { echo >&2 "docker needs to be installed"; exit 1; }
 (docker info >/dev/null 2>&1) || { echo >&2 "docker needs to running"; exit 1; }
 [ -d "${cassandra_builds_dir}" ] || { echo >&2 "cassandra-builds directory must exist"; exit 1; }
-[ -f "${cassandra_builds_dir}/docker/centos8-image.docker" ] || { echo >&2 "docker/centos8-image.docker must exist"; exit 1; }
+[ -f "${cassandra_builds_dir}/docker/almalinux-image.docker" ] || { echo >&2 "docker/almalinux-image.docker must exist"; exit 1; }
 [ -f "${cassandra_builds_dir}/docker/build-rpms.sh" ] || { echo >&2 "docker/build-rpms.sh must exist"; exit 1; }
 
 # remove any previous older built images
-docker image prune --all --force --filter label=org.cassandra.buildenv=centos --filter "until=4h" || true
+docker image prune --all --force --filter label=org.cassandra.buildenv=almalinux --filter "until=4h" || true
 
 pushd $cassandra_builds_dir
 
 # Create build images containing the build tool-chain, Java and an Apache Cassandra git working directory
-docker build --build-arg CASSANDRA_GIT_URL=$CASSANDRA_GIT_URL -t cassandra-artifacts-centos8:${sha} -f docker/centos8-image.docker docker/
+docker build --build-arg CASSANDRA_GIT_URL=$CASSANDRA_GIT_URL -t cassandra-artifacts-almalinux:${sha} -f docker/almalinux-image.docker docker/
 
 # Run build script through docker (specify branch, tag, or sha)
 chmod 777 "${rpm_dir}"
-docker run --rm -v "${rpm_dir}":/dist cassandra-artifacts-centos8:${sha} /home/build/build-rpms.sh ${sha} ${java_version}
+docker run --rm -v "${rpm_dir}":/dist cassandra-artifacts-almalinux:${sha} /home/build/build-rpms.sh ${sha} ${java_version}
 
 popd
diff --git a/docker/almalinux-image.docker b/docker/almalinux-image.docker
new file mode 100644
index 0000000..30493e0
--- /dev/null
+++ b/docker/almalinux-image.docker
@@ -0,0 +1,48 @@
+FROM almalinux:8
+
+ENV BUILD_HOME=/home/build
+ENV RPM_BUILD_DIR=$BUILD_HOME/rpmbuild
+ENV RPM_DIST_DIR=/dist
+ENV CASSANDRA_DIR=$BUILD_HOME/cassandra
+
+LABEL org.cassandra.buildenv=almalinux
+
+VOLUME ${RPM_DIST_DIR}
+
+# install deps
+RUN yum -y install \
+   ant \
+   git \
+   java-1.8.0-openjdk-devel \
+   java-11-openjdk-devel \
+   make \
+   rpm-build \
+   sudo \
+   python3-pip
+
+RUN until curl -S -s --retry 9 --retry-connrefused --retry-delay 1 http://mirror.centos.org/centos/7/os/x86_64/Packages/ant-junit-1.9.4-2.el7.noarch.rpm -o ant-junit-1.9.4-2.el7.noarch.rpm ; do echo "curl failed… trying again… " ; done
+
+RUN rpm -i --nodeps ant-junit-1.9.4-2.el7.noarch.rpm
+
+RUN pip3 install --upgrade pip
+
+# install Sphinx to generate docs
+RUN pip3 install \
+   Sphinx \
+   sphinx_rtd_theme
+
+# create and change to build user
+RUN adduser build
+RUN echo "build ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/build && \
+chmod 0440 /etc/sudoers.d/build
+
+USER build
+
+RUN mkdir -p $RPM_BUILD_DIR/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
+
+# Clone Cassandra and cache maven artifacts
+ARG CASSANDRA_GIT_URL=https://github.com/apache/cassandra.git
+RUN git clone ${CASSANDRA_GIT_URL} ${CASSANDRA_DIR}
+WORKDIR $CASSANDRA_DIR
+
+COPY build-rpms.sh $BUILD_HOME/
diff --git a/docker/build-rpms.sh b/docker/build-rpms.sh
index 4e22b75..ec34d49 100755
--- a/docker/build-rpms.sh
+++ b/docker/build-rpms.sh
@@ -1,5 +1,5 @@
 #!/bin/bash -x
-# Expected to be run from inside cassandra-builds/docker/centos7-image.docker
+# Expected to be run from inside cassandra-builds/docker/almalinux-image.docker
 set -e
 
 if [ "$#" -lt 1 ]; then

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org