-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
123 lines (117 loc) · 3.76 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
image: ruby:2.3
variables:
GIT_SSL_NO_VERIFY: "true"
POSTGRES_DB: test_db
POSTGRES_USER: runner
POSTGRES_PASSWORD: ""
POSTGRES_HOST_AUTH_METHOD: trust
before_script:
- export http_proxy="http://proxy.justice.cz:3128/"
- export https_proxy="http://proxy.justice.cz:3128/"
- export no_proxy="git.servis.justice.cz"
- export PATH="$PATH:$GEM_HOME/bin"
stages:
- test
- deploy
test:2.3:
before_script:
- export http_proxy=http://proxy.justice.cz:3128
- export https_proxy=http://proxy.justice.cz:3128
- export no_proxy="git.servis.justice.cz"
- export LANG=en_US.UTF-8
- export LANGUAGE=en_US.UTF-8
- export LC_ALL=en_US.UTF-8
- export RUBYOPT="-KU -E utf-8:utf-8"
- export BUNDLE_GEMFILE="Gemfile_devel"
- git config --global http.sslVerify false
cache:
untracked: true
key: "$CI_BUILD_REF_NAME"
paths:
- cache/bundler/
services:
- postgres
- redis
script:
- BASE_URL=`echo $CI_REPOSITORY_URL | sed "s;\/*$CI_PROJECT_PATH.*;;"`
- REPO_URL="$BASE_URL/libraries/egon_gate.git"
- REPO_DIR=libraries/egon_gate
- rm -fr $REPO_DIR
- git clone $REPO_URL $REPO_DIR
- "sed -i \"s|gem 'egon_gate', path: '.*'|gem 'egon_gate', path: '$REPO_DIR'|g\" Gemfile_devel"
- REPO_URL="$BASE_URL/libraries/azahara_schema.git"
- REPO_DIR=libraries/azahara_schema
- rm -fr $REPO_DIR
- git clone $REPO_URL $REPO_DIR
- "sed -i \"s|gem 'azahara_schema', path: '.*'|gem 'azahara_schema', path: '$REPO_DIR'|g\" Gemfile_devel"
- REPO_URL="$BASE_URL/libraries/egov_utils-rails.git"
- REPO_DIR=libraries/egov_utils
- rm -fr $REPO_DIR
- git clone $REPO_URL $REPO_DIR
- "sed -i \"s|gem 'egov_utils', path: '.*'|gem 'egov_utils', path: '$REPO_DIR'|g\" Gemfile_devel"
- RAILS_ENV=test bundle install --path=cache/bundler --without production development --jobs $(nproc) "${FLAGS[@]}"
- cp config/database.yml.gitlabci config/database.yml
- bundle exec rails db:migrate RAILS_ENV=test
- bundle exec rspec
deploy_lab:
stage: deploy
tags:
- deploy
- lab
script:
- 'which ssh-agent || ( apt-get update && apt-get install openssh-client )'
- eval $(ssh-agent -s)
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
- echo "$STAGING_USER_KEY" > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
- sed -n ':a;N;$!ba;s/\n/ /g' ~/.ssh/id_rsa
- ssh-add ~/.ssh/id_rsa
- gem install capistrano-rails
- gem install capistrano3-unicorn
- gem install capistrano-sidekiq
- cap lab deploy REVISION="$CI_COMMIT_SHA"
environment:
name: lab
allow_failure: true
only:
- master
deploy_staging:
stage: deploy
tags:
- deploy
- servis
script:
- 'which ssh-agent || ( apt-get update && apt-get install openssh-client )'
- eval $(ssh-agent -s)
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
- echo "$PRODUCTION_USER_KEY" > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
- sed -n ':a;N;$!ba;s/\n/ /g' ~/.ssh/id_rsa
- ssh-add ~/.ssh/id_rsa
- gem install capistrano-rails
- gem install capistrano3-unicorn
- gem install capistrano-sidekiq
- cap staging deploy REVISION="$CI_COMMIT_SHA"
environment:
name: staging
only:
- master
deploy_production:
stage: deploy
tags:
- deploy
- external
script:
- 'which ssh-agent || ( apt-get update && apt-get install openssh-client )'
- eval $(ssh-agent -s)
- mkdir -p ~/.ssh && chmod 700 ~/.ssh
- echo "$PRODUCTION_USER_KEY" > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
- sed -n ':a;N;$!ba;s/\n/ /g' ~/.ssh/id_rsa
- ssh-add ~/.ssh/id_rsa
- gem install capistrano-rails
- gem install capistrano3-unicorn
- gem install capistrano-sidekiq
- cap production deploy REVISION="$CI_COMMIT_SHA"
environment:
name: production
only:
- master
when: manual