mirror of
https://github.com/frappe/frappe_docker.git
synced 2024-11-08 14:21:05 +00:00
ci: check shell script format
This commit is contained in:
parent
391ee4c74e
commit
86a2fcc1fa
@ -156,8 +156,9 @@ jobs:
|
||||
- sudo curl -L "https://github.com/docker/compose/releases/download/1.26.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
||||
- sudo chmod +x /usr/local/bin/docker-compose
|
||||
- sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
|
||||
- sudo apt-get update && sudo apt-get -y install w3m
|
||||
- sudo apt-get update && sudo apt-get -y install w3m shellcheck
|
||||
script:
|
||||
- ./tests/check-format.sh
|
||||
- docker build -t frappe/frappe-socketio:edge -f build/frappe-socketio/Dockerfile .
|
||||
- docker build -t frappe/frappe-worker:develop -f build/frappe-worker/Dockerfile .
|
||||
- docker build -t frappe/erpnext-worker:edge -f build/erpnext-worker/Dockerfile .
|
||||
|
@ -36,3 +36,33 @@ Place relevant markdown file(s) in the `docs` directory and index them in README
|
||||
# Wiki
|
||||
|
||||
Add alternatives that can be used optionally along with frappe_docker. Add articles to list on home page as well.
|
||||
|
||||
# Prerequisites to pass CI
|
||||
|
||||
### Check shell script format
|
||||
|
||||
Use the following script
|
||||
|
||||
```shell
|
||||
./tests/check-format.sh
|
||||
```
|
||||
|
||||
### Build images locally
|
||||
|
||||
Use the following commands
|
||||
|
||||
```shell
|
||||
docker build -t frappe/frappe-socketio:edge -f build/frappe-socketio/Dockerfile .
|
||||
docker build -t frappe/frappe-worker:develop -f build/frappe-worker/Dockerfile .
|
||||
docker build -t frappe/erpnext-worker:edge -f build/erpnext-worker/Dockerfile .
|
||||
docker build -t frappe/frappe-nginx:develop -f build/frappe-nginx/Dockerfile .
|
||||
docker build -t frappe/erpnext-nginx:edge -f build/erpnext-nginx/Dockerfile .
|
||||
```
|
||||
|
||||
### Test running docker containers
|
||||
|
||||
Use the following script
|
||||
|
||||
```shell
|
||||
./tests/docker-test.sh
|
||||
```
|
||||
|
@ -44,8 +44,7 @@ function configureEnv() {
|
||||
}
|
||||
|
||||
function checkConnection() {
|
||||
. /home/frappe/frappe-bench/env/bin/activate
|
||||
python /home/frappe/frappe-bench/commands/check_connection.py
|
||||
/home/frappe/frappe-bench/env/bin/python /home/frappe/frappe-bench/commands/check_connection.py
|
||||
}
|
||||
|
||||
function checkConfigExists() {
|
||||
@ -88,12 +87,10 @@ case "$1" in
|
||||
LOAD_CONFIG_FILE="-c /home/frappe/frappe-bench/commands/gevent_patch.py"
|
||||
|
||||
if [[ -n "${AUTO_MIGRATE}" ]]; then
|
||||
. /home/frappe/frappe-bench/env/bin/activate
|
||||
python /home/frappe/frappe-bench/commands/auto_migrate.py
|
||||
/home/frappe/frappe-bench/env/bin/python /home/frappe/frappe-bench/commands/auto_migrate.py
|
||||
fi
|
||||
|
||||
. /home/frappe/frappe-bench/env/bin/activate
|
||||
gunicorn ${LOAD_CONFIG_FILE} -b 0.0.0.0:${FRAPPE_PORT} \
|
||||
/home/frappe/frappe-bench/env/bin/gunicorn ${LOAD_CONFIG_FILE} -b 0.0.0.0:${FRAPPE_PORT} \
|
||||
--worker-tmp-dir /dev/shm \
|
||||
--threads=4 \
|
||||
--workers ${WORKERS} \
|
||||
@ -107,16 +104,14 @@ case "$1" in
|
||||
checkConnection
|
||||
# default WORKER_TYPE=default
|
||||
|
||||
. /home/frappe/frappe-bench/env/bin/activate
|
||||
python /home/frappe/frappe-bench/commands/worker.py
|
||||
/home/frappe/frappe-bench/env/bin/python /home/frappe/frappe-bench/commands/worker.py
|
||||
;;
|
||||
|
||||
schedule)
|
||||
checkConfigExists
|
||||
checkConnection
|
||||
|
||||
. /home/frappe/frappe-bench/env/bin/activate
|
||||
python /home/frappe/frappe-bench/commands/background.py
|
||||
/home/frappe/frappe-bench/env/bin/python /home/frappe/frappe-bench/commands/background.py
|
||||
|
||||
;;
|
||||
|
||||
@ -124,8 +119,7 @@ case "$1" in
|
||||
checkConfigExists
|
||||
checkConnection
|
||||
|
||||
. /home/frappe/frappe-bench/env/bin/activate
|
||||
python /home/frappe/frappe-bench/commands/new.py
|
||||
/home/frappe/frappe-bench/env/bin/python /home/frappe/frappe-bench/commands/new.py
|
||||
exit
|
||||
;;
|
||||
|
||||
@ -133,27 +127,23 @@ case "$1" in
|
||||
checkConfigExists
|
||||
checkConnection
|
||||
|
||||
. /home/frappe/frappe-bench/env/bin/activate
|
||||
python /home/frappe/frappe-bench/commands/drop.py
|
||||
/home/frappe/frappe-bench/env/bin/python /home/frappe/frappe-bench/commands/drop.py
|
||||
exit
|
||||
;;
|
||||
|
||||
migrate)
|
||||
. /home/frappe/frappe-bench/env/bin/activate
|
||||
python /home/frappe/frappe-bench/commands/migrate.py
|
||||
/home/frappe/frappe-bench/env/bin/python /home/frappe/frappe-bench/commands/migrate.py
|
||||
exit
|
||||
;;
|
||||
|
||||
doctor)
|
||||
. /home/frappe/frappe-bench/env/bin/activate
|
||||
python /home/frappe/frappe-bench/commands/doctor.py "${@:2}"
|
||||
/home/frappe/frappe-bench/env/bin/python /home/frappe/frappe-bench/commands/doctor.py "${@:2}"
|
||||
exit
|
||||
;;
|
||||
|
||||
backup)
|
||||
|
||||
. /home/frappe/frappe-bench/env/bin/activate
|
||||
python /home/frappe/frappe-bench/commands/backup.py
|
||||
/home/frappe/frappe-bench/env/bin/python /home/frappe/frappe-bench/commands/backup.py
|
||||
exit
|
||||
;;
|
||||
|
||||
@ -164,20 +154,17 @@ case "$1" in
|
||||
exit 1
|
||||
fi
|
||||
|
||||
. /home/frappe/frappe-bench/env/bin/activate
|
||||
python /home/frappe/frappe-bench/commands/console.py "$2"
|
||||
/home/frappe/frappe-bench/env/bin/python /home/frappe/frappe-bench/commands/console.py "$2"
|
||||
exit
|
||||
;;
|
||||
|
||||
push-backup)
|
||||
. /home/frappe/frappe-bench/env/bin/activate
|
||||
python /home/frappe/frappe-bench/commands/push_backup.py
|
||||
/home/frappe/frappe-bench/env/bin/python /home/frappe/frappe-bench/commands/push_backup.py
|
||||
exit
|
||||
;;
|
||||
|
||||
restore-backup)
|
||||
. /home/frappe/frappe-bench/env/bin/activate
|
||||
python /home/frappe/frappe-bench/commands/restore_backup.py
|
||||
/home/frappe/frappe-bench/env/bin/python /home/frappe/frappe-bench/commands/restore_backup.py
|
||||
exit
|
||||
;;
|
||||
*)
|
||||
|
@ -4,13 +4,7 @@ APP_NAME=${1}
|
||||
APP_REPO=${2}
|
||||
APP_BRANCH=${3}
|
||||
|
||||
cd /home/frappe/frappe-bench/
|
||||
|
||||
. env/bin/activate
|
||||
|
||||
cd ./apps
|
||||
|
||||
[[ -n "${APP_BRANCH}" ]] && BRANCH="-b ${APP_BRANCH}"
|
||||
|
||||
git clone --depth 1 -o upstream ${APP_REPO} ${BRANCH} ${APP_NAME}
|
||||
pip3 install --no-cache-dir -e /home/frappe/frappe-bench/apps/${APP_NAME}
|
||||
git clone --depth 1 -o upstream ${APP_REPO} ${BRANCH} /home/frappe/frappe-bench/apps/${APP_NAME}
|
||||
/home/frappe/frappe-bench/env/bin/pip3 install --no-cache-dir -e /home/frappe/frappe-bench/apps/${APP_NAME}
|
||||
|
11
tests/check-format.sh
Executable file
11
tests/check-format.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "Checking bash scripts with shellcheck" >&2
|
||||
|
||||
shellcheck --check-sourced --severity=style --color=always --exclude=SC2164,SC2086,SC2012,SC2016 \
|
||||
build/common/worker/docker-entrypoint.sh \
|
||||
build/common/worker/healthcheck.sh \
|
||||
build/common/worker/install_app.sh \
|
||||
build/erpnext-nginx/install_app.sh \
|
||||
build/frappe-nginx/docker-entrypoint.sh \
|
||||
build/frappe-socketio/docker-entrypoint.sh
|
Loading…
Reference in New Issue
Block a user