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 5207a25 When building deb and rpm packages (in docker containers)
re-use the host's local maven repository
5207a25 is described below
commit 5207a25a8eeb994419aa3746aeb55fdd62a0708d
Author: Mick Semb Wever <[email protected]>
AuthorDate: Sun Apr 17 22:59:15 2022 +0200
When building deb and rpm packages (in docker containers) re-use the host's
local maven repository
patch by Mick Semb Wever; reviewed by Martin Grigorov for INFRA-23147
---
build-scripts/cassandra-deb-packaging.sh | 5 ++---
build-scripts/cassandra-rpm-packaging.sh | 5 ++---
docker/almalinux-image.docker | 19 ++++++++++++-------
docker/buster-image.docker | 18 ++++++++++++++----
docker/centos8-image.docker | 19 ++++++++++++-------
5 files changed, 42 insertions(+), 24 deletions(-)
diff --git a/build-scripts/cassandra-deb-packaging.sh
b/build-scripts/cassandra-deb-packaging.sh
index 90f1bbd..a1483f0 100755
--- a/build-scripts/cassandra-deb-packaging.sh
+++ b/build-scripts/cassandra-deb-packaging.sh
@@ -35,10 +35,9 @@ docker image prune --all --force --filter
label=org.cassandra.buildenv=buster --
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-buster:${sha} -f docker/buster-image.docker docker/
+docker build --build-arg CASSANDRA_GIT_URL=$CASSANDRA_GIT_URL --build-arg
UID_ARG=`id -u` --build-arg GID_ARG=`id -g` -t
cassandra-artifacts-buster:${sha} -f docker/buster-image.docker docker/
# Run build script through docker (specify branch, tag, or sha)
-chmod 777 "${deb_dir}"
-docker run --rm -v "${deb_dir}":/dist cassandra-artifacts-buster:${sha}
/home/build/build-debs.sh ${sha} ${java_version}
+docker run --rm -v "${deb_dir}":/dist -v
~/.m2/repository/:/home/build/.m2/repository/ cassandra-artifacts-buster:${sha}
/home/build/build-debs.sh ${sha} ${java_version}
popd
diff --git a/build-scripts/cassandra-rpm-packaging.sh
b/build-scripts/cassandra-rpm-packaging.sh
index 8737d4b..48fab79 100755
--- a/build-scripts/cassandra-rpm-packaging.sh
+++ b/build-scripts/cassandra-rpm-packaging.sh
@@ -35,10 +35,9 @@ docker image prune --all --force --filter
label=org.cassandra.buildenv=almalinux
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-almalinux:${sha} -f docker/almalinux-image.docker docker/
+docker build --build-arg CASSANDRA_GIT_URL=$CASSANDRA_GIT_URL --build-arg
UID_ARG=`id -u` --build-arg GID_ARG=`id -g` -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-almalinux:${sha}
/home/build/build-rpms.sh ${sha} ${java_version}
+docker run --rm -v "${rpm_dir}":/dist -v
~/.m2/repository/:/home/build/.m2/repository/
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
index 30493e0..01c266a 100644
--- a/docker/almalinux-image.docker
+++ b/docker/almalinux-image.docker
@@ -4,11 +4,20 @@ ENV BUILD_HOME=/home/build
ENV RPM_BUILD_DIR=$BUILD_HOME/rpmbuild
ENV RPM_DIST_DIR=/dist
ENV CASSANDRA_DIR=$BUILD_HOME/cassandra
+ARG UID_ARG=1000
+ARG GID_ARG=1000
LABEL org.cassandra.buildenv=almalinux
VOLUME ${RPM_DIST_DIR}
+RUN echo "Building with arguments:" \
+ && echo " - DEB_DIST_DIR=${DEB_DIST_DIR}" \
+ && echo " - BUILD_HOME=${BUILD_HOME}" \
+ && echo " - CASSANDRA_DIR=${CASSANDRA_DIR}" \
+ && echo " - UID_ARG=${UID_ARG}" \
+ && echo " - GID_ARG=${GID_ARG}"
+
# install deps
RUN yum -y install \
ant \
@@ -26,15 +35,11 @@ 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 groupadd --gid ${GID_ARG} --non-unique build \
+ && adduser --uid ${UID_ARG} --gid ${GID_ARG} build
RUN echo "build ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/build && \
-chmod 0440 /etc/sudoers.d/build
+ chmod 0440 /etc/sudoers.d/build
USER build
diff --git a/docker/buster-image.docker b/docker/buster-image.docker
index 4f554cd..04a3e87 100644
--- a/docker/buster-image.docker
+++ b/docker/buster-image.docker
@@ -3,11 +3,20 @@ FROM debian:buster
ENV DEB_DIST_DIR=/dist
ENV BUILD_HOME=/home/build
ENV CASSANDRA_DIR=$BUILD_HOME/cassandra
+ARG UID_ARG=1000
+ARG GID_ARG=1000
LABEL org.cassandra.buildenv=buster
VOLUME ${DEB_DIST_DIR}
+RUN echo "Building with arguments:" \
+ && echo " - DEB_DIST_DIR=${DEB_DIST_DIR}" \
+ && echo " - BUILD_HOME=${BUILD_HOME}" \
+ && echo " - CASSANDRA_DIR=${CASSANDRA_DIR}" \
+ && echo " - UID_ARG=${UID_ARG}" \
+ && echo " - GID_ARG=${GID_ARG}"
+
# configure apt to retry downloads
RUN echo 'APT::Acquire::Retries "9";' > /etc/apt/apt.conf.d/80-retries
@@ -18,9 +27,7 @@ RUN apt-get update && apt-get -y install \
curl \
devscripts \
git \
- sudo \
- python-sphinx \
- python-sphinx-rtd-theme
+ sudo
RUN echo 'deb http://ftp.debian.org/debian stretch main' >>
/etc/apt/sources.list \
&& apt-get update \
@@ -30,7 +37,10 @@ RUN echo 'deb http://ftp.debian.org/debian stretch main' >>
/etc/apt/sources.lis
&& update-java-alternatives --set java-1.8.0-openjdk-$(dpkg
--print-architecture)
# create and change to build user
-RUN adduser --disabled-login --gecos build build && gpasswd -a build sudo
+RUN groupadd --gid ${GID_ARG} --non-unique build \
+ && adduser --uid ${UID_ARG} --gid ${GID_ARG} --disabled-login --gecos
build build \
+ && gpasswd -a build sudo
+
RUN echo "build ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/build && \
chmod 0440 /etc/sudoers.d/build
diff --git a/docker/centos8-image.docker b/docker/centos8-image.docker
index 0d55d10..01ddd0b 100644
--- a/docker/centos8-image.docker
+++ b/docker/centos8-image.docker
@@ -4,11 +4,20 @@ ENV BUILD_HOME=/home/build
ENV RPM_BUILD_DIR=$BUILD_HOME/rpmbuild
ENV RPM_DIST_DIR=/dist
ENV CASSANDRA_DIR=$BUILD_HOME/cassandra
+ARG UID_ARG=1000
+ARG GID_ARG=1000
LABEL org.cassandra.buildenv=centos
VOLUME ${RPM_DIST_DIR}
+RUN echo "Building with arguments:" \
+ && echo " - DEB_DIST_DIR=${DEB_DIST_DIR}" \
+ && echo " - BUILD_HOME=${BUILD_HOME}" \
+ && echo " - CASSANDRA_DIR=${CASSANDRA_DIR}" \
+ && echo " - UID_ARG=${UID_ARG}" \
+ && echo " - GID_ARG=${GID_ARG}"
+
# install deps
RUN yum -y install \
ant \
@@ -26,15 +35,11 @@ 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 groupadd --gid ${GID_ARG} --non-unique build \
+ && adduser --uid ${UID_ARG} --gid ${GID_ARG} build
RUN echo "build ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/build && \
-chmod 0440 /etc/sudoers.d/build
+ chmod 0440 /etc/sudoers.d/build
USER build
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]