Skip to content

Commit

Permalink
Fail entrypoint if patching fails; fix #238
Browse files Browse the repository at this point in the history
  • Loading branch information
rdimaio authored and rcarpa committed Jan 24, 2024
1 parent dc3ccfa commit 4a0f1f2
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 8 deletions.
2 changes: 1 addition & 1 deletion daemons/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

FROM almalinux:9 as rpm_builder
RUN dnf upgrade -y
RUN dnf install -y rpm-build rpmdevtools yum-utils epel-release.noarch
RUN dnf install -y rpm-build rpmdevtools yum-utils epel-release.noarch patchutils
RUN yum-config-manager --enable crb
# BUILD and install openssl 3.1
ADD openssl.spec /root/rpmbuild/SPECS/openssl.spec
Expand Down
27 changes: 25 additions & 2 deletions daemons/start-daemon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,31 @@ then
echo "Patches found. Trying to apply them"
for patchfile in /patch/*
do
echo "Apply patch ${patchfile}"
patch -p3 -d "$RUCIO_PYTHON_PATH" < $patchfile
echo "Applying patch ${patchfile}"

bin_patch=$(filterdiff -i '*/bin/*' ${patchfile})

if [ -n "$bin_patch" ]
then
if patch -p3 -d "$RUCIO_PYTHON_PATH" < $bin_patch
then
echo "Patch ${bin_patch} applied."
else
echo "Patch ${bin_patch} could not be applied successfully (exit code $?). Exiting setup."
exit 1
fi

lib_patch=$(filterdiff -i '*/lib/*' ${patchfile})

if [ -n "$lib_patch" ]
then
if patch -p3 -d "$RUCIO_PYTHON_PATH" < $lib_patch
then
echo "Patch ${lib_patch} applied."
else
echo "Patch ${lib_patch} could not be applied successfully (exit code $?). Exiting setup."
exit 1
fi
done
fi

Expand Down
1 change: 1 addition & 0 deletions server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ RUN dnf install -y epel-release.noarch && \
python-pip \
python-mod_wsgi \
memcached && \
patchutils && \
dnf clean all && \
rm -rf /var/cache/dnf
RUN rpm -i https://download.oracle.com/otn_software/linux/instantclient/1912000/oracle-instantclient19.12-basiclite-19.12.0.0.0-1.x86_64.rpm; \
Expand Down
27 changes: 25 additions & 2 deletions server/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,31 @@ then
echo "Patches found. Trying to apply them"
for patchfile in /patch/*
do
echo "Apply patch ${patchfile}"
patch -p3 -d "$RUCIO_PYTHON_PATH" < $patchfile
echo "Applying patch ${patchfile}"

bin_patch=$(filterdiff -i '*/bin/*' ${patchfile})

if [ -n "$bin_patch" ]
then
if patch -p3 -d "$RUCIO_PYTHON_PATH" < $bin_patch
then
echo "Patch ${bin_patch} applied."
else
echo "Patch ${bin_patch} could not be applied successfully (exit code $?). Exiting setup."
exit 1
fi

lib_patch=$(filterdiff -i '*/lib/*' ${patchfile})

if [ -n "$lib_patch" ]
then
if patch -p3 -d "$RUCIO_PYTHON_PATH" < $lib_patch
then
echo "Patch ${lib_patch} applied."
else
echo "Patch ${lib_patch} could not be applied successfully (exit code $?). Exiting setup."
exit 1
fi
done
fi

Expand Down
2 changes: 1 addition & 1 deletion webui/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RUN dnf -y update && \
dnf -y module reset nodejs && \
dnf -y module enable nodejs:18 && \
dnf -y module install nodejs:18/common && \
dnf -y install httpd mod_ssl python39 python-pip git procps && \
dnf -y install httpd mod_ssl python39 python-pip git procps patchutils && \
dnf clean all && \
rm -rf /var/cache/dnf

Expand Down
28 changes: 26 additions & 2 deletions webui/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,34 @@ then
echo "Patches found. Trying to apply them"
for patchfile in /patch/*
do
echo "Apply patch ${patchfile}"
patch -p3 -d "$RUCIO_WEBUI_PATH" < $patchfile
echo "Applying patch ${patchfile}"

bin_patch=$(filterdiff -i '*/bin/*' ${patchfile})

if [ -n "$bin_patch" ]
then
if patch -p3 -d "$RUCIO_WEBUI_PATH" < $bin_patch
then
echo "Patch ${bin_patch} applied."
else
echo "Patch ${bin_patch} could not be applied successfully (exit code $?). Exiting setup."
exit 1
fi

lib_patch=$(filterdiff -i '*/lib/*' ${patchfile})

if [ -n "$lib_patch" ]
then
if patch -p3 -d "$RUCIO_WEBUI_PATH" < $lib_patch
then
echo "Patch ${lib_patch} applied."
else
echo "Patch ${lib_patch} could not be applied successfully (exit code $?). Exiting setup."
exit 1
fi
done
fi


echo "=================== Starting RUCIO WEBUI ========================"
npm run start

0 comments on commit 4a0f1f2

Please sign in to comment.