Commit 40b379f6 authored by Eric Cano's avatar Eric Cano
Browse files

Added possibility to run a double buildtree for both EOS and CTA.

parent e8c63c74
......@@ -3,4 +3,5 @@
echo Creating the docker image...
./prepareImageStage1-rpms.sh
./prepareImageStage2-eos.sh
./prepareImageStage3-scripts.sh
\ No newline at end of file
./prepareImageStage3-scripts.sh
./prepareImageStage2b-scripts.sh
\ No newline at end of file
#!/bin/bash -e
(cd ~/CTA; sudo docker build . -f continuousintegration/docker/ctafrontend/cc7/doublebuildtree-stage2b-scripts/Dockerfile -t doublebuildtree-runner)
......@@ -63,6 +63,8 @@ RUN yum-config-manager --enable epel --setopt="epel.priority=4" \
xrootd-client \
xrootd-debuginfo \
xrootd-server \
sudo \
logrotate \
oracle-instantclient12.2-basic \
oracle-instantclient12.2-meta \
oracle-instantclient12.2-sqlplus \
......@@ -88,6 +90,11 @@ RUN yum-config-manager --enable epel --setopt="epel.priority=4" \
mariadb-devel \
postgresql-libs \
gtest \
jemalloc \
eos-folly \
hiredis \
jsoncpp \
libmicrohttpd \
&& \
yum clean all \
&& \
......
# ******************************************************************************
#
# The CERN Tape Archive (CTA) project
# Copyright (C) 2015 CERN
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# ****************************************************************************/
# CTA generic image for system tests
# FROM must be the first command in Dockerfile!!
FROM buildtree-runner-stage1
# my environment variables
ENV ORCHESTRATIONDIR="continuousintegration/orchestration/pods" \
LOCALORCHESTRATIONDIR="/opt/ci" \
BASEDIR="continuousintegration/docker/ctafrontend/cc7" \
CTAREPODIR="/tmp/repo"
# Add pod specific configuration
ADD ${BASEDIR}/config ${LOCALORCHESTRATIONDIR}
# Add eos_wfe_scripts directory inside ctaeos specific folder
ADD eos_wfe_scripts ${LOCALORCHESTRATIONDIR}/ctaeos/var/eos/wfe/bash/
# Add orchestration run scripts locally
ADD ${BASEDIR}/opt /opt
# Docker image run setup
ADD ${BASEDIR}/run.sh /
# Add custom rc.local to massage kubernetes resources for
# the taget docker container
ADD ${BASEDIR}/rc.local /etc/rc.d
# Make sure it can be executed by root
RUN chmod 744 /etc/rc.local
# disable selinux so that systemd works if the container is booted
# with an image that already contains selinux
ADD ${BASEDIR}/etc_selinux_config /etc/selinux/config
# One more thing so that we can use systemd
VOLUME [ "/sys/fs/cgroup" ]
# Mark the image as a buildtree image
RUN touch /etc/doubleBuildtreeRunner
# And finally run systemd if the entrypoint is not overriden by docker
ENTRYPOINT ["/usr/sbin/init"]
......@@ -3,8 +3,18 @@
# make symbolic links to all CTA binaries.
echo Creating symlinks for CTA binaries.
ln -s -v -t /usr/bin `find ${BUILDTREE_BASE}/${BUILDTREE_SUBDIR} -type f -executable | egrep -v '\.so(\.|$)' | egrep -v '\.sh$' | grep -v RPM/BUILD | grep -v CMake | grep -v CPack`
ln -s -v -t /usr/bin `find ${BUILDTREE_BASE}/${CTA_BUILDTREE_SUBDIR} -type f -executable | egrep -v '\.so(\.|$)' | egrep -v '\.sh$' | grep -v RPM/BUILD | grep -v CMake | grep -v CPack`
echo Creating symlinks for CTA libraries.
find ${BUILDTREE_BASE}/${BUILDTREE_SUBDIR} | grep '.so$' | xargs -itoto ln -s -v -t /usr/lib64 toto
find ${BUILDTREE_BASE}/${CTA_BUILDTREE_SUBDIR} | grep '.so$' | xargs -itoto ln -s -v -t /usr/lib64 toto
echo Creating symlink for frontend configuration file.
ln -s -v -t /etc/cta `perl -e 'while (<>) { if (/cta_SOURCE_DIR:STATIC=(.*)/ ) { print $1."\n"; } }' < ${BUILDTREE_BASE}/${BUILDTREE_SUBDIR}/CMakeCache.txt`/xroot_plugins/cta-frontend-xrootd.conf
ln -s -v -t /etc/cta `perl -e 'while (<>) { if (/cta_SOURCE_DIR:STATIC=(.*)/ ) { print $1."\n"; } }' < ${BUILDTREE_BASE}/${CTA_BUILDTREE_SUBDIR}/CMakeCache.txt`/xroot_plugins/cta-frontend-xrootd.conf
if [[ -n "${EOS_BUILDTREE_SUBDIR}" ]]; then
echo Creating symlinks for EOS binaries.
ln -s -v -t /usr/bin `find ${BUILDTREE_BASE}/${EOS_BUILDTREE_SUBDIR} -type f -executable | egrep -v '\.so(\.|$)' | egrep -v '\.sh$' | grep -v RPM/BUILD | grep -v CMake | grep -v CPack`
echo Creating symlinks for EOS libraries.
find ${BUILDTREE_BASE}/${EOS_BUILDTREE_SUBDIR} | egrep 'lib.*\.so($|\.)' | xargs -itoto ln -s -v -t /usr/lib64 toto
ln -s -v -t /usr/sbin `grep eos_SOURCE ${BUILDTREE_BASE}/${EOS_BUILDTREE_SUBDIR}/CMakeCache.txt | cut -d = -f 2-`/fst/tools/eos*
mkdir /var/log/eos{,/tx}
mkdir /var/eos{,/wfe{,/bash},ns-queue{,/default}}
chown -R daemon.daemon /var/log/eos /var/eos
fi
......@@ -26,14 +26,15 @@ keepobjectstore=1
usage() { cat <<EOF 1>&2
Usage: $0 -n <namespace> [-o <objectstore_configmap>] [-d <database_configmap>] \
[-e <eos_configmap>] [-a <additional_k8_resources>]\
[-p <gitlab pipeline ID> | -b <build tree base> -B <build tree subdir> ] \
[-p <gitlab pipeline ID> | -b <build tree base> -B <CTA build tree subdir> [-E <EOS build tree subdir>]] \
[-S] [-D] [-O] [-m [mhvtl|ibm]]
Options:
-S Use systemd to manage services inside containers
-b The directory containing both the source and the build tree for CTA. It will be mounted RO in the
-b The directory containing both the source and the build tree for CTA (and possibly EOS). It will be mounted RO in the
containers.
-B The subdirectory within the -b directory where the build tree is.
-B The subdirectory within the -b directory where the CTA build tree is.
-E The subdirectory within the -b directory where the EOS build tree is.
-D wipe database content during initialization phase (database content is kept by default)
-O wipe objectstore content during initialization phase (objectstore content is kept by default)
-a additional kubernetes resources added to the kubernetes namespace
......@@ -43,7 +44,7 @@ exit 1
die() { echo "$@" 1>&2 ; exit 1; }
while getopts "n:o:d:e:a:p:b:B:SDOm:" o; do
while getopts "n:o:d:e:a:p:b:B:E:SDOm:" o; do
case "${o}" in
o)
config_objectstore=${OPTARG}
......@@ -78,7 +79,10 @@ while getopts "n:o:d:e:a:p:b:B:SDOm:" o; do
usesystemd=1
;;
B)
buildtreesubdir=${OPTARG}
ctabuildtreesubdir=${OPTARG}
;;
E)
eosbuildtreesubdir=${OPTARG}
;;
O)
keepobjectstore=0
......@@ -106,7 +110,7 @@ poddir=$(mktemp -d)
if [ ! -z "${buildtree}" ]; then
# We need to know the subdir as well
if [ -z "${buildtreesubdir}" ]; then
if [ -z "${ctabuildtreesubdir}" ]; then
usage
fi
# We are going to run with generic images against a build tree.
......@@ -116,7 +120,11 @@ if [ ! -z "${buildtree}" ]; then
docker rmi buildtree-runner:v0 &>/dev/null
docker tag buildtree-runner buildtree-runner:v0
cp pod-* ${poddir}
sed -i ${poddir}/pod-* -e "s/\(^\s\+image\):.*/\1: buildtree-runner:v0\n\1PullPolicy: Never/"
if [ -z "${eosbuildtreesubdir}" ]; then
sed -i ${poddir}/pod-* -e "s/\(^\s\+image\):.*/\1: buildtree-runner:latest\n\1PullPolicy: Never/"
else
sed -i ${poddir}/pod-* -e "s/\(^\s\+image\):.*/\1: doublebuildtree-runner:latest\n\1PullPolicy: Never/"
fi
# Add the build tree mount point the pods (volume mount then volume).
sed -i ${poddir}/pod-* -e "s|\(^\s\+\)\(volumeMounts:\)|\1\2\n\1- mountPath: ${buildtree}\n\1 name: buildtree\n\1 readOnly: true|"
......@@ -184,7 +192,8 @@ fi
kubectl --namespace ${instance} create configmap init --from-literal=keepdatabase=${keepdatabase} --from-literal=keepobjectstore=${keepobjectstore}
kubectl --namespace ${instance} create configmap buildtree --from-literal=base=${buildtree} --from-literal=subdir=${buildtreesubdir}
kubectl --namespace ${instance} create configmap buildtree --from-literal=base=${buildtree} --from-literal=cta_subdir=${ctabuildtreesubdir} \
--from-literal=eos_subdir=${eosbuildtreesubdir}
if [ ! -z "${additional_resources}" ]; then
kubectl --namespace ${instance} create -f ${additional_resources} || die "Could not create additional resources described in ${additional_resources}"
......
......@@ -26,11 +26,16 @@ spec:
configMapKeyRef:
name: buildtree
key: base
- name: BUILDTREE_SUBDIR
- name: CTA_BUILDTREE_SUBDIR
valueFrom:
configMapKeyRef:
name: buildtree
key: subdir
key: cta_subdir
- name: EOS_BUILDTREE_SUBDIR
valueFrom:
configMapKeyRef:
name: buildtree
key: eos_subdir
- name: TERM
value: "xterm"
command: ['/opt/run/bin/client.sh']
......
......@@ -26,11 +26,11 @@ spec:
configMapKeyRef:
name: buildtree
key: base
- name: BUILDTREE_SUBDIR
- name: CTA_BUILDTREE_SUBDIR
valueFrom:
configMapKeyRef:
name: buildtree
key: subdir
key: cta_subdir
- name: TERM
value: "xterm"
command: ['/opt/run/bin/ctacli.sh']
......
......@@ -28,11 +28,16 @@ spec:
configMapKeyRef:
name: buildtree
key: base
- name: BUILDTREE_SUBDIR
- name: CTA_BUILDTREE_SUBDIR
valueFrom:
configMapKeyRef:
name: buildtree
key: subdir
key: cta_subdir
- name: EOS_BUILDTREE_SUBDIR
valueFrom:
configMapKeyRef:
name: buildtree
key: eos_subdir
- name: TERM
value: "xterm"
command: ['/opt/run/bin/ctaeos-mgm-log-wrapper.sh']
......
......@@ -26,11 +26,11 @@ spec:
configMapKeyRef:
name: buildtree
key: base
- name: BUILDTREE_SUBDIR
- name: CTA_BUILDTREE_SUBDIR
valueFrom:
configMapKeyRef:
name: buildtree
key: subdir
key: cta_subdir
- name: TERM
value: "xterm"
command: ['/opt/run/bin/ctafrontend.sh']
......
......@@ -36,11 +36,11 @@ spec:
configMapKeyRef:
name: buildtree
key: base
- name: BUILDTREE_SUBDIR
- name: CTA_BUILDTREE_SUBDIR
valueFrom:
configMapKeyRef:
name: buildtree
key: subdir
key: cta_subdir
command: ['/opt/run/bin/init.sh']
args: ["none"]
volumeMounts:
......
......@@ -26,11 +26,11 @@ spec:
configMapKeyRef:
name: buildtree
key: base
- name: BUILDTREE_SUBDIR
- name: CTA_BUILDTREE_SUBDIR
valueFrom:
configMapKeyRef:
name: buildtree
key: subdir
key: cta_subdir
- name: INSTANCE_NAME
value: "$(MY_NAMESPACE)"
- name: TERM
......@@ -70,11 +70,11 @@ spec:
configMapKeyRef:
name: buildtree
key: base
- name: BUILDTREE_SUBDIR
- name: CTA_BUILDTREE_SUBDIR
valueFrom:
configMapKeyRef:
name: buildtree
key: subdir
key: cta_subdir
- name: TERM
value: "xterm"
command: ['/opt/run/bin/taped.sh']
......
......@@ -26,11 +26,11 @@ spec:
configMapKeyRef:
name: buildtree
key: base
- name: BUILDTREE_SUBDIR
- name: CTA_BUILDTREE_SUBDIR
valueFrom:
configMapKeyRef:
name: buildtree
key: subdir
key: cta_subdir
- name: INSTANCE_NAME
value: "$(MY_NAMESPACE)"
- name: TERM
......@@ -72,11 +72,11 @@ spec:
configMapKeyRef:
name: buildtree
key: base
- name: BUILDTREE_SUBDIR
- name: CTA_BUILDTREE_SUBDIR
valueFrom:
configMapKeyRef:
name: buildtree
key: subdir
key: cta_subdir
- name: TERM
value: "xterm"
- name: driveslot
......
......@@ -26,11 +26,11 @@ spec:
configMapKeyRef:
name: buildtree
key: base
- name: BUILDTREE_SUBDIR
- name: CTA_BUILDTREE_SUBDIR
valueFrom:
configMapKeyRef:
name: buildtree
key: subdir
key: cta_subdir
- name: INSTANCE_NAME
value: "$(MY_NAMESPACE)"
- name: TERM
......@@ -72,11 +72,11 @@ spec:
configMapKeyRef:
name: buildtree
key: base
- name: BUILDTREE_SUBDIR
- name: CTA_BUILDTREE_SUBDIR
valueFrom:
configMapKeyRef:
name: buildtree
key: subdir
key: cta_subdir
- name: TERM
value: "xterm"
- name: driveslot
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment