forked from ansible/galaxy_ng
-
Notifications
You must be signed in to change notification settings - Fork 1
/
compose
executable file
·73 lines (62 loc) · 2.47 KB
/
compose
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
set -o nounset
set -o errexit
# the internal mechanisms for installing and testing do not
# work if the checkout path is not named "galaxy_ng", so
# this script should -always- abort if that is not the case.
CWD=$(basename $(pwd))
if [[ "${CWD}" != "galaxy_ng" ]]; then
cat >&2 <<EOF
ERROR: The checkout directory -must- be named galaxy_ng. A different
name can cause many unintended behaviors inside the containers
EOF
exit 1
fi
if [[ -f '.compose.env' ]]; then
# export variables from .compose.env but only if the var is not already set.
eval "$(grep -v '^#' .compose.env | sed -E 's|^(.+)=(.*)$|export \1=${\1:-\2}|g' | xargs -L 1)"
fi
if [[ -z "${COMPOSE_PROFILE:-}" ]]; then
cat >&2 <<EOF
ERROR: The \$COMPOSE_PROFILE environment variable MUST be set.
The the easiest way to to this is to create a .compose.env file by running:
\$ cp .compose.env.example .compose.env
EOF
exit 1
fi
echo "INFO: Using compose profile ${COMPOSE_PROFILE}" >&2
echo "INFO: ${DEV_SOURCE_PATH:-No} packages installed from source" >&2
echo "INFO: Image suffix ${DEV_IMAGE_SUFFIX:-is unset}" >&2
echo "INFO: Volume suffix ${DEV_VOLUME_SUFFIX:-${DEV_IMAGE_SUFFIX:-is unset}}" >&2
compose_args=(
-f 'dev/docker-compose.yml'
-f "dev/${COMPOSE_PROFILE}/docker-compose.yml"
)
if [[ -z "${ANSIBLE_HUB_UI_PATH:-}" ]]; then
cat >&2 << EOF
INFO: \$ANSIBLE_HUB_UI_PATH is unset.
If you want to run the UI inside compose please set \$ANSIBLE_HUB_UI_PATH
to the location of your local copy of https://github.com/ansible/ansible-hub-ui.
EOF
else
compose_args+=(
-f 'dev/common/docker-compose-ui.yaml'
-f "dev/${COMPOSE_PROFILE}/docker-compose-ui.yaml"
)
fi
declare -xr DEV_SOURCE_PATH=${DEV_SOURCE_PATH:-galaxy_ng}
declare -xr COMPOSE_CONTEXT=".."
declare -xr LOCK_REQUIREMENTS="${LOCK_REQUIREMENTS:-1}"
declare -xr COMPOSE_PROFILE="${COMPOSE_PROFILE}"
declare -xr ENABLE_SIGNING="${ENABLE_SIGNING:-1}"
declare -xr DEV_IMAGE_SUFFIX="${DEV_IMAGE_SUFFIX:-}"
declare -xr DEV_VOLUME_SUFFIX="${DEV_VOLUME_SUFFIX:-${DEV_IMAGE_SUFFIX}}"
declare -xr COMPOSE_PROJECT_NAME="${COMPOSE_PROJECT_NAME:-galaxy_ng${DEV_IMAGE_SUFFIX:-}}"
declare -xr WITH_DEV_INSTALL="${WITH_DEV_INSTALL:-1}"
#if [ -v SOCIAL_AUTH_GITHUB_KEY ]; then
# declare -xr SOCIAL_AUTH_GITHUB_KEY="${SOCIAL_AUTH_GITHUB_KEY:null}"
#fi
#if [ -v SOCIAL_AUTH_GITHUB_SECRET ]; then
# declare -xr SOCIAL_AUTH_GITHUB_SECRET="${SOCIAL_AUTH_GITHUB_SECRET:null}"
#fi
exec docker-compose "${compose_args[@]}" "$@"