-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake.sh
executable file
·52 lines (43 loc) · 1.71 KB
/
make.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
#!/bin/bash
build(){
docker build . -f docker/Dockerfile -t aroundthecode/configmap2consul:latest
}
consul(){
docker run --name test-consul -d -p 8500:8500/tcp -e 'CONSUL_LOCAL_CONFIG={"bootstrap_expect":1,"server":true}' consul agent -ui -server -bind=127.0.0.1 -client=0.0.0.0
}
test(){
pytest --flake8 --cov=configmap2consul --cov-report term-missing --ignore='tests/test_minikube.py'
}
start_minikube(){
minikube start --memory 10240 --cpus 4 --kubernetes-version v1.12.4 --feature-gates="PersistentLocalVolumes=true"
}
test_minikube(){
echo "create minikube elements"
kubectl apply -f tests/minikube/configmap2consul.yaml
echo "sleep 20s to wait consul startup"
sleep 20
echo "running tests"
pytest --flake8 --cov=configmap2consul --cov-report term-missing --consul_url "http://$(minikube ip):32080"
kubectl delete -f tests/minikube/configmap2consul.yaml
}
sonar(){
echo "create minikube elements"
kubectl apply -f tests/minikube/configmap2consul.yaml
echo "sleep 20s to wait consul startup"
sleep 20
echo "running tests with sonar report format"
pytest --flake8 --cov=configmap2consul --junitxml tests/junit.xml --cov-report xml --consul_url "http://$(minikube ip):32080"
kubectl delete -f tests/minikube/configmap2consul.yaml
echo "converting coverage in sonar format"
coverage xml -i
echo "invoking sonar scanner"
sonar-scanner -Dsonar.login=${SONAR_TOKEN} -Dsonar.projectKey=aroundthecode_configmap2consul -Dsonar.organization=aroundthecode-github -Dsonar.host.url=https://sonarcloud.io
}
clean(){
rm -rf wheels dist
docker rmi -f configmap2consul:test
docker rmi -f configmap2consul:build
docker rmi -f aroundthecode/configmap2consul:latest
docker rm -f test-consul
}
$@