-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathentrypoint.sh
executable file
·35 lines (29 loc) · 1.08 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
#!/bin/bash
# Omits 'set -e' because short-circuiting this script fails the GitHub action unintentionally
FAIL=${FAIL_LEVEL:=ERROR}
MANAGE_PATH=${GITHUB_WORKSPACE}/${APP_PATH}
REQS=${GITHUB_WORKSPACE}/${DEP_PATH}
ARGS=${EXTRA_ARGS}
echo -e "Path to manage.py set as: " $MANAGE_PATH
echo -e "Requirements path set as: " $REQS
if [[ "$ENV_TYPE" == "pipenv" ]]; then
cd $REQS
pip3 install pipenv
PIPENV_IGNORE_VIRTUALENVS=1 pipenv install
cd $MANAGE_PATH && PIPENV_IGNORE_VIRTUALENVS=1 pipenv run python3 manage.py check --deploy --fail-level ${FAIL} ${ARGS} &> output.txt
EXIT_CODE=$?
fi
if [[ "$ENV_TYPE" == "venv" ]]; then
pip install -r $REQS
cd $MANAGE_PATH && python manage.py check --deploy --fail-level ${FAIL} ${ARGS} &> output.txt
EXIT_CODE=$?
fi
if [[ -z "$ENV_TYPE" ]]; then
echo "No virtual environment specified."
pip install django
cd $MANAGE_PATH && python manage.py check --deploy --fail-level ${FAIL} ${ARGS} &> output.txt
EXIT_CODE=$?
fi
echo -e "\n--------- Django Security Check results ---------"
cat output.txt
exit $EXIT_CODE