-
Notifications
You must be signed in to change notification settings - Fork 22
/
.gitlab-ci.yml
94 lines (90 loc) · 3.42 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
stages:
- build
- deploy
build_qa:
image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest
services:
- docker:dind
tags:
- meedan
- meedan-labs
stage: build
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
script:
- aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $ECR_API_BASE_URL
- docker build --build-arg DEPLOY_BRANCH=develop --build-arg TIMESTAMP=$(date '+%Y%m%d%H%M%S') -f production/Dockerfile -t "$ECR_API_BASE_URL/qa/check/web:$CI_COMMIT_SHA" . 2>&1 | tee .docker_build_out
- if grep "ERROR in" .docker_build_out; then
echo "Docker build error detected!";
exit 1;
fi
- docker push "$ECR_API_BASE_URL/qa/check/web:$CI_COMMIT_SHA"
only:
- develop
deploy_qa:
image: python:3-alpine
stage: deploy
tags:
- meedan
- meedan-labs
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
script:
- apk add --no-cache curl jq python3 py3-pip git
- pip install setuptools==75.1.0
- pip install urllib3==2.0.6
- pip install botocore==1.31.62
- pip install boto3==1.28.62
- pip install ecs-deploy==1.15.0
- ecs deploy ecs-qa qa-check-web --image qa-check-web-c $ECR_API_BASE_URL/qa/check/web:$CI_COMMIT_SHA -r arn:aws:iam::848416313321:role/ECSSecretsAccessRole --exclusive-secrets --exclusive-env -e qa-check-web-c APP check-web -e qa-check-web-c DEPLOY_ENV qa --timeout 3600
- echo "new Image was deployed $ECR_API_BASE_URL/qa/check/web:$CI_COMMIT_SHA"
- sh scripts/clear-cf-cache.sh
only:
- develop
build_live:
image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest
services:
- docker:dind
tags:
- meedan
- meedan-labs
stage: build
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
script:
- aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $ECR_API_BASE_URL
- docker build --build-arg DEPLOY_BRANCH=master --build-arg TIMESTAMP=$(date '+%Y%m%d%H%M%S') -f production/Dockerfile -t "$ECR_API_BASE_URL/live/check/web:$CI_COMMIT_SHA" . 2>&1 | tee .docker_build_out
- if grep "ERROR in" .docker_build_out; then
echo "Docker build error detected!";
exit 1;
fi
- docker push "$ECR_API_BASE_URL/live/check/web:$CI_COMMIT_SHA"
only:
- master
deploy_live:
image: python:3-alpine
stage: deploy
when: manual
tags:
- meedan
- meedan-labs
variables:
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION
script:
- apk add --no-cache curl jq python3 py3-pip git
- pip install setuptools==75.1.0
- pip install urllib3==2.0.6
- pip install botocore==1.31.62
- pip install boto3==1.28.62
- pip install ecs-deploy==1.15.0
- ecs deploy ecs-live live-check-web --image live-check-web-c $ECR_API_BASE_URL/live/check/web:$CI_COMMIT_SHA -r arn:aws:iam::848416313321:role/ECSSecretsAccessRole --exclusive-secrets --exclusive-env -e live-check-web-c APP check-web -e live-check-web-c DEPLOY_ENV live --timeout 3600
- echo "new Image was deployed $ECR_API_BASE_URL/live/check/web:$CI_COMMIT_SHA"
- sh scripts/clear-cf-cache.sh
only:
- master