-
Notifications
You must be signed in to change notification settings - Fork 3
/
shippable.yml
61 lines (58 loc) · 1.9 KB
/
shippable.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
resources:
# REPO of kube configs
- name: config_repo
type: gitRepo
integration: "dr_gh"
versionTemplate:
sourceName: "devops-recipes/cd_gke_kubectl"
branch: master
# gcloud CLI Config
- name: gcp_cli
type: cliConfig
integration: "dr_gcp"
versionTemplate:
region: "us-east1-d"
# # GKE cluster info
# - name: gke_cluster
# type: cluster
# integration: "dr_gcp"
# pointer:
# sourceName: "test-cluster"
# region: "us-east1-d"
jobs:
- name: deploy_app_kctl_gke
type: runSh
dependencyMode: strict
steps:
- IN: node_app_img_dh # defined here https://github.com/devops-recipes/node_app/blob/master/shippable.yml
- IN: gcp_cli
switch: off
- IN: gcp_gke_cluster
switch: off
- IN: config_repo
switch: off
- TASK:
name: deploy_app
runtime:
options:
env:
- APP_LABEL: "kctl-app"
script:
- pushd $(shipctl get_resource_state "config_repo")
- cd specs
- export APP_IMG=$(shipctl get_resource_version_key node_app_img_dh sourceName)
- export APP_TAG=$(shipctl get_resource_version_name node_app_img_dh)
- shipctl replace appDeploy.yml appSvc.yml
- export CLUST=$(shipctl get_resource_version_key gke_cluster sourceName)
- export CLUST_REG=$(shipctl get_resource_version_key gke_cluster region)
- gcloud container clusters get-credentials $CLUST --zone $CLUST_REG
- kubectl delete -f ./appDeploy.yml 2>/dev/null || echo ""
- kubectl delete -f ./appSvc.yml 2>/dev/null || echo ""
- kubectl create -o json -f ./appDeploy.yml >> kube_output.json
- kubectl create -o json -f ./appSvc.yml >> kube_output.json
- cat kube_output.json
- popd
flags:
- gke
- cd
- kctl