-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
82 lines (76 loc) · 2.11 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
# Our stages
stages:
- build_composer
- build_assets
- create_pack
- deploy
variables:
KUBECONFIG: /etc/k8s-config
build_composer:
stage: build_composer
only:
- /master/
tags:
- docker
image: composer:2.1.5
script:
- composer build --working-dir=./plugins/plenamata-plugin/
cache:
key: $CI_COMMIT_REF_SLUG
paths:
- plugins/plenamata-plugin/vendor/
- plugins/plenamata-plugin/vendor_prefixed/
build_assets:
stage: build_assets
only:
- /master/
tags:
- docker
image: node:12
cache:
key: $CI_COMMIT_REF_SLUG
paths:
- plugins/plenamata-plugin/vendor/
- plugins/plenamata-plugin/vendor_prefixed/
- plugins/plenamata-plugin/assets/build
script:
- npm --prefix plugins/plenamata-plugin/ install
- npm --prefix plugins/plenamata-plugin/ run build
- rm -rf plugins/plenamata-plugin/node_modules
create_pack:
stage: create_pack
only:
- /master/
tags:
- docker
image: alpine:3.14
cache:
key: $CI_COMMIT_REF_SLUG
paths:
- plugins/plenamata-plugin/vendor/
- plugins/plenamata-plugin/vendor_prefixed/
- plugins/plenamata-plugin/assets/build
script:
- cp -ra plugins/plenamata-plugin plenamata-plugin
artifacts:
paths:
- plenamata-plugin/*
name: plenamata-plugin
expire_in: 1 week
deploy:
stage: deploy
image: hacklab/kubectl:latest
cache:
key: $CI_COMMIT_REF_SLUG
paths:
- plugins/plenamata-plugin/vendor/
- plugins/plenamata-plugin/vendor_prefixed/
- plugins/plenamata-plugin/assets/build
script:
- echo ${kubeconfig} | base64 -d > ${KUBECONFIG}
- kubectl cp "plugins/plenamata-plugin" plenamata-site-dev/$(kubectl get pods -n plenamata-site-dev | grep wordpress | cut -d ' ' -f 1):"/var/www/html/wp-content/plugins/"
- kubectl exec -n plenamata-site-dev -it $(kubectl get pods -n plenamata-site-dev | grep wordpress | cut -d ' ' -f 1) -- sh -c "chown -R www-data /var/www/html/wp-content/plugins/plenamata-plugin && chgrp -R www-data /var/www/html/wp-content/plugins/plenamata-plugin"
only:
- /master/
tags:
- docker