-
Notifications
You must be signed in to change notification settings - Fork 8
/
.gitlab-ci.yml
191 lines (179 loc) · 5.94 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
stages:
- test
- build
- deploy
.curl-tpl: &curl-tpl
variables:
GIT_STRATEGY: none
tags:
- curl
before_script:
- apk add --no-cache curl jq
.build-pkg-tpl: &build-pkg-tpl
<<: *curl-tpl
only:
- master@linagora/lgs/openpaas/esn-sabre
except:
variables:
- $SKIP_BUILD_PKG
test:
image: linagora/php-deps-composer:7.0.31
stage: test
tags:
- docker
services:
- name: mongo:3.2
alias: mongodb
script:
- composer up
- ./vendor/bin/phpcs -p --standard=vendor/sabre/dav/tests/phpcs/ruleset.xml lib/
- cd tests
- ../vendor/bin/phpunit --coverage-clover=${CI_PROJECT_DIR}/clover.xml --log-junit=${CI_PROJECT_DIR}/junit.xml .
except:
variables:
- $SKIP_TESTS
.build_pkg_deb_jessie:
<<: *build-pkg-tpl
stage: build
script:
- curl -s -X POST
-F "token=${BUILD_PACKAGE_CI_TOKEN}"
-F "ref=master"
-F "variables[REPO]=https://ci.linagora.com/linagora/lgs/openpaas/esn-sabre.git"
-F "variables[VERSION_FILE]=composer.json"
-F "variables[PACKAGE_NAME]=openpaas-davserver"
-F "variables[DOCKERFILE]=debian/jessie/Dockerfile"
https://ci.linagora.com/api/v4/projects/338/trigger/pipeline | jq .
.build_pkg_deb_stretch:
<<: *build-pkg-tpl
stage: build
script:
- curl -s -X POST
-F "token=${BUILD_PACKAGE_CI_TOKEN}"
-F "ref=master"
-F "variables[REPO]=https://ci.linagora.com/linagora/lgs/openpaas/esn-sabre.git"
-F "variables[VERSION_FILE]=composer.json"
-F "variables[PACKAGE_NAME]=openpaas-davserver"
-F "variables[DOCKERFILE]=debian/stretch/Dockerfile"
https://ci.linagora.com/api/v4/projects/338/trigger/pipeline | jq .
.build_pkg_rpm:
<<: *build-pkg-tpl
stage: build
script:
- curl -s -X POST
-F "token=${BUILD_PACKAGE_CI_TOKEN}"
-F "ref=master"
-F "variables[REPO]=https://ci.linagora.com/linagora/lgs/openpaas/esn-sabre.git"
-F "variables[VERSION_FILE]=composer.json"
-F "variables[PACKAGE_NAME]=openpaas-davserver"
-F "variables[DOCKERFILE]=redhat/7/Dockerfile"
https://ci.linagora.com/api/v4/projects/338/trigger/pipeline | jq .
deploy_dev:
stage: deploy
tags:
- dev.open-paas.org
- deployment
variables:
GIT_STRATEGY: none
environment:
name: dev
url: https://dev.open-paas.org
only:
- master@linagora/lgs/openpaas/esn-sabre
script:
- cd /srv/sabre.dev
- git fetch --all
- git checkout ${CI_COMMIT_SHA}
- composer up
except:
variables:
- $SKIP_DEPLOY
.build-docker-tpl: &build-docker-tpl
image: docker-registry.linagora.com:5000/linshare-snapshots/linshare-dind:latest
tags:
- docker
services:
- name: docker-registry.linagora.com:5000/linshare-snapshots/linshare-dind:latest
alias: docker-dind
docker-master:
<<: *build-docker-tpl
stage: build
variables:
DOCKER_HOST: "tcp://docker-dind"
DOCKER_IMAGE_PRIVATE: "docker-registry.linagora.com:5000/openpaas-snapshots/openpaas-esn-sabre"
DOCKER_IMAGE_PUBLIC: "linagora/esn-sabre"
script:
- guess-version.sh guess
- source version.env
- docker-tag-computing.sh ${VERSION} docker-tag-and-push.env
- docker login -u ${REGISTRY_USER} -p ${REGISTRY_TOKEN} docker-registry.linagora.com:5000
- docker build . -t build:latest
- docker-tag-and-push.sh build:latest ${DOCKER_IMAGE_PRIVATE}
- docker logout docker-registry.linagora.com:5000
- docker login -u ${HUB_DOCKER_USER} -p ${HUB_DOCKER_TOKEN}
- echo "export DOCKER_TAGS=branch-master" > docker-tag-and-push.env
- docker-tag-and-push.sh build:latest ${DOCKER_IMAGE_PUBLIC}
- docker logout
only:
- master@linagora/lgs/openpaas/esn-sabre
except:
variables:
- $SKIP_BUILD_DOCKER
docker-snapshot:
<<: *build-docker-tpl
stage: build
variables:
DOCKER_HOST: "tcp://docker-dind"
DOCKER_IMAGE_PRIVATE: "docker-registry.linagora.com:5000/openpaas-snapshots/openpaas-esn-sabre"
script:
- guess-version.sh guess
- source version.env
- docker-tag-computing.sh ${VERSION} docker-tag-and-push.env
- docker login -u ${REGISTRY_USER} -p ${REGISTRY_TOKEN} docker-registry.linagora.com:5000
- docker build . -t build:latest
- docker-tag-and-push.sh build:latest ${DOCKER_IMAGE_PRIVATE}
- docker logout
only:
- /^release-.*/@linagora/lgs/openpaas/esn-sabre
except:
variables:
- $SKIP_BUILD_DOCKER
docker-release:
<<: *build-docker-tpl
stage: build
variables:
DOCKER_HOST: "tcp://docker-dind"
DOCKER_IMAGE_PRIVATE: "docker-registry.linagora.com:5000/openpaas-releases/openpaas-esn-sabre"
DOCKER_IMAGE_PUBLIC: "linagora/esn-sabre"
script:
- docker-tag-computing.sh ${CI_COMMIT_TAG} docker-tag-and-push.env
- docker login -u ${REGISTRY_USER_RELEASE} -p ${REGISTRY_TOKEN_RELEASE} docker-registry.linagora.com:5000
- docker login -u ${HUB_DOCKER_USER} -p ${HUB_DOCKER_TOKEN}
- docker build . -t build:latest
- docker-tag-and-push.sh build:latest ${DOCKER_IMAGE_PRIVATE} ${DOCKER_IMAGE_PUBLIC}
- docker logout
only:
- tags@linagora/lgs/openpaas/esn-sabre
except:
variables:
- $SKIP_BUILD_DOCKER
docker-mark-as-latest-from-tag:
<<: *build-docker-tpl
stage: deploy
variables:
GIT_STRATEGY: none
DOCKER_HOST: "tcp://docker-dind"
DOCKER_IMAGE_PRIVATE: "docker-registry.linagora.com:5000/openpaas-releases/openpaas-esn-sabre"
DOCKER_IMAGE_PUBLIC: "linagora/esn-sabre"
script:
- docker login -u ${REGISTRY_USER_RELEASE} -p ${REGISTRY_TOKEN_RELEASE} docker-registry.linagora.com:5000
- docker login -u ${HUB_DOCKER_USER} -p ${HUB_DOCKER_TOKEN}
- docker-tag-computing.sh ${CI_COMMIT_TAG} docker-tags.env
- source docker-tags.env
- docker pull ${DOCKER_IMAGE_PRIVATE}:${DOCKER_TAG}
- export DOCKER_TAGS=latest
- docker-tag-and-push.sh ${DOCKER_IMAGE_PRIVATE}:${DOCKER_TAG} ${DOCKER_IMAGE_PRIVATE} ${DOCKER_IMAGE_PUBLIC}
- docker logout
when: manual
only:
- tags@linagora/lgs/openpaas/esn-sabre