-
Notifications
You must be signed in to change notification settings - Fork 3
/
.gitlab-ci.yml
52 lines (46 loc) · 1.61 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
image: library/docker:stable-dind
stages:
- build
- deploy
variables:
IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
DOCKER_DRIVER: overlay2
build-image:
environment:
name: build
stage: build
script:
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker build -t $IMAGE -f ./deploy/prod.docker .
- docker push $IMAGE
only:
- master
- stage
- test
upgrade-test:
environment:
name: test
stage: deploy
image: cdrx/rancher-gitlab-deploy
script:
- upgrade --rancher-url $RANCHER_URL_DEV --rancher-key $RANCHER_KEY_DEV --rancher-secret $RANCHER_SECRET_DEV --stack $RANCHER_STACK_DEV --service $RANCHER_SERVICE_TEST --environment $RANCHER_ENV_DEV --new-image $IMAGE --wait-for-upgrade-to-finish --start-before-stopping --batch-size 2
only:
- test
upgrade-stage:
environment:
name: stage
stage: deploy
image: cdrx/rancher-gitlab-deploy
script:
- upgrade --rancher-url $RANCHER_URL_DEV --rancher-key $RANCHER_KEY_DEV --rancher-secret $RANCHER_SECRET_DEV --stack $RANCHER_STACK_DEV --service $RANCHER_SERVICE_STAGE --environment $RANCHER_ENV_DEV --new-image $IMAGE --wait-for-upgrade-to-finish --start-before-stopping --batch-size 2
only:
- stage
upgrade-master:
environment:
name: master
stage: deploy
image: cdrx/rancher-gitlab-deploy
script:
- upgrade --rancher-url $RANCHER_URL_PROD --rancher-key $RANCHER_KEY_PROD --rancher-secret $RANCHER_SECRET_PROD --stack $RANCHER_STACK_PROD --service $RANCHER_SERVICE_PROD --environment $RANCHER_ENV_PROD --new-image $IMAGE --wait-for-upgrade-to-finish --start-before-stopping --batch-size 2
only:
- master