forked from DataBiosphere/data-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.cgl-prod-env.yml
127 lines (114 loc) · 2.99 KB
/
.gitlab-ci.cgl-prod-env.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
stages:
- test
- build
- deploy
# Build Jobs
# Build Job Template
.build_template: &build_template
image: clevercanary/ng-cli-karma-python3:13.2.5
stage: build
before_script:
- npm -v
- node -v
- cd spa
- npm install
- cd ..
- cd scripts
- npm install
- cd ..
artifacts:
paths:
- dist
- maintenance
# Test with Trufflehog
test_trufflehog:
stage: test
image: python:3.5
before_script:
- pip install trufflehog
script:
- trufflehog --regex --rules trufflehog-rules.json --branch prod --max_depth 30 --entropy=False https://github.com/HumanCellAtlas/data-browser.git
only:
- prod
# Test with karma
test_karma:
image: clevercanary/ng-cli-karma-python3:13.2.5
stage: test
script:
- cd spa
- npm install
- ng test --watch=false
only:
- prod
- lungmap-prod
# Prod Build
build_prod:
<<: *build_template
environment:
name: prod
script:
- export GTM_ID=GTM-M2J5NTJ
- export GTM_AUTH=xm3qglWPEFim7Lb4AxXnsA
- export GTM_ENV=env-2
- pwd
- ./insert-gtm-snippet.sh
- cd spa
- npm run build-cgl-dcp2
- cd ..
- cd scripts
- npm run update-sitemap -- catalog=dcp32
only:
- prod
# Prod Build
build_lungmap-prod:
<<: *build_template
environment:
name: lungmap-prod
script:
- export GTM_ID=GTM-M2J5NTJ
- export GTM_AUTH=WB1d2Aoi1q3GOmQMSGMsZA
- export GTM_ENV=env-150
- pwd
- ./insert-gtm-snippet.sh
- cd spa
- npm run build-lungmap-prod
- cd ..
- cd scripts
- npm run update-sitemap -- catalog=lm3
only:
- lungmap-prod
########################################
# Deploy Jobs
########################################
# Deploy Job Template
.deploy_template: &deploy_template
stage: deploy
image: python:3.5
before_script:
- pip install awscli
# Prod Deploy
deploy_prod:
<<: *deploy_template
environment:
name: prod
script:
- export BUCKET=s3://org-humancellatlas-data-browser-dcp2-prod
- if [ "$MAINTENANCE" = "true" ];then export SRCDIR=maintenance/; else export SRCDIR=dist/; fi
- aws s3 sync $SRCDIR $BUCKET --delete
- aws s3 cp $BUCKET/explore/index.html $BUCKET/explore/index.html --metadata-directive REPLACE --cache-control max-age=0,no-cache,no-store,must-revalidate --content-type text/html
- aws cloudfront create-invalidation --distribution-id E1LYQC3LZXO7M3 --paths "/*"
only:
- prod
# Prod Deploy
deploy_lungmap-prod:
<<: *deploy_template
environment:
name: prod
script:
- export BUCKET=s3://data-browser.explore.lungmap.net
- if [ "$MAINTENANCE" = "true" ];then export SRCDIR=maintenance/; else export SRCDIR=dist/; fi
- aws s3 sync $SRCDIR $BUCKET --delete
- aws s3 cp $BUCKET/explore/index.html $BUCKET/explore/index.html --metadata-directive REPLACE --cache-control max-age=0,no-cache,no-store,must-revalidate --content-type text/html
- aws cloudfront create-invalidation --distribution-id E22L661MUAMMTD --paths "/*"
only:
- lungmap-prod