From c0cfecefb5d3832e53241a5e450a0940769d9c63 Mon Sep 17 00:00:00 2001 From: Martin Grossmann Date: Thu, 21 Dec 2023 22:56:05 +0100 Subject: [PATCH] gitlab review stage now use common rabbitmq - individual branches are distinguished by vhost --- .gitlab-ci.yml | 1 + gitlab/docker-compose-ci-review.yml | 5 ++--- gitlab/scripts/rabbitmq-vhost.sh | 24 ++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) create mode 100755 gitlab/scripts/rabbitmq-vhost.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index efa1688519..c68ffef175 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -159,6 +159,7 @@ review: - cp -f ./gitlab/docker-compose-ci-review.yml ./docker-compose.yml - chmod +x ./gitlab/scripts/set-urls-for-review.sh && ./gitlab/scripts/set-urls-for-review.sh setDomainsToDockerCompose - docker-compose down --rmi all -v --remove-orphans + - chmod +x ./gitlab/scripts/rabbitmq-vhost.sh && ./gitlab/scripts/rabbitmq-vhost.sh create ${COMPOSE_PROJECT_NAME} - docker-compose up -d - ./gitlab/scripts/set-urls-for-review.sh setUrlsToDomainsUrls - docker-compose exec -T php-fpm php phing -D production.confirm.action=y clean db-create build-review-ci diff --git a/gitlab/docker-compose-ci-review.yml b/gitlab/docker-compose-ci-review.yml index b226fa3d3c..1088bbc73c 100644 --- a/gitlab/docker-compose-ci-review.yml +++ b/gitlab/docker-compose-ci-review.yml @@ -46,6 +46,7 @@ services: PACKETERY_API_PASSWORD: ~ PACKETERY_SENDER: ~ FORCE_ELASTIC_LIMITS: 1 + MESSENGER_TRANSPORT_VHOST: ${COMPOSE_PROJECT_NAME} labels: - traefik.enable=false networks: @@ -68,6 +69,7 @@ services: PACKETERY_API_PASSWORD: ~ PACKETERY_SENDER: ~ FORCE_ELASTIC_LIMITS: 1 + MESSENGER_TRANSPORT_VHOST: ${COMPOSE_PROJECT_NAME} networks: - default - services-network @@ -78,9 +80,6 @@ services: labels: - traefik.enable=false - rabbitmq: - image: rabbitmq:3.12-management-alpine - img-proxy: image: darthsim/imgproxy:latest diff --git a/gitlab/scripts/rabbitmq-vhost.sh b/gitlab/scripts/rabbitmq-vhost.sh new file mode 100755 index 0000000000..b36252a1a7 --- /dev/null +++ b/gitlab/scripts/rabbitmq-vhost.sh @@ -0,0 +1,24 @@ +#!/bin/bash -e + +RABBITMQCTL_EXEC='docker exec ci_rabbitmq_1 rabbitmqctl' +VHOST=$2 + +if [[ "$VHOST" == "" ]]; then + echo "Usage: $0 " + exit 1 +fi + +create () { + $RABBITMQCTL_EXEC add_vhost "${VHOST}" + $RABBITMQCTL_EXEC set_permissions -p "${VHOST}" guest ".*" ".*" ".*" +} + +remove() { + $RABBITMQCTL_EXEC delete_vhost "${VHOST}" || true +} + +case $1 in + create) "$@"; exit;; + remove) "$@"; exit;; + *) echo "Usage: $0 "; exit 1;; +esac