-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
44 lines (40 loc) · 1.6 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
variables:
REGISTRY: hub.datareadings.com:5000
IMAGE: "$REGISTRY/$CI_PROJECT_NAME:$CI_BUILD_REF_NAME"
stages:
- deploy
deploy:
stage: deploy
script:
- docker build -t $IMAGE .
- docker run --rm -e "AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID" -e "AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY" -e "AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION" $IMAGE ./actions.sh $CI_PROJECT_NAME $CI_BUILD_REF_NAME deploy
- docker push $IMAGE
environment:
name: $CI_BUILD_REF_NAME
url: http://$CI_PROJECT_NAME-$CI_BUILD_REF_NAME.datareadings.com.s3-website-us-east-1.amazonaws.com
only:
- master
deploy_review:
stage: deploy
script:
- docker build -t $IMAGE .
- docker run --rm -e "AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID" -e "AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY" -e "AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION" $IMAGE ./actions.sh $CI_PROJECT_NAME $CI_BUILD_REF_NAME deploy
- docker push $IMAGE
environment:
name: review/$CI_BUILD_REF_NAME
url: http://$CI_PROJECT_NAME-$CI_BUILD_REF_NAME.datareadings.com.s3-website-us-east-1.amazonaws.com
on_stop: stop_review
only:
- branches
except:
- master
stop_review:
stage: deploy
variables:
GIT_STRATEGY: none
script:
- docker run --rm -e "AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID" -e "AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY" -e "AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION" $IMAGE ./actions.sh $CI_PROJECT_NAME $CI_BUILD_REF_NAME teardown
when: manual
environment:
name: review/$CI_BUILD_REF_NAME
action: stop