forked from nagypeter/angular-node-creditscore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wercker.yml
108 lines (95 loc) · 3.58 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
box: node:6.10
build:
steps:
- script:
name: A step that executes `npm install` command
code: npm install
push-to-releases:
steps:
# Push to public docker repo Container Registry (CR)
- internal/docker-push:
tag: $WERCKER_GIT_BRANCH-$WERCKER_GIT_COMMIT
cmd: node /pipeline/source/app.js
deploy-to-oke:
box:
id: alpine
cmd: /bin/sh
steps:
- bash-template
- script:
name: "Visualise Kubernetes config"
code: cat kubernetes-deployment.yml
- kubectl:
name: create namespace
server: $KUBERNETES_MASTER
token: $KUBERNETES_TOKEN
insecure-skip-tls-verify: true
command: apply -f $WERCKER_ROOT/kubernetes-namespace.yml
- script:
name: wait to create namespace
code: sleep 10
- kubectl:
name: create OCR secret
server: $KUBERNETES_MASTER
token: $KUBERNETES_TOKEN
insecure-skip-tls-verify: true
command: create secret docker-registry wrelease --docker-server=wcr.io --docker-username=$WERCKER_APPLICATION_OWNER_NAME --docker-password=$KUBERNETES_TOKEN --docker-email=${WERCKER_APPLICATION_OWNER_NAME}@mail.com --namespace=$WERCKER_APPLICATION_OWNER_NAME; echo 'secret step'
- kubectl:
name: create deplyoment
server: $KUBERNETES_MASTER
token: $KUBERNETES_TOKEN
insecure-skip-tls-verify: true
command: apply -f $WERCKER_ROOT/kubernetes-deployment.yml --namespace=$WERCKER_APPLICATION_OWNER_NAME
- script:
name: "Visualise Ingress config"
code: cat ingress.yml
- kubectl:
name: create Ingress configuration
server: $KUBERNETES_MASTER
token: $KUBERNETES_TOKEN
insecure-skip-tls-verify: true
command: apply -f $WERCKER_ROOT/ingress.yml --namespace=$WERCKER_APPLICATION_OWNER_NAME
- kubectl:
name: get LoadBalancer public IP address
server: $KUBERNETES_MASTER
token: $KUBERNETES_TOKEN
insecure-skip-tls-verify: true
command: get svc -o jsonpath='{.items[*].status.loadBalancer.ingress[*].ip}' --all-namespaces
rest-functional-test:
steps:
- script:
name: Test Microservice
code: |
mkdir -p "/pipeline"
node $WERCKER_ROOT/app.js &
sleep 2
CREDITSCORE_URL=http://localhost:3000/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
ui-functional-test:
box:
id: peternagy/chrome-protractor-headless-test:node9.2-chrome62
steps:
- script:
name: Run UI test
code: |
nohup node $WERCKER_ROOT/app.js > creditscoreapp.log &
echo 'Application URL to test: http://localhost:3000/creditscore'
protractor $WERCKER_ROOT/test/protractor.conf.js
exit_status=$?
echo 'CreditScore app server log :::START'
cat creditscoreapp.log
echo 'CreditScore app server log :::END'
if [ $exit_status -eq 0 ]; then
echo "UI test passed"
else
echo "UI test failed"
exit -1
fi