Skip to content

Commit

Permalink
gitlab review stage now use common rabbitmq
Browse files Browse the repository at this point in the history
- individual branches are distinguished by vhost
  • Loading branch information
grossmannmartin committed Dec 21, 2023
1 parent 4437743 commit 1e877d0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions gitlab/docker-compose-ci-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -68,6 +69,7 @@ services:
PACKETERY_API_PASSWORD: ~
PACKETERY_SENDER: ~
FORCE_ELASTIC_LIMITS: 1
MESSENGER_TRANSPORT_VHOST: ${COMPOSE_PROJECT_NAME}
networks:
- default
- services-network
Expand Down
24 changes: 24 additions & 0 deletions gitlab/scripts/rabbitmq-vhost.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash -e

RABBITMQCTL_EXEC='docker exec ci_rabbitmq_1 rabbitmqctl'
VHOST=$2

if [[ "$VHOST" == "" ]]; then
echo "Usage: $0 <create/remove> <vhost>"
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 <create/remove> <vhost>"; exit 1;;
esac

0 comments on commit 1e877d0

Please sign in to comment.