-
Notifications
You must be signed in to change notification settings - Fork 4
/
entrypoint.sh
executable file
·74 lines (51 loc) · 1.92 KB
/
entrypoint.sh
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
74
#!/bin/bash
set -e
EXTENSION_DIR=${EXTENSION_DIR:-'/extension'}
RUNNING_MODE=local
if [[ "$EXTENSION_DIR" != /* ]]; then
echo "Extension directory ($EXTENSION_DIR) must be an absolute path"
exit 1
fi
if [ -n "${REPOSITORY_URL+set}" ] && [ -n "${COMMIT_ID+set}" ]; then
git clone $REPOSITORY_URL $EXTENSION_DIR
git -C $EXTENSION_DIR checkout $COMMIT_ID
RUNNING_MODE=cloud
fi
if [ ! -d $EXTENSION_DIR ]; then
echo "Extension directory ($EXTENSION_DIR) not found"
exit 1
fi
cd $EXTENSION_DIR
if [[ "$1" == "cextrun" ]]; then
if [ ! -f $EXTENSION_DIR/pyproject.toml ]; then
echo "pyproject.toml not found in $EXTENSION_DIR"
exit 1
fi
poetry install
if [[ "$RUNNING_MODE" == "local" ]] && [[ -f $EXTENSION_DIR/package.json ]]; then
test ! -d "node_modules" && test -d /install_temp/node_modules && ln -s /install_temp/node_modules .
npm run build --if-present
fi
fi
if [[ "$1" == "extension-test" ]] || [[ "$1" == "extension-devel" ]]; then
poetry install
if [[ "$RUNNING_MODE" == "local" ]] && [[ -f $EXTENSION_DIR/package.json ]]; then
test ! -d "node_modules" && test -d /install_temp/node_modules && ln -s /install_temp/node_modules .
npm run build --if-present
fi
fi
if [[ "$1" == *bash* ]] && [[ "$#" -eq 1 ]] && [[ -f pyproject.toml ]]; then
poetry install
if [[ "$RUNNING_MODE" == "local" ]] && [[ -f $EXTENSION_DIR/package.json ]]; then
test ! -d "node_modules" && test -d /install_temp/node_modules && ln -s /install_temp/node_modules .
npm run build --if-present
fi
echo
pyfiglet -f ansi_regular -c BLUE "Connect Extension Runner"
if [[ "$RUNNING_MODE" == "local" ]] && [[ -f $EXTENSION_DIR/package.json ]]; then
while read -r line; do echo -e $line; done < /banners/banner_ui
else
while read -r line; do echo -e $line; done < /banners/banner
fi
fi
exec "$@"