forked from FairwindsOps/rok8s-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.yml
88 lines (84 loc) · 2.38 KB
/
config.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
version: 2
references:
set_environment_variables: &set_environment_variables
run:
name: Set Environment Variables
command: |
echo 'export CI_SHA1=$CIRCLE_SHA1' >> ${BASH_ENV}
echo 'export CI_BRANCH=$CIRCLE_BRANCH' >> ${BASH_ENV}
echo 'export CI_BUILD_NUM=$CIRCLE_BUILD_NUM' >> ${BASH_ENV}
echo 'export CI_TAG=$CIRCLE_TAG' >> ${BASH_ENV}
echo 'export ROK8S_INSTALL_PATH=${HOME}' >> ${BASH_ENV}
echo "export KUBECONFIG_DATA=\$$KUBECONFIG_DATA" >> ${BASH_ENV}
deploy_steps: &deploy_steps
docker:
- image: quay.io/reactiveops/ci-images:v9-alpine
steps:
- checkout
- *set_environment_variables
- run: prepare-kubectl
- run: k8s-deploy-and-verify -f ${ROK8S_CONFIG}
jobs:
imagebuild:
docker:
- image: quay.io/reactiveops/ci-images:v9-alpine
steps:
- checkout
- setup_remote_docker
- *set_environment_variables
- run: "[[ -n ${ROK8S_NO_BUILD} ]] || docker-pull -f ${ROK8S_CONFIG}"
- run: "[[ -n ${ROK8S_NO_BUILD} ]] || docker-build -f ${ROK8S_CONFIG}"
- run: "[[ -n ${ROK8S_NO_BUILD} ]] || docker-push -f ${ROK8S_CONFIG}"
environment:
ROK8S_CONFIG: deploy/staging.config
deploy_development:
<<: *deploy_steps
environment:
ROK8S_CONFIG: deploy/development.config
KUBECONFIG_DATA: KUBECONFIG_DATA_DEVELOPMENT
deploy_staging:
<<: *deploy_steps
environment:
ROK8S_CONFIG: deploy/staging.config
KUBECONFIG_DATA: KUBECONFIG_DATA_STAGING
deploy_production:
<<: *deploy_steps
environment:
ROK8S_CONFIG: deploy/production.config
KUBECONFIG_DATA: KUBECONFIG_DATA_PRODUCTION
workflows:
version: 2
build_default:
jobs:
- imagebuild:
context: org-global
filters:
tags:
ignore: /.*/
- deploy_development:
context: org-global
requires:
- imagebuild
filters:
branches:
only:
- develop
tags:
ignore: /.*/
- deploy_staging:
context: org-global
requires:
- imagebuild
filters:
branches:
only:
- master
tags:
ignore: /.*/
- deploy_production:
context: org-global
filters:
branches:
ignore: /.*/
tags:
only: /\d+\.\d+\.\d+$/