-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
107 lines (100 loc) · 3.15 KB
/
.gitlab-ci.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
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
- '[[ -f /.dockerenv ]] && echo -e "Host gitlab.com\n\tUseKeychain yes\n\tAddKeysToAgent yes\n\tRSAAuthentication yes\n\tIdentityFile ~/.ssh/id_rsa" > ~/.ssh/config'
- cat ~/.ssh/config
- ssh-keyscan gitlab.com
- ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- ls -al ~/.ssh
- ssh -T git@gitlab.com || true
stages:
- test
- Push To Dev
- clean
- deploy
- run
test-cordapp:
stage: test
script:
- chmod +x gradlew
# - ./gradlew build
tags:
- dev
only:
- master
##------------ Start DEV Environment ------------##
push-cordapp-dev:
stage: Push To Dev
script:
- git branch -D dev 2>/dev/null || true
- git checkout -b dev
- git remote set-url --push origin "git@gitlab.com:syne-corda/obligation-cordapp-template.git"
- git push --set-upstream origin dev
# when: manual
allow_failure: true
tags:
- dev
only:
- master
clean-borrower-a-dev:
stage: clean
script:
- echo "$SSH_PVT_KEY" >> "key.pem"
- chmod 600 key.pem
- ssh -T -i key.pem -o StrictHostKeyChecking=no blockchain@$BORROWER_A_DEV_IP <<EOF
- cd syne-corda/obligation-cordapp-template
- docker-compose down
- sudo rm -rf syne-corda/obligation-cordapp-template/BorrowerA
- sudo rm -rf syne-corda/obligation-cordapp-template/Notary
dependencies:
- test-cordapp
tags:
- dev
only:
- dev
clean-lender-a-dev:
stage: clean
script:
- echo "$SSH_PVT_KEY" >> "key.pem"
- chmod 600 key.pem
- ssh -T -i key.pem -o StrictHostKeyChecking=no blockchain@$LENDER_A_DEV_IP <<EOF
- cd syne-corda/obligation-cordapp-template
- docker-compose down
- sudo rm -rf repo-cordapp/LenderA
tags:
- dev
only:
- dev
deploy-cordapp-dev:
stage: deploy
script:
- ./gradlew build install dockerNodes -x test
- ls build/nodes
- echo "$SSH_PVT_KEY" >> "key.pem"
- chmod 600 key.pem
- scp -i key.pem -o StrictHostKeyChecking=no -r build/nodes/BorrowerA/ blockchain@$BORROWER_A_DEV_IP:syne-corda/obligation-cordapp-template/
- scp -i key.pem -o StrictHostKeyChecking=no -r build/nodes/Notary/ blockchain@$BORROWER_A_DEV_IP:syne-corda/obligation-cordapp-template/
- scp -i key.pem -o StrictHostKeyChecking=no -r build/nodes/LenderA/ blockchain@$LENDER_A_DEV_IP:syne-corda/obligation-cordapp-template/
tags:
- dev
only:
- dev
run-docker-compose-file:
stage: run
script:
- echo "$SSH_PVT_KEY" >> "key.pem"
- chmod 600 key.pem
- scp -i key.pem -o StrictHostKeyChecking=no docker-config/docker-compose.yml blockchain@$BORROWER_A_DEV_IP:syne-corda/obligation-cordapp-template/
- ssh -T -i key.pem -o StrictHostKeyChecking=no dhyanraj@$BORROWER_A_DEV_IP <<EOF
- cd syne-corda/obligation-cordapp-template
- docker-compose up -d
tags:
- dev
only:
- dev
##------------ End DEV Environment ------------##