forked from FairwindsOps/rok8s-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
78 lines (69 loc) · 1.72 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
stages:
- build
- deploy
variables:
GCLOUDSDK_CONTAINER_USE_V1_CLIENT: "false"
GOOGLE_APPLICATION_CREDENTIALS: /tmp/gcloud_key.json
GCP_REGION: us-west1
CI_SHA1: $CI_COMMIT_SHA
CI_BRANCH: $CI_COMMIT_REF_NAME
CI_BUILD_NUM: $CI_JOB_ID
CI_TAG: $CI_COMMIT_TAG
DOCKER_HOST: tcp://localhost:2375
DOCKER_DRIVER: overlay2
image: quay.io/reactiveops/ci-images:v9-alpine
services:
- docker:dind
.aliases:
- &initialize-dev |
export GCP_PROJECT=sample-dev-project
export CLUSTER_NAME=sample-dev-cluster
export GCLOUD_KEY=$GCLOUD_KEY_DEV
export ROK8S_CONFIG="deploy/development.config"
prepare-gcloud
- &initialize-staging |
export GCP_PROJECT=sample-staging-project
export CLUSTER_NAME=sample-staging-cluster
export GCLOUD_KEY=$GCLOUD_KEY_STAGING
export ROK8S_CONFIG="deploy/staging.config"
prepare-gcloud
- &initialize-prod |
export GCP_PROJECT=sample-staging-project
export CLUSTER_NAME=sample-staging-cluster
export GCLOUD_KEY=$GCLOUD_KEY_PROD
export ROK8S_CONFIG="deploy/production.config"
prepare-gcloud
build:
stage: build
script:
- *initialize-dev
- docker-build -f $ROK8S_CONFIG
- docker-push -f $ROK8S_CONFIG
deploy_development:
stage: deploy
environment:
name: development
script:
- *initialize-dev
- helm-deploy -f $ROK8S_CONFIG
only:
- /^dev-.*/
deploy_staging:
stage: deploy
environment:
name: staging
script:
- *initialize-staging
- helm-deploy -f $ROK8S_CONFIG
only:
- master
deploy_production:
stage: deploy
environment:
name: production
script:
- *initialize-prod
- helm-deploy -f $ROK8S_CONFIG
only:
- /^v.*/
when: manual