-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
72 lines (65 loc) · 2.91 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
stages:
- deploy
- review
variables:
APP_NAME: weather-tool
deploy:
image: ilyasemenov/gitlab-ci-git-push
stage: deploy
environment:
name: production
url: http://ebc-weather.ebc-team-nk.osc.eonerc.rwth-aachen.de/
only:
- master
script:
- mkdir -p ~/.ssh && echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
- ssh-keyscan -H 22 ebc-weather.ebc-team-nk.osc.eonerc.rwth-aachen.de >> ~/.ssh/known_hosts
- ssh -t [email protected] -- config:set "$APP_NAME" THE_USER="$THE_USER" THE_PASSWORD="$THE_PASSWORD"
- ssh -t [email protected] -- nginx:set "$APP_NAME" proxy-read-timeout 300s
- git-push ssh://[email protected]:22/$APP_NAME
review_app:
image: ilyasemenov/gitlab-ci-git-push
stage: review
environment:
name: review/$CI_COMMIT_REF_NAME
url: http://$CI_ENVIRONMENT_SLUG.ebc-weather.ebc-team-nk.osc.eonerc.rwth-aachen.de/
on_stop: stop_review_app
only:
- branches
except:
- master
script:
- mkdir -p ~/.ssh && echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
- ssh-keyscan -H -p 22 ebc-weather.ebc-team-nk.osc.eonerc.rwth-aachen.de >> ~/.ssh/known_hosts
- ssh -t [email protected] -- apps:clone --ignore-existing --skip-deploy "$APP_NAME" "$CI_ENVIRONMENT_SLUG"
- ssh -t [email protected] -- config:set "$CI_ENVIRONMENT_SLUG" CI_SLUG="$CI_ENVIRONMENT_SLUG" THE_USER="$THE_USER" THE_PASSWORD="$THE_PASSWORD"
- ssh -t [email protected] -- nginx:set "$CI_ENVIRONMENT_SLUG" proxy-read-timeout 300s
- git-push ssh://[email protected]:22/$CI_ENVIRONMENT_SLUG
stop_review_app:
image: ilyasemenov/gitlab-ci-git-push
stage: review
variables:
GIT_STRATEGY: none
environment:
name: review/$CI_COMMIT_REF_NAME
action: stop
when: manual
script:
- mkdir -p ~/.ssh && echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
- ssh-keyscan -H -p 22 ebc-weather.ebc-team-nk.osc.eonerc.rwth-aachen.de >> ~/.ssh/known_hosts
- ssh -t [email protected] -- --force apps:destroy "$CI_ENVIRONMENT_SLUG"
force_rebuild_production:
image: ilyasemenov/gitlab-ci-git-push
stage: deploy
variables:
GIT_STRATEGY: none
environment:
name: production
url: http://ebc-weather.ebc-team-nk.osc.eonerc.rwth-aachen.de
only:
- master
when: manual
script:
- mkdir -p ~/.ssh && echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
- ssh-keyscan -H 22 ebc-weather.ebc-team-nk.osc.eonerc.rwth-aachen.de >> ~/.ssh/known_hosts
- ssh -t [email protected] -- ps:rebuild $APP_NAME