-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
110 lines (100 loc) · 2.14 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
stages:
- build
- lint
# - test
- staging
- ready to production
- production
build:
stage: build
tags: [gitlab-org]
before_script:
- echo "Building static web page..."
# - mkdir -p /usr/src/app
# - cp -r ./ /usr/src/app/
- cd best-choice
- apt-get update -y
- apt-get install npm -y
script:
- npm install
- npm run build
after_script:
- cd -
- echo "Build done"
lint back:
stage: lint
tags: [gitlab-org]
before_script:
- echo "Linting..."
- cd best-choice-backend
- apt-get update -y
- apt-get install npm -y
after_script:
- cd -
- echo "Linting done"
script:
- npm install eslint -g
- eslint app/ index.js
lint front:
stage: lint
tags: [gitlab-org]
before_script:
- echo "Linting..."
- cd best-choice
- apt-get update -y
- apt-get install npm -y
after_script:
- cd -
- echo "Linting done"
script:
- npm install
- npm install eslint -g
- eslint src/
.test front:
stage: test
tags: [gitlab-org]
before_script:
- echo "Testing..."
- cd best-choice
- apt-get update -y
- apt-get install npm -y
after_script:
- cd -
- echo "Testing done"
script:
- npm run test
.staging-deploy-hidden: &staging-deploy-anchor
stage: staging
tags: [gitlab-org]
when: manual
before_script:
- echo "Starting staging deploy"
script:
- echo $CI_BUILD_NAME
after_script:
- echo "Staging deploy completed"
deploy to stg1:
<<: *staging-deploy-anchor
deploy to stg2:
<<: *staging-deploy-anchor
approve:
stage: ready to production
tags: [gitlab-org]
when: manual
script:
- mkdir -p .ci_status
- echo $(date +%s) > .ci_status/approved
NOT approve:
stage: ready to production
tags: [gitlab-org]
when: manual
script:
- mkdir -p .ci_status
- echo $(date +%s) > .ci_status/not_approved
deploy to production:
stage: production
tags: [gitlab-org]
when: manual
script:
- if [[ $(cat .ci_status/not_approved) > $(cat .ci_status/approved) ]]; then echo "Нужно разрешение от релиз-инженера"; exit 1; fi
- echo "Deployed to prod"