-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
58 lines (53 loc) · 1.28 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
image: monitor:5000/gradle733:2
stages:
- build
- QA
- deploy
before_script:
- chmod +x gradlew
build-jar:
stage: build
only:
- main
except:
changes:
- documents/**/*
script:
- gradle shadowJar
artifacts:
paths:
- build/libs/
sonarqube:
stage: QA
except:
changes:
- documents/**/*
script:
- gradle test --info
- gradle sonarqube -Dsonar.host.url=http://172.18.18.129
artifacts:
when: always
reports:
junit: build/test-results/test/**/TEST-*.xml
deploy:
image: monitor:5000/deployproject:2
before_script:
- echo "we don't need gradle or maven anymore, nice!"
stage: deploy
only:
- main
except:
changes:
- documents/**/*
script:
- cd build/libs/
- rename 's/.*\.jar$/mars.jar/' *.jar
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan -H 172.18.18.200 >> ~/.ssh/known_hosts
- scp -q mars.jar [email protected]:"/opt/group-${CI_PROJECT_NAMESPACE:(-2)}/mars.jar"
- ssh [email protected] sudo systemctl restart group-${CI_PROJECT_NAMESPACE:(-2)}
- systemctl -H [email protected] status group-${CI_PROJECT_NAMESPACE:(-2)}
environment: production