-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
115 lines (95 loc) · 2.77 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
default:
tags:
- smatflow-projects-runner
stages:
- front-test
- deploy-site-smatflow-org
- deploy-3d-smatflow-org
- deploy-www-smatflow-org
- deploy-www-smatflow-academy
- deploy-www-smatflow-com
- deploy-www-civicflow-org
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
############## Front assets build test #####################
front-test:
image: node:20
stage: front-test
rules:
- if: $CI_COMMIT_TAG || ($CI_COMMIT_BRANCH == "main" && $CI_COMMIT_MESSAGE =~ /^Merge branch.*/)
- if: $CI_PIPELINE_SOURCE == "web"
before_script:
- npm install [email protected] --location=global
- pnpm config set store-dir .pnpm-store
script:
- pnpm install
- pnpm run build
cache:
- key:
files:
- pnpm-lock.yaml
paths:
- .pnpm-store
- node_modules
- key: front-turbo-cache
paths:
- .turbo/cache
# ############# Servers deployments #########################
.deploy:
image: python:3.10
needs: [front-test]
rules:
- if: $CI_COMMIT_TAG || ($CI_COMMIT_BRANCH == "main" && $CI_COMMIT_MESSAGE =~ /^Merge branch.*/)
- if: $CI_PIPELINE_SOURCE == "web"
cache:
key: pip-cache
paths:
- .cache/pip
before_script:
- export ANSIBLE_HOST_KEY_CHECKING=False
- bash cicd_vars.sh
- make ansible-install-cd
- eval $(ssh-agent -s)
- ssh-add <(echo "$ANSIBLE_DEPLOY_KEY")
script:
- export CMS_LDAP_ENABLED_VAR=$([ "$CMS_LDAP_ENABLED" = "true" ] && echo "True" || echo "False")
- export DOCS_ENABLED_VAR=$([ "$DOCS_ENABLED" = "true" ] && echo "True" || echo "False")
- export EXTRA_VARS="docs_enabled_var=$DOCS_ENABLED_VAR"
- export EXTRA_VARS="$EXTRA_VARS repository_url=$CI_REPOSITORY_URL domain_var=$SITE_DOMAIN cms_domain_var=$CMS_DOMAIN cms_ldap_auth_var=$CMS_LDAP_ENABLED_VAR"
- ansible-playbook --vault-password-file .vault_pass ansible/install.yml -u "$ANSIBLE_SERVER_USER" -i "$ANSIBLE_SERVER_HOST," --extra-vars "$EXTRA_VARS"
deploy-site-smatflow-org:
extends: .deploy
stage: deploy-site-smatflow-org
environment:
name: site-smatflow-org
when: manual
deploy-www-smatflow-org:
extends: .deploy
stage: deploy-www-smatflow-org
environment:
name: www-smatflow-org
when: manual
deploy-3d-smatflow-org:
extends: .deploy
stage: deploy-3d-smatflow-org
environment:
name: 3d-smatflow-org
when: manual
deploy-www-civicflow-org:
extends: .deploy
stage: deploy-www-civicflow-org
environment:
name: www-civicflow-org
when: manual
deploy-www-smatflow-academy:
extends: .deploy
stage: deploy-www-smatflow-academy
environment:
name: www-smatflow-academy
when: manual
deploy-www-smatflow-com:
extends: .deploy
stage: deploy-www-smatflow-com
environment:
name: www-smatflow-com
when: manual