diff --git a/.euts.env.example b/.euts.env.example index 34281aa..58575a5 100644 --- a/.euts.env.example +++ b/.euts.env.example @@ -13,9 +13,10 @@ ### Containers Runtime Settings -# The project name is used as prefix for the name of the containers that will be built. -# This allows to build and run different copies of the stack in parallel -#TESTSTACK_PROJECT_NAME=euts +# The project name is used as prefix for the name of the containers and images that will be built. +# This allows to build and run different copies of the stack in parallel. +# It is also used as part of the name of the custom composer 'vendor' dir that will be used. +#COMPOSE_PROJECT_NAME=euts # Custom Timezone for the containers. Use 'none' as null value #TESTSTACK_TZ=none diff --git a/WHATSNEW.md b/WHATSNEW.md index c7f9325..9266c7d 100644 --- a/WHATSNEW.md +++ b/WHATSNEW.md @@ -1,3 +1,10 @@ +Version 0.3 (unreleased) +======================== + +* fix: make it possible to run multiple copies of the stack in parallel. + In order to achieve this, env var TESTSTACK_PROJECT_NAME has been replaced with COMPOSE_PROJECT_NAME in config file .euts.env. + In order to retain Backwards Compatibility, the old variable name is still accepted if the new one is not used. + Version 0.2 =========== diff --git a/bin/setup/composer-dependencies.sh b/bin/setup/composer-dependencies.sh index d971c68..634c557 100755 --- a/bin/setup/composer-dependencies.sh +++ b/bin/setup/composer-dependencies.sh @@ -3,7 +3,7 @@ # Install dependencies using Composer # We do not rely on the requirements set in composer.json, but install a different eZ version depending on the test matrix (env vars) # -# Uses env vars: EZ_COMPOSER_LOCK, EZ_PACKAGES, TESTSTACK_PROJECT_NAME, TRAVIS +# Uses env vars: EZ_COMPOSER_LOCK, EZ_PACKAGES, COMPOSE_PROJECT_NAME, TRAVIS # @todo generate and echo a hash which can be used to determine in the future if we need to run composer again (as it # would install different packages compared to the ones installed currently) @@ -29,8 +29,8 @@ if [ -n "${EZ_COMPOSER_LOCK}" ]; then else echo "Installing packages via Composer: the ones in composer.json plus ${EZ_PACKAGES}..." - if [ -n "${TESTSTACK_PROJECT_NAME}" ]; then - export COMPOSER="composer_${TESTSTACK_PROJECT_NAME}.json" + if [ -n "${COMPOSE_PROJECT_NAME}" ]; then + export COMPOSER="composer_${COMPOSE_PROJECT_NAME}.json" cp composer.json ${COMPOSER} fi # we split require from update to (hopefully) save some ram diff --git a/doc/config_examples/bundle_with_extra_dependencies/.euts.113.env b/doc/config_examples/bundle_with_extra_dependencies/.euts.113.env index cbc6f13..75194a8 100644 --- a/doc/config_examples/bundle_with_extra_dependencies/.euts.113.env +++ b/doc/config_examples/bundle_with_extra_dependencies/.euts.113.env @@ -1,7 +1,7 @@ # Example TesStack configuration for testing Kaliop eZMigration Bundle on eZ Platform 1 # Use a specific project name - always a good idea when you plan to test the same bundle in different configurations -TESTSTACK_PROJECT_NAME=kezmbt_113 +COMPOSE_PROJECT_NAME=kezmbt_113 # Debian Stretch comes with php 7.0 by default. We need php 7.1 minimum for ezplatform-matrix-fieldtype TESTSTACK_DEBIAN_VERSION=stretch TESTSTACK_PHP_VERSION=7.1 diff --git a/doc/config_examples/bundle_with_extra_dependencies/.euts.23.env b/doc/config_examples/bundle_with_extra_dependencies/.euts.23.env index 127f378..02eff42 100644 --- a/doc/config_examples/bundle_with_extra_dependencies/.euts.23.env +++ b/doc/config_examples/bundle_with_extra_dependencies/.euts.23.env @@ -1,7 +1,7 @@ # Example TesStack configuration for testing Kaliop eZMigration Bundle on eZ Platform 2.3 # Use a specific project name - always a good idea when you plan to test the same bundle in different configurations -TESTSTACK_PROJECT_NAME=kezmbt_23 +COMPOSE_PROJECT_NAME=kezmbt_23 # We use Debian Buster which comes with php 7.3 by default TESTSTACK_DEBIAN_VERSION=buster diff --git a/doc/config_examples/bundle_with_extra_dependencies/.euts.25.env b/doc/config_examples/bundle_with_extra_dependencies/.euts.25.env index 6075151..ce9d6fd 100644 --- a/doc/config_examples/bundle_with_extra_dependencies/.euts.25.env +++ b/doc/config_examples/bundle_with_extra_dependencies/.euts.25.env @@ -1,7 +1,7 @@ # Example TesStack configuration for testing Kaliop eZMigration Bundle on eZ Platform 2.3 # Use a specific project name - always a good idea when you plan to test the same bundle in different configurations -TESTSTACK_PROJECT_NAME=kezmbt_25 +COMPOSE_PROJECT_NAME=kezmbt_25 # We use Debian Buster (which comes with php 7.3 by default) and php 7.4 TESTSTACK_DEBIAN_VERSION=buster TESTSTACK_PHP_VERSION=7.4 diff --git a/doc/config_examples/bundle_with_extra_dependencies/.euts.cp.env b/doc/config_examples/bundle_with_extra_dependencies/.euts.cp.env index f3d535f..e4b754f 100644 --- a/doc/config_examples/bundle_with_extra_dependencies/.euts.cp.env +++ b/doc/config_examples/bundle_with_extra_dependencies/.euts.cp.env @@ -1,7 +1,7 @@ # Example TesStack configuration for testing Kaliop eZMigration Bundle on eZ Community Project (5.4) # Use a specific project name - always a good idea when you plan to test the same bundle in different configurations -TESTSTACK_PROJECT_NAME=kezmbt_cp +COMPOSE_PROJECT_NAME=kezmbt_cp # Use Debian Jessie for the container OS as it comes with php 5.6 by default TESTSTACK_DEBIAN_VERSION=jessie diff --git a/docker/docker-compose-mysql.yml b/docker/docker-compose-mysql.yml index ab8151a..2545e2f 100644 --- a/docker/docker-compose-mysql.yml +++ b/docker/docker-compose-mysql.yml @@ -3,7 +3,7 @@ version: '3' services: mysql: - image: ${TESTSTACK_PROJECT_NAME:-euts}_mysql + image: ${COMPOSE_PROJECT_NAME:-euts}_mysql build: context: images/mysql args: @@ -11,10 +11,10 @@ services: # note: Travis Xenial and Bionic images come with mysql 5.7 by default; Focal comes with mysql 8.0 # But mysql 5.6 is not recommended for EZP 5.4, so we default to 5.6 mysql_version: ${MYSQL_VERSION:-5.6} - project_name: ${TESTSTACK_PROJECT_NAME:-euts} + project_name: ${COMPOSE_PROJECT_NAME:-euts} timezone: ${TESTSTACK_TZ:-none} hostname: mysql - container_name: ${TESTSTACK_PROJECT_NAME:-euts}_mysql + container_name: ${COMPOSE_PROJECT_NAME:-euts}_mysql environment: - CONTAINER_USER_UID=${CONTAINER_USER_UID:-1000} - CONTAINER_USER_GID=${CONTAINER_USER_GID:-1000} diff --git a/docker/docker-compose-postgresql.yml b/docker/docker-compose-postgresql.yml index 2a7ed93..ef24808 100644 --- a/docker/docker-compose-postgresql.yml +++ b/docker/docker-compose-postgresql.yml @@ -3,7 +3,7 @@ version: '3' services: postgresql: - image: ${TESTSTACK_PROJECT_NAME:-euts}_postgresql + image: ${COMPOSE_PROJECT_NAME:-euts}_postgresql build: context: images/postgresql args: @@ -11,10 +11,10 @@ services: # note: Travis Xenial images come with PG 9.4-9.6,10; Bionic with 9.3-9.6,10,11 and Focal with 12 # We go with 9.5 as default because it is the lowest upstream supported version as of 11/2020... postgresql_version: ${POSTGRESQL_VERSION:-9.5} - project_name: ${TESTSTACK_PROJECT_NAME:-euts} + project_name: ${COMPOSE_PROJECT_NAME:-euts} timezone: ${TESTSTACK_TZ:-none} hostname: postgresql - container_name: ${TESTSTACK_PROJECT_NAME:-euts}_postgresql + container_name: ${COMPOSE_PROJECT_NAME:-euts}_postgresql environment: - CONTAINER_USER_UID=${CONTAINER_USER_UID:-1000} - CONTAINER_USER_GID=${CONTAINER_USER_GID:-1000} diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 7cf267e..5af039d 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -3,7 +3,7 @@ version: '3' services: ez: - image: ${TESTSTACK_PROJECT_NAME:-euts}_ez + image: ${COMPOSE_PROJECT_NAME:-euts}_ez build: context: images/ez args: @@ -11,10 +11,10 @@ services: debian_version: ${TESTSTACK_DEBIAN_VERSION:-buster} do_update_os: ${TESTSTACK_UPDATE_OS_ON_BUILD:-true} php_version: ${TESTSTACK_PHP_VERSION:-default} - project_name: ${TESTSTACK_PROJECT_NAME:-euts} + project_name: ${COMPOSE_PROJECT_NAME:-euts} timezone: ${TESTSTACK_TZ:-none} hostname: ez - container_name: ${TESTSTACK_PROJECT_NAME:-euts}_ez + container_name: ${COMPOSE_PROJECT_NAME:-euts}_ez environment: ## Configuration used by the boot/setup scripts - COMPOSER_AUTH @@ -22,7 +22,7 @@ services: - CONTAINER_USER_GID=${CONTAINER_USER_GID:-1000} - http_proxy - https_proxy - - TESTSTACK_PROJECT_NAME + - COMPOSE_PROJECT_NAME - TESTSTACK_SETUP_APP_ON_BOOT ## Database configuration - DB_TYPE=${DB_TYPE:-mysql} diff --git a/docker/images/ez/root/boot/symlinkvendors.sh b/docker/images/ez/root/boot/symlinkvendors.sh index 544e470..0de970e 100644 --- a/docker/images/ez/root/boot/symlinkvendors.sh +++ b/docker/images/ez/root/boot/symlinkvendors.sh @@ -11,7 +11,7 @@ CONTAINER_USER_HOME=$(echo "$ORIGPASSWD" | cut -f6 -d:) # # @todo to avoid generating uselessly different variations, we should as well sort EZ_PACKAGES # TESTSTACK_VENDOR_DIR=vendor_$(echo "${P_V} ${EZ_PACKAGES}" | md5sum | awk '{print $1}') #fi -TESTSTACK_VENDOR_DIR="vendor_${TESTSTACK_PROJECT_NAME}" +TESTSTACK_VENDOR_DIR="vendor_${COMPOSE_PROJECT_NAME}" # @todo we assume that /home/test/bundle/vendor is never a file... diff --git a/teststack b/teststack index c8fc722..0fde2d3 100755 --- a/teststack +++ b/teststack @@ -258,6 +258,11 @@ dotenv() { set -a . "${1}" set +a + + # BC with versions 0.1 - 0.2 + if [ -z "${COMPOSE_PROJECT_NAME}" -a -n "${TESTSTACK_PROJECT_NAME}" ]; then + export COMPOSE_PROJECT_NAME="${TESTSTACK_PROJECT_NAME}" + fi } load_config() { @@ -442,7 +447,7 @@ cd $(dirname -- ${BASH_SOURCE[0]})/docker # Since the line below relies on knowing the contents of the yml file anyway, let's be more efficient... #WEB_CONTAINER=$(${DOCKER_TESTSTACK_QUIET} config | grep 'container_name: .*_ez$' | sed -e 's/ \+container_name: \+//g') -WEB_CONTAINER=${TESTSTACK_PROJECT_NAME:-euts}_ez +WEB_CONTAINER=${COMPOSE_PROJECT_NAME:-euts}_ez case "${COMMAND}" in build)