forked from hipay/hipay-fullservice-sdk-magento2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
234 lines (216 loc) · 7.27 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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
image: $REGISTRY_CI/gitlab-ci-base:buster
variables:
DOCKER_HOST: tcp://localhost:2375/
DOCKER_DRIVER: overlay2
GIT_DEPTH: 10
RELEASE_NAME: ${DOCKER_STACK}-${DOCKER_SERVICE}-${CI_COMMIT_REF_SLUG}
stages:
- quality
- build-test
- test
- build
- deploy
#########################
#### TEMPLATE ####
########################
.test_template: &test_definition
allow_failure: false
variables:
MYSQL_ROOT_PASSWORD: magento2
MYSQL_USER: magento2
MYSQL_PASSWORD: magento2
GITHUB_API_TOKEN: $GITHUB_TOKEN
MAGE_ACCOUNT_PUBLIC_KEY: $MAGE_ACCOUNT_PUBLIC_KEY
MAGE_ACCOUNT_PRIVATE_KEY: $MAGE_ACCOUNT_PRIVATE_KEY
GITLAB_API_TOKEN: $GITLAB_API_TOKEN
CUSTOM_REPOSITORIES: vcs https://gitlab.hipay.org/pi-ecommerce/hipay-fullservice-sdk-magento2.git,vcs [email protected]:hipay/hipay-fullservice-sdk-php.git
CUSTOM_PACKAGES: hipay/hipay-fullservice-sdk-magento2:dev-$CI_COMMIT_REF_NAME
CUSTOM_MODULES: HiPay_FullserviceMagento
ENVIRONMENT: stage
HIPAY_API_USER_TEST: $HIPAY_API_USER_TEST
HIPAY_API_PASSWORD_TEST: $HIPAY_API_PASSWORD_TEST
HIPAY_SECRET_PASSPHRASE_TEST: $HIPAY_SECRET_PASSPHRASE_TEST
HIPAY_TOKENJS_USERNAME_TEST: $HIPAY_TOKENJS_USERNAME_TEST
HIPAY_TOKENJS_PUBLICKEY_TEST: $HIPAY_TOKENJS_PUBLICKEY_TEST
HIPAY_APPLEPAY_USERNAME_TEST: $HIPAY_APPLEPAY_USERNAME_TEST
HIPAY_APPLEPAY_PASSWORD_TEST: $HIPAY_APPLEPAY_PASSWORD_TEST
HIPAY_APPLEPAY_SECRET_PASSPHRASE_TEST: $HIPAY_APPLEPAY_SECRET_PASSPHRASE_TEST
HIPAY_APPLEPAY_TOKENJS_USERNAME_TEST: $HIPAY_APPLEPAY_TOKENJS_USERNAME_TEST
HIPAY_APPLEPAY_TOKENJS_PUBLICKEY_TEST: $HIPAY_APPLEPAY_TOKENJS_PUBLICKEY_TEST
SMTP_LINK: common-smtp:1025
ACTIVE_METHODS: $ACTIVE_METHODS
XDEBUG_ENABLED: 0
PI_DATA_URL: $PI_CI_DATA_URL
MAGE_INSTALL_SAMPLE_DATA: --use-sample-data
MAGE_ADMIN_FIRSTNAME: John
MAGE_ADMIN_LASTNAME: Doe
MAGE_ADMIN_EMAIL: [email protected]
MAGE_ADMIN_USER: admin
MAGE_ADMIN_PWD: admin123
MAGE_BASE_URL: http://127.0.0.1:8096/
MAGE_BASE_URL_SECURE: https://127.0.0.1:8096/
MAGE_BACKEND_FRONTNAME: admin
MAGE_DB_HOST: database
MAGE_DB_PORT: 3306
MAGE_DB_NAME: magento2
MAGE_DB_USER: magento2
MAGE_DB_PASSWORD: magento2
MAGE_DB_PREFIX: mage_
MAGE_LANGUAGE: en_US
MAGE_CURRENCY: EUR
MAGE_TIMEZONE: Europe/Paris
MAGE_USE_REWRITES: 1
MAGE_USE_SECURE: 0
MAGE_USE_SECURE_ADMIN: 0
MAGE_ADMIN_USE_SECURITY_KEY: 0
MAGE_SESSION_SAVE: files
MAGE_KEY: 69c60a47f9dca004e47bf8783f4b9408
MAGE_DB_INIT_STATEMENTS: SET NAMES utf8;
MAGE_SALES_ORDER_INCREMENT_PREFIX: 0
MAGE_RUN_REINDEX: 0
MAGE_RUN_CACHE_CLEAN: 0
MAGE_RUN_CACHE_FLUSH: 0
MAGE_RUN_CACHE_DISABLE: 0
MAGE_RUN_STATIC_CONTENT_DEPLOY: 0
MAGE_RUN_SETUP_DI_COMPILE: 0
MAGE_RUN_DEPLOY_MODE: production
services:
- name: $REGISTRY_CI/test-jobs-${DOCKER_STACK}-${DOCKER_SERVICE}_web:${CI_COMMIT_REF_SLUG}
alias: web
- name: mysql:5.7
alias: database
artifacts:
paths:
- bin/tests/errors
when: always
tags:
- small
except:
variables:
- $ONLY_DEPLOY
- $CI_COMMIT_MESSAGE =~ /skip-tests/
.login_to_registry: &login-to-registry
before_script:
- 'mkdir /tmp'
- 'touch /tmp/credentials.json'
- 'echo ${SA_REGISTRY_CD} > /tmp/credentials.json'
- 'export GOOGLE_APPLICATION_CREDENTIALS=/tmp/credentials.json'
.login_to_cd: &login-to-cd
before_script:
# Connect GCP with deploy service account
- mkdir -p /tmp
- touch /tmp/credentials.json
- echo ${SA_DEPLOY_CD} > /tmp/credentials.json
- gcloud auth activate-service-account "${SA_DEPLOY_NAME}" --key-file="/tmp/credentials.json"
- gcloud config set project "${GCP_CD_PROJECT_ID}"
- gcloud config set compute/zone "${GCP_CD_CLUSTER_REGION}"
- gcloud container clusters get-credentials "${GCP_CD_CLUSTER_NAME}"
#########################
#### JOBS ####
########################
code-quality:
stage: quality
script:
- cd ci-tools/phpcs
- composer install
- ./vendor/bin/phpcs --standard=ruleset.xml
tags:
- small
build-test-2-1-10:
stage: build-test
image:
name: gcr.io/kaniko-project/executor:v1.6.0-debug
script:
- /kaniko/executor
--cache=true
--context "dir://${CI_PROJECT_DIR}"
--dockerfile "./bin/docker/images/default/Dockerfile"
--destination "$REGISTRY_CI/test-jobs-${DOCKER_STACK}-${DOCKER_SERVICE}_web:${CI_COMMIT_REF_SLUG}"
except:
variables:
- $ONLY_DEPLOY
tags:
- small
casperjs-2-1-10:
<<: *test_definition
stage: test
script:
- curl --retry 20 --retry-delay 10 --retry-connrefused --output /dev/null http://web
- sh bin/tests/casper_run_circle.sh http://web:8096
except:
variables:
- $ONLY_DEPLOY
tags:
- medium
build:
<<: *login-to-registry
stage: build
image:
name: gcr.io/kaniko-project/executor:v1.6.0-debug
rules:
- if: $ONLY_DEPLOY
when: on_success
- when: manual
script:
- /kaniko/executor
--cache=true
--context "dir://${CI_PROJECT_DIR}"
--dockerfile "./bin/docker/images/default/Dockerfile"
--destination "${REGISTRY_CD}/${DOCKER_STACK}-${DOCKER_SERVICE}-web:${CI_COMMIT_REF_SLUG}"
tags:
- small
deploy2recette:
<<: *login-to-cd
stage: deploy
image: $REGISTRY_CI/gitlab-ci-base:deployment
rules:
- if: $ONLY_DEPLOY
when: on_success
- when: manual
variables:
GPC_ACCOUNT: ''
script:
- echo $RELEASE_NAME
- >
helm install $RELEASE_NAME ./bin/docker/kubernetes/helm/
--namespace default
--set magento2_image="${REGISTRY_CD}/${DOCKER_STACK}-${DOCKER_SERVICE}-web"
--set magento2_tag="${CI_COMMIT_REF_SLUG}"
--set magento2_url="${DOCKER_STACK}-${DOCKER_SERVICE}-${CI_COMMIT_REF_SLUG}.${URL_CD}"
--set github_api_token="${GITHUB_TOKEN}"
--set gitlab_api_token="${GITLAB_API_TOKEN}"
--set mage_account_public_key="${MAGE_ACCOUNT_PUBLIC_KEY}"
--set mage_account_private_key="${MAGE_ACCOUNT_PRIVATE_KEY}"
--set hipay_api_user_test="$HIPAY_API_USER_RE7"
--set hipay_api_password_test="$HIPAY_API_PASSWORD_RE7"
--set hipay_secret_passphrase_test="$HIPAY_SECRET_PASSPHRASE_RE7"
--set hipay_tokenjs_username_test="$HIPAY_TOKENJS_USERNAME_RE7"
--set hipay_tokenjs_publickey_test="$HIPAY_TOKENJS_PUBLICKEY_RE7"
--set hipay_applepay_username_test="$HIPAY_APPLEPAY_USERNAME_RE7"
--set hipay_applepay_password_test="$HIPAY_APPLEPAY_PASSWORD_RE7"
--set hipay_applepay_secret_passphrase_test="$HIPAY_APPLEPAY_SECRET_PASSPHRASE_RE7"
--set hipay_applepay_tokenjs_username_test="$HIPAY_APPLEPAY_TOKENJS_USERNAME_RE7"
--set hipay_applepay_tokenjs_publickey_test="$HIPAY_APPLEPAY_TOKENJS_PUBLICKEY_RE7"
--set pi_data_url="$PI_CI_DATA_URL"
--set branch="$CI_COMMIT_REF_NAME"
allow_failure: true
environment:
name: review/${CI_COMMIT_REF_SLUG}
url: https://${DOCKER_STACK}-${DOCKER_SERVICE}-${CI_COMMIT_REF_SLUG}.${URL_CD}
on_stop: stop_review
tags:
- small
stop_review:
<<: *login-to-cd
stage: deploy
image: $REGISTRY_CI/gitlab-ci-base:deployment
variables:
GIT_STRATEGY: none
script:
- helm uninstall $RELEASE_NAME --namespace=default
when: manual
environment:
name: review/${CI_COMMIT_REF_SLUG}
action: stop
tags:
- small