-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
62 lines (58 loc) · 1.68 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
image: clojure:latest
stages:
- test
- deploy_staging
- deploy_production
test:
stage: test
services:
- postgres:12.2-alpine
variables:
POSTGRES_DB: $DB_TEST
POSTGRES_USER: $DB_TEST_USER
POSTGRES_PASSWORD: "$DB_TEST_PASSWORD"
POSTGRES_HOST_AUTH_METHOD: trust
before_script:
- PATH=$PATH:.
- cp resources/database.sample.edn resources/database.edn
- cp resources/database.sample.edn resources/database_test.edn
- cp resources/secrets.sample.edn resources/secrets.edn
- lein deps
- mkdir /root/uploads
script:
- lein test
deploy_staging:
stage: deploy_staging
variables:
ENV: "staging"
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 -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
script:
- scp scripts/setup_receive.sh root@"$SSH_IP":~/
- ssh root@"$SSH_IP" "chmod +x ~/setup_receive.sh && ~/setup_receive.sh ${ENV}"
only:
- master
deploy_production:
stage: deploy_production
variables:
ENV: "production"
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 -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
script:
- scp scripts/setup_receive.sh root@"$SSH_IP":~/
- ssh root@"$SSH_IP" "chmod +x ~/setup_receive.sh && ~/setup_receive.sh ${ENV}"
only:
- master
when: manual