-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.travis.yml
62 lines (58 loc) · 4.08 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
notifications:
email: true
sudo: required
language: minimal
services:
- docker
before_install:
- export SPLUNK_HOME="/opt/splunk"
- export RANDOM_PASSWORD=$(openssl rand -hex 20)
# Pull docker image
- docker pull splunk/splunk
# Add DOCKER to iptables, 1/10 times this is needed, force 0 exit status
- sudo iptables -N DOCKER || true
- sudo iptables -I INPUT -p tcp --dport $SPLKMGMT -j ACCEPT || true
# Start Docker container
- docker create --name autobuild_$SPLKMGMT --hostname autobuild -v /opt/splunk/etc/apps
-e "SPLUNK_PASSWORD=$RANDOM_PASSWORD" -e "SPLUNK_START_ARGS=--accept-license" -p "$SPLKMGMT:8089"
-e "SPLUNK_USER=splunk" splunk/splunk:$SPLUNK_VERSION
- echo "`date -u` - Starting container"
- docker start autobuild_$SPLKMGMT
- for i in `seq 0 5 100`; do if curl --fail -k -u admin:$RANDOM_PASSWORD https://localhost:$SPLKMGMT/services/server/info &> /dev/null;
then break; fi; echo "`date -u` - Waited $i seconds for container to start" ;
sleep 5 ; if [ "100" -eq "$i" ]; then echo "Splunk not started, exiting..."; exit -1 ; fi ; done
install:
- echo "`date -u` - Installing TA"
- docker cp $TRAVIS_BUILD_DIR autobuild_$SPLKMGMT:/opt/splunk/etc/apps/
- docker exec autobuild_$SPLKMGMT sudo chown -R splunk.splunk /opt/splunk/etc/apps/TA-connectivity
- echo "`date -u` - Restarting splunk"
- curl -k -u admin:$RANDOM_PASSWORD https://localhost:$SPLKMGMT/services/server/control/restart -X POST &>/dev/null
- sleep 20
script:
- echo "`date -u` - Checking if TA was installed successfully and enabled"
- curl --fail -k -u admin:$RANDOM_PASSWORD https://localhost:$SPLKMGMT/services/apps/local/TA-connectivity 2>&1 | grep -q "\"disabled\">0"
- echo "Checking if modular input is not broken"
- curl --fail -k -u admin:$RANDOM_PASSWORD https://localhost:$SPLKMGMT/services/data/modular-inputs/ping 2>&1 &> /dev/null
- curl --fail -k -u admin:$RANDOM_PASSWORD https://localhost:$SPLKMGMT/services/data/modular-inputs/webping 2>&1 &> /dev/null
- curl --fail -k -u admin:$RANDOM_PASSWORD https://localhost:$SPLKMGMT/services/data/modular-inputs/connect 2>&1 &> /dev/null
- echo "`date -u` - Enabling test inputs"
- curl --fail -k -u admin:$RANDOM_PASSWORD -X POST
https://localhost:$SPLKMGMT/servicesNS/nobody/TA-connectivity/data/inputs/ping/%252Fopt%252Fsplunk%252Fetc%252Fapps%252FTA-connectivity%252Flookups%252Fhostfile.csv/enable 2>&1 | grep -q "\"disabled\">0"
- curl --fail -k -u admin:$RANDOM_PASSWORD -X POST
https://localhost:$SPLKMGMT/servicesNS/nobody/TA-connectivity/data/inputs/webping/%252Fopt%252Fsplunk%252Fetc%252Fapps%252FTA-connectivity%252Flookups%252Fhostfile.csv/enable 2>&1 | grep -q "\"disabled\">0"
- curl --fail -k -u admin:$RANDOM_PASSWORD -X POST
https://localhost:$SPLKMGMT/servicesNS/nobody/TA-connectivity/data/inputs/connect/%252Fopt%252Fsplunk%252Fetc%252Fapps%252FTA-connectivity%252Flookups%252Fhostfile.csv/enable 2>&1 | grep -q "\"disabled\">0"
- curl --fail -k -u admin:$RANDOM_PASSWORD -X POST
https://localhost:$SPLKMGMT/servicesNS/nobody/TA-connectivity/data/inputs/connect/%252Fopt%252Fsplunk%252Fetc%252Fapps%252FTA-connectivity%252Flookups%252Fhostfile2.csv/enable 2>&1 | grep -q "\"disabled\">0"
- echo "`date -u` - Restarting splunk"
- curl -k -u admin:$RANDOM_PASSWORD https://localhost:$SPLKMGMT/services/server/control/restart -X POST &>/dev/null
- sleep 20
- echo "Check internal logs for Execprocessor events"
- curl --get -f -k -u admin:$RANDOM_PASSWORD https://localhost:$SPLKMGMT/services/search/jobs/export --data-urlencode search='search index=_internal sourcetype=splunkd (component=ModularInputs OR component=ExecProcessor) (connect.py OR webping.py OR ping.py) | head 20 | table _time _raw' -d earliest="-365d" -d latest=now -d output_mode=raw
- echo "Display actual events"
- curl --get -k -u admin:$RANDOM_PASSWORD https://localhost:$SPLKMGMT/services/search/jobs/export --data-urlencode search='search index=main sourcetype=*ping | head 50 | table _time sourcetype _raw' -d output_mode=raw -d earliest=-5y -d latest=now
env:
- "SPLUNK_VERSION=7.2 SPLKMGMT=9990"
- "SPLUNK_VERSION=7.3 SPLKMGMT=9991"
- "SPLUNK_VERSION=8.0 SPLKMGMT=9992"
- "SPLUNK_VERSION=latest SPLKMGMT=9993"