forked from mikelehmann/angularjs-springboot-CreditScoreApp
-
Notifications
You must be signed in to change notification settings - Fork 11
/
wercker.yml
84 lines (72 loc) · 2.63 KB
/
wercker.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
box: combient/java-mvn
build:
steps:
# Build Inventory REST application
- script:
name: Maven install
code: mvn install
push:
steps:
# Push to public docker repo Container Registry (CR)
- internal/docker-push:
tag: latest
repository: $CR_REPOSITORY
cmd: java -jar /pipeline/source/target/loan-0.1.0.war
deploy-to-cluster:
box:
id: alpine
cmd: /bin/sh
steps:
- kubectl:
name: delete secret
server: $KUBERNETES_MASTER
token: $KUBERNETES_TOKEN
insecure-skip-tls-verify: true
command: delete secret ocrsecret; echo delete registry secret
- kubectl:
name: create secret
server: $KUBERNETES_MASTER
token: $KUBERNETES_TOKEN
insecure-skip-tls-verify: true
command: create secret docker-registry ocrsecret --docker-server=wcr.io --docker-username=$WERCKER_APPLICATION_OWNER_NAME --docker-password=$KUBERNETES_TOKEN --docker-email=$DOCKER_EMAIL; echo create registry secret
- kubectl:
name: delete deployment
server: $KUBERNETES_MASTER
token: $KUBERNETES_TOKEN
insecure-skip-tls-verify: true
command: delete deployment rest-creditscore; echo delete deplyment
- kubectl:
name: create deployment
server: $KUBERNETES_MASTER
token: $KUBERNETES_TOKEN
insecure-skip-tls-verify: true
command: create -f $WERCKER_ROOT/creditscore-deployment.yaml; echo create deployment
- kubectl:
name: expose service
server: $KUBERNETES_MASTER
token: $KUBERNETES_TOKEN
insecure-skip-tls-verify: true
command: expose deployment rest-creditscore --type=LoadBalancer --name=rest-creditscore --port=80 --target-port=8080; echo expose deployment
testapp:
steps:
- script:
name: Run and Test microservice
code: |
java -jar /pipeline/source/target/loan-0.1.0.war &
sleep 10
CREDITSCORE_URL=http://localhost:8080/creditscore
echo 'Microservice URL=' $CREDITSCORE_URL
if curl -X POST -H "Content-Type: application/json" -X POST -d '{"firstname":"John","lastname":"Doe","dateofbirth":"01/01/2015","ssn":"111223333"}' $CREDITSCORE_URL | grep "firstname"
then
# if the keyword is in the conent
echo "Test passed"
else
echo "Test failed"
exit -1
fi
restart:
steps:
# Restart Docker on OCCS using webhook
- script:
name: curl POST
code: curl -k -X POST $DEPLOYMENT_WEBHOOK