X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=tests%2Fci%2Fdocker%2Fentrypoint.sh;h=e3565abba7c44b4ae575b11f4b4861eadcba9f9d;hb=fb82ab40b1db1a1d37f41c3a81bc97655ee1627d;hp=658d8e3abd951a5ae0cdb96db48f431eae0ed0fb;hpb=66752d0061d1c98546a80ebaade44f1feab44a50;p=plcapi.git diff --git a/tests/ci/docker/entrypoint.sh b/tests/ci/docker/entrypoint.sh index 658d8e3..e3565ab 100644 --- a/tests/ci/docker/entrypoint.sh +++ b/tests/ci/docker/entrypoint.sh @@ -1,8 +1,6 @@ #!/bin/sh -# @todo make username flexible - -USERNAME=test +USERNAME="${1:-docker}" echo "[$(date)] Bootstrapping the Test container..." @@ -41,16 +39,28 @@ if [ $(stat -c '%u' "${CONTAINER_USER_HOME}") != "${CONTAINER_USER_UID}" -o $(st chown "${CONTAINER_USER_UID}":"${CONTAINER_USER_GID}" "${CONTAINER_USER_HOME}" chown -R "${CONTAINER_USER_UID}":"${CONTAINER_USER_GID}" "${CONTAINER_USER_HOME}"/.* fi +# @todo do the same chmod for ${TESTS_ROOT_DIR}, if it's not within CONTAINER_USER_HOME -echo "[$(date)] Fixing apache configuration..." +echo "[$(date)] Fixing Apache configuration..." sed -e "s?^export TESTS_ROOT_DIR=.*?export TESTS_ROOT_DIR=${TESTS_ROOT_DIR}?g" --in-place /etc/apache2/envvars +sed -e "s?^export APACHE_RUN_USER=.*?export APACHE_RUN_USER=${USERNAME}?g" --in-place /etc/apache2/envvars +sed -e "s?^export APACHE_RUN_GROUP=.*?export APACHE_RUN_GROUP=${USERNAME}?g" --in-place /etc/apache2/envvars + +echo "[$(date)] Fixing FPM configuration..." -# @todo set as well php-fpm user/group ? +FPMCONF="/etc/php/$(php -r 'echo implode(".",array_slice(explode(".",PHP_VERSION),0,2));' 2>/dev/null)/fpm/pool.d/www.conf" +sed -e "s?^user =.*?user = ${USERNAME}?g" --in-place "${FPMCONF}" +sed -e "s?^group =.*?group = ${USERNAME}?g" --in-place "${FPMCONF}" +sed -e "s?^listen.owner =.*?listen.owner = ${USERNAME}?g" --in-place "${FPMCONF}" +sed -e "s?^listen.group =.*?listen.group = ${USERNAME}?g" --in-place "${FPMCONF}" echo "[$(date)] Running Composer..." -sudo test -c "cd /home/test && composer install" +# @todo if there is a composer.lock file present, there are chances it might be a leftover from when running the +# container using a different php version. We should then back it up / do some symlink magic to make sure that +# it matches the current php version and a hash of composer.json... +sudo "${USERNAME}" -c "cd ${TESTS_ROOT_DIR} && composer install" trap clean_up TERM