forked from DefectDojo/django-DefectDojo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
105 lines (97 loc) · 2.73 KB
/
.travis.yml
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
sudo: required
language: python
install: true
env:
- TEST=smoke-test
- TEST=integration-test
- TEST=unit-test
- TEST=bandit
- TEST=docker-bench-security
- TEST=ansible
- TEST=flake8-complete
- TEST=flake8
matrix:
allow_failures:
- env: TEST=smoke-test
- env: TEST=bandit
- env: TEST=sourceclear
- env: TEST=flake8-complete
services:
- docker
before_script:
- export -f travis_fold
- export REPO=appsecpipeline/django-defectdojo
- export TAG=`if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo $TRAVIS_BRANCH ; fi`
script:
- |
echo "Running test=$TEST"
case "$TEST" in
smoke-test)
travis_fold start "smoke-test"
bash entrypoint_scripts/test/travis-smoke-test.sh || exit 1
travis_fold end "smoke-test"
;;
unit-test)
travis_fold start "unit-test"
bash entrypoint_scripts/test/travis-unit-test.sh || exit 1
travis_fold end "unit-test"
;;
integration-test)
travis_fold start "integration-test"
bash entrypoint_scripts/test/travis-integration-test.sh || exit 1
travis_fold end "integration-test"
;;
sourceclear)
## Run the SRC:CLR Scan
curl -sSL https://download.sourceclear.com/ci.sh | bash
;;
bandit)
# install bandit
pip install bandit
## Run Bandit python static code
bandit -r * -x venv,tests,ansible
;;
docker-bench-security)
## Run Docker Bench for Security
git clone https://github.com/docker/docker-bench-security.git
cd docker-bench-security
sh docker-bench-security.sh
;;
ansible)
true
;;
pep8)
pip install flake8
flake8 .
;;
flake8)
echo "$TRAVIS_BRANCH"
if [ "$TRAVIS_BRANCH" == "dev" ]
then
echo "Running Flake8 tests on dev branch aka pull requests"
# We need to checkout dev for flake8-diff to work properly
git checkout dev
pip install pep8 flake8 flake8-diff
flake8-diff
else
echo "true"
fi
esac
after_success:
#Push to docker repo
- |
if [ "$TRAVIS_TAG" != "" ] && [ "$DOCKER_USER" != "" ] && [ "$DOCKER_PASS" != "" ]; then
docker tag $REPO $REPO:$TRAVIS_TAG
docker login -u "$DOCKER_USER" -p "$DOCKER_PASS";
docker push $REPO ;
fi
notifications:
slack:
rooms:
secure: nPXwHnPcf37yGkCkLimx5UmY9LTtOHL0lw88cAQeXCNNjeZuhS2jS5xGUOwwp3SrsYE4tZhD0WuVEHGDcyIhmBZh9Qqk3NHKz+tQDD/e0GE/8uTTfR1Eh+pq1YOIcLYzzKA2khmJSeHqqDriVZZoWpn67oHtrui9FYesapZ8AX0=
on_success: never
on_failure: never
on_start: never
addons:
firefox: "45.0"
chrome: stable