-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathlocal-ci.sh
executable file
·48 lines (38 loc) · 1.45 KB
/
local-ci.sh
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
#!/bin/sh
###################################################################
# NOTE: Run CI/CD builds locally with command 'taito -r ci run:ENV'
###################################################################
BRANCH=$1 # e.g. dev, test, uat, stag, canary, or prod
IMAGE_TAG=$2 # e.g. commit SHA
set -e
export taito_mode=ci
export taito_ci_phases=
# Always build with local CI:
echo "export ci_exec_build=true" >> ./taito-config.sh
# Prepare build
taito build prepare:$BRANCH $IMAGE_TAG
# Prepare artifacts for deployment
# NOTE: Can be executed in parallel if no user input is required
taito artifact prepare:admin:$BRANCH $IMAGE_TAG
taito artifact prepare:client:$BRANCH $IMAGE_TAG
taito artifact prepare:server:$BRANCH $IMAGE_TAG
taito artifact prepare:worker:$BRANCH $IMAGE_TAG
taito artifact prepare:www:$BRANCH $IMAGE_TAG
# Deploy changes to target environment
taito db deploy:$BRANCH
taito deployment deploy:$BRANCH $IMAGE_TAG
# Test and verify deployment
taito deployment wait:$BRANCH
# TODO: enable local ci tests
# taito test:$BRANCH
taito deployment verify:$BRANCH
# Release artifacts
# NOTE: Can be executed in parallel if no user input is required
taito artifact release:admin:$BRANCH $IMAGE_TAG
taito artifact release:client:$BRANCH $IMAGE_TAG
taito artifact release:server:$BRANCH $IMAGE_TAG
taito artifact release:worker:$BRANCH $IMAGE_TAG
taito artifact release:www:$BRANCH $IMAGE_TAG
# Release build
taito build release:$BRANCH
# TODO: revert on fail