-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
54 lines (47 loc) · 1.57 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
image: docker:latest
stages:
- deploy
- updateService
variables:
REMOTE_REGISTRY: 782753663516.dkr.ecr.ap-southeast-1.amazonaws.com/tdcdrupal
CURRENT_VERSION: latest
ECS_CLUSTER: drupalcluster
ECS_SERVICE: bnr-service
ECS_TASK_DEF: bnr-portal-drupal-task
deployLatest:
stage: deploy
tags:
- redhat-atomic
script:
- export AWS_ACCESS_KEY_ID=${DEV_AWS_ACCESS_KEY_ID}
- export AWS_DEFAULT_REGION=${DEV_AWS_DEFAULT_REGION}
- export AWS_SECRET_ACCESS_KEY=${DEV_AWS_SECRET_ACCESS_KEY}
- docker build -t ${CI_REGISTRY_IMAGE}:$CURRENT_VERSION .
- docker tag ${CI_REGISTRY_IMAGE}:$CURRENT_VERSION $REMOTE_REGISTRY:$CURRENT_VERSION
- eval $(eval 'aws ecr get-login')
- docker push $REMOTE_REGISTRY
deployTagged:
stage: deploy
tags:
- redhat-atomic
script:
- docker tag ${CI_REGISTRY_IMAGE}:$CURRENT_VERSION $REMOTE_REGISTRY:${CI_BUILD_TAG}
- eval $(eval 'aws ecr get-login')
- docker push $REMOTE_REGISTRY
only:
- tags
updateService:
stage: updateService
tags:
- redhat-atomic
script:
- export AWS_ACCESS_KEY_ID=${DEV_AWS_ACCESS_KEY_ID}
- export AWS_DEFAULT_REGION=${DEV_AWS_DEFAULT_REGION}
- export AWS_SECRET_ACCESS_KEY=${DEV_AWS_SECRET_ACCESS_KEY}
- eval $(eval 'aws ecr get-login')
- aws ecs register-task-definition --cli-input-json file://${ECS_TASK_DEF}.json
- aws ecs update-service --cluster $ECS_CLUSTER --service $ECS_SERVICE --task-definition $ECS_TASK_DEF
environment:
name: uat
url: http://ec2-52-221-253-210.ap-southeast-1.compute.amazonaws.com
# when: manual