-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
58 lines (53 loc) · 1.41 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: op-gitlab.howest.be:4567/docker-registry/project:2020.project-I
stages:
- build
- qa
- deploy
before_script:
- chmod +x gradlew
- ln -s "$MAVEN_LOCAL" ".m2"
build-jar:
stage: build
only:
- master
except:
changes:
- documents/**/*
script:
- ./gradlew shadowJar
artifacts:
paths:
- build/libs/
sonarqube:
variables:
openApi3Spec: alhambra-spec.yaml
stage: qa
except:
changes:
- documents/**/*
script: ./gradlew sonarqube
deploy:
image: debian:latest
before_script:
- echo "we don't need gradle or maven anymore"
stage: deploy
only:
- master
except:
changes:
- documents/**/*
script:
- apt update -y && apt install -y software-properties-common rename
- cd build/libs/
- rename 's/.*\.jar$/alhambra.jar/' *.jar
- 'which ssh-agent || apt install -y openssh-client cowsay'
- PATH="$PATH:/usr/games"
- 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.201 >> ~/.ssh/known_hosts
- scp -q alhambra.jar [email protected]:"/opt/group-${CI_PROJECT_NAMESPACE:(-2)}/alhambra.jar"
- ssh [email protected] sudo systemctl restart group-${CI_PROJECT_NAMESPACE:(-2)}
- systemctl -H [email protected] status group-${CI_PROJECT_NAMESPACE:(-2)}
environment: production