-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.gitlab-ci.yml
93 lines (80 loc) · 1.61 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
image: $CI_REGISTRY_IMAGE/builder:latest
services:
- docker:dind
stages:
- build
- test
- review
- staging
- production
variables:
TEST_DB: ngao
DOCKER_DRIVER: overlay
REGISTRY_HOST: registry.gitlab.com
REGISTRY_URI: TODO/ngao
SITE_URI_BASE: TODO
before_script:
- export REGISTRY_FULL=registry.gitlab.com/notch8/ror-site/$CI_COMMIT_REF_SLUG:${CI_COMMIT_SHA:0:8}
- export TAG=$CI_COMMIT_REF_SLUG
- eval $(ssh-agent -s)
- bash
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
build:
stage: build
script:
- docker login -u "gitlab-ci-token" -p "$CI_BUILD_TOKEN" $CI_REGISTRY
- sc build
- sc push
tags:
- docker
test:
stage: test
image: $CI_REGISTRY_IMAGE:$CI_PROJECT_NAME-$CI_BUILD_REF_SLUG
script:
- cd /home/app/webapp && bundle exec rake db:create db:schema:load spec
tags:
- docker
variables:
GIT_STRATEGY: none
review:
stage: review
type: deploy
environment:
name: $CI_PROJECT_NAME-$CI_COMMIT_REF_SLUG
url: http://web.$CI_PROJECT_NAME-$CI_COMMIT_REF_SLUG.staging.$SITE_URI_BASE
on_stop: stop_review
only:
- branches
except:
- main
script:
- CHANGME
tags:
- docker
- mysql
stop_review:
stage: review
script:
when: manual
environment:
name: $CI_PROJECT_NAME-$CI_BUILD_REF_SLUG
action: stop
staging:
stage: staging
type: deploy
script:
only:
- main
tags:
- docker
production:
stage: production
type: deploy
script:
when: manual
only:
- main
tags:
- docker