From 6157907900f893855b513c7e70cd5a70fcde70a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BCrk?= <stefan@buerk.tech> Date: Sun, 16 Apr 2023 14:26:02 +0200 Subject: [PATCH] [TASK] Use `ghcr.io` core-testing images in non-ci context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The docker container image hub is slowly becoming more and more problematic for open source organisations, it's time to move to another container registry for core-testing images. Images are now build and published to both Docker HUB and GitHub Container Registry (`ghcr.io`). To test the ghcr.io images, the patch changes runTests.sh to use them them for local (non CI) execution already. We can not fully switch to ghcr.io yet, since CI uses the docker registry container as mirror for images to heavily reduce network load and increase performance. The registry container however can only mirror hub.docker.io images, so we need a different solution for CI first. When this is done, we'll stop uploading images to docker hub later. Resolves: #100617 Releases: main, 11.5, 10.4 Change-Id: Ia309826618696dc25b15527b73fa704235285479 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/78668 Tested-by: core-ci <typo3@b13.com> Tested-by: Stefan Bürk <stefan@buerk.tech> Reviewed-by: Stefan Bürk <stefan@buerk.tech> --- Build/Scripts/runTests.sh | 13 ++- Build/testing-docker/local/docker-compose.yml | 104 +++++++++--------- 2 files changed, 61 insertions(+), 56 deletions(-) diff --git a/Build/Scripts/runTests.sh b/Build/Scripts/runTests.sh index 0225be564c34..5dd2eccb012d 100755 --- a/Build/Scripts/runTests.sh +++ b/Build/Scripts/runTests.sh @@ -39,6 +39,7 @@ setUpDockerComposeDotEnv() { echo "DOCKER_SELENIUM_IMAGE=${DOCKER_SELENIUM_IMAGE}" echo "IS_CORE_CI=${IS_CORE_CI}" echo "PHPSTAN_CONFIG_FILE=${PHPSTAN_CONFIG_FILE}" + echo "IMAGE_PREFIX=${IMAGE_PREFIX}" } > .env } @@ -362,11 +363,15 @@ THISCHUNK=0 DOCKER_SELENIUM_IMAGE="selenium/standalone-chrome:4.0.0-20211102" IS_CORE_CI=0 PHPSTAN_CONFIG_FILE="phpstan.local.neon" +IMAGE_PREFIX="ghcr.io/typo3/" # ENV var "CI" is set by gitlab-ci. We use it here to distinct 'local' and 'CI' environment. if [ "$CI" == "true" ]; then IS_CORE_CI=1 PHPSTAN_CONFIG_FILE="phpstan.ci.neon" + + # Set to empty to use docker hub (default) again. CI only until image cache issue has been solved in infrastructure. + IMAGE_PREFIX="typo3/" fi # Detect arm64 and use a seleniarm image. @@ -871,12 +876,12 @@ case ${TEST_SUITE} in docker volume ls -q -f driver=local -f dangling=true | awk '$0 ~ /^[0-9a-f]{64}$/ { print }' | xargs -I {} docker volume rm {} echo "" # pull typo3/core-testing-*:latest versions of those ones that exist locally - echo "> pull typo3/core-testing-*:latest versions of those ones that exist locally" - docker images typo3/core-testing-*:latest --format "{{.Repository}}:latest" | xargs -I {} docker pull {} + echo "> pull ${IMAGE_PREFIX}core-testing-*:latest versions of those ones that exist locally" + docker images ${IMAGE_PREFIX}core-testing-*:latest --format "{{.Repository}}:latest" | xargs -I {} docker pull {} echo "" # remove "dangling" typo3/core-testing-* images (those tagged as <none>) - echo "> remove \"dangling\" typo3/core-testing-* images (those tagged as <none>)" - docker images typo3/core-testing-* --filter "dangling=true" --format "{{.ID}}" | xargs -I {} docker rmi {} + echo "> remove \"dangling\" ${IMAGE_PREFIX}core-testing-* images (those tagged as <none>)" + docker images ${IMAGE_PREFIX}core-testing-* --filter "dangling=true" --format "{{.ID}}" | xargs -I {} docker rmi {} echo "" ;; *) diff --git a/Build/testing-docker/local/docker-compose.yml b/Build/testing-docker/local/docker-compose.yml index 6df98f80ddd4..3ee0ae57d61c 100644 --- a/Build/testing-docker/local/docker-compose.yml +++ b/Build/testing-docker/local/docker-compose.yml @@ -35,7 +35,7 @@ services: - /var/lib/postgresql/data:rw,noexec,nosuid web: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" stop_grace_period: 1s volumes: @@ -62,7 +62,7 @@ services: image: memcached:1.5-alpine acceptance_split: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -87,7 +87,7 @@ services: echo Database is up; " acceptance_application_mariadb: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" environment: typo3DatabaseName: func_test @@ -141,7 +141,7 @@ services: echo Database is up; " acceptance_application_mysql: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" environment: typo3DatabaseName: func_test @@ -195,7 +195,7 @@ services: echo Database is up; " acceptance_application_postgres: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -252,7 +252,7 @@ services: echo Database is up; " acceptance_install_mysql: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" environment: typo3InstallMysqlDatabaseHost: mysql @@ -299,7 +299,7 @@ services: echo Database is up; " acceptance_install_mariadb: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" environment: typo3InstallMysqlDatabaseHost: mariadb @@ -346,7 +346,7 @@ services: echo Database is up; " acceptance_install_postgres: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" environment: typo3InstallPostgresqlDatabaseHost: postgres @@ -385,7 +385,7 @@ services: sleep 1; " acceptance_install_sqlite: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -410,7 +410,7 @@ services: " build_css: - image: typo3/core-testing-js:latest + image: ${IMAGE_PREFIX}core-testing-js:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -428,7 +428,7 @@ services: " build_javascript: - image: typo3/core-testing-js:latest + image: ${IMAGE_PREFIX}core-testing-js:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -446,7 +446,7 @@ services: " cgl_git: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -460,7 +460,7 @@ services: " cgl_all: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -474,7 +474,7 @@ services: " check_annotations: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -488,7 +488,7 @@ services: " check_test_methods_prefix: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -502,7 +502,7 @@ services: " check_bom: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -516,7 +516,7 @@ services: " check_composer: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -530,7 +530,7 @@ services: " check_exception_codes: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -544,7 +544,7 @@ services: " check_extension_scanner_rst: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -558,7 +558,7 @@ services: " check_file_path_length: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -572,7 +572,7 @@ services: " check_git_submodule: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -589,7 +589,7 @@ services: " check_grunt_clean: - image: typo3/core-testing-js:latest + image: ${IMAGE_PREFIX}core-testing-js:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -611,7 +611,7 @@ services: " check_namespace_integrity: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -625,7 +625,7 @@ services: " check_permissions: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -639,7 +639,7 @@ services: " check_rst: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -653,7 +653,7 @@ services: " composer_install: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -670,7 +670,7 @@ services: " composer_install_max: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -694,7 +694,7 @@ services: " composer_install_min: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -718,7 +718,7 @@ services: " composer_test_distribution: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -738,7 +738,7 @@ services: " composer_validate: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -752,7 +752,7 @@ services: " functional_split: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -781,7 +781,7 @@ services: echo Database is up; " functional_mariadb: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -818,7 +818,7 @@ services: fi " functional_deprecated_mariadb: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -868,7 +868,7 @@ services: echo Database is up; " functional_mysql: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -905,7 +905,7 @@ services: fi " functional_deprecated_mysql: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -956,7 +956,7 @@ services: " functional_mssql2019latest: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -995,7 +995,7 @@ services: fi " functional_deprecated_mssql2019latest: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -1047,7 +1047,7 @@ services: echo Database is up; " functional_postgres: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -1084,7 +1084,7 @@ services: fi " functional_deprecated_postgres: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -1126,7 +1126,7 @@ services: sleep 1; " functional_sqlite: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" tmpfs: - ${CORE_ROOT}/typo3temp/var/tests/functional-sqlite-dbs/:rw,noexec,nosuid,uid=${HOST_UID} @@ -1161,7 +1161,7 @@ services: fi " functional_deprecated_sqlite: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" tmpfs: - ${CORE_ROOT}/typo3temp/var/tests/functional-sqlite-dbs/:rw,noexec,nosuid,uid=${HOST_UID} @@ -1192,7 +1192,7 @@ services: " lint_php: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -1207,7 +1207,7 @@ services: " lint_scss: - image: typo3/core-testing-js:latest + image: ${IMAGE_PREFIX}core-testing-js:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -1225,7 +1225,7 @@ services: " lint_html: - image: typo3/core-testing-js:latest + image: ${IMAGE_PREFIX}core-testing-js:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -1243,7 +1243,7 @@ services: " lint_typescript: - image: typo3/core-testing-js:latest + image: ${IMAGE_PREFIX}core-testing-js:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -1261,7 +1261,7 @@ services: " list_exception_codes: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -1275,7 +1275,7 @@ services: " phpstan: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -1291,7 +1291,7 @@ services: " phpstan_generate_baseline: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -1307,7 +1307,7 @@ services: " unit: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -1332,7 +1332,7 @@ services: " unitDeprecated: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -1357,7 +1357,7 @@ services: " unitJavascript: - image: typo3/core-testing-js-chrome:latest + image: ${IMAGE_PREFIX}core-testing-js-chrome:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} @@ -1376,7 +1376,7 @@ services: " unitRandom: - image: typo3/core-testing-${DOCKER_PHP_IMAGE}:latest + image: ${IMAGE_PREFIX}core-testing-${DOCKER_PHP_IMAGE}:latest user: "${HOST_UID}" volumes: - ${CORE_ROOT}:${CORE_ROOT} -- GitLab