-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshippable.jobs.yml
50 lines (43 loc) · 1.76 KB
/
shippable.jobs.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
jobs:
- name: dprk-pod-def
type: manifest
steps:
- IN: dprk_app_img
- TASK: managed
- name: dprk_provision_cluster_and_secret
type: runSh
steps:
- IN: dprk_params
- IN: dprk_dockerhub
- IN: dprk_cliConfig
scopes:
- gke
- IN: dprk-pod-def
- TASK:
- script: |
# check if the cluster already exists on GKE
response=$(gcloud container clusters describe $DPRK_CLUSTER_NAME --zone $DPRK_CLICONFIG_POINTER_REGION || echo "ClusterNotFound")
if [[ $response = "ClusterNotFound" ]]
then
echo "cluster not found, creating cluster"
gcloud container clusters create $DPRK_CLUSTER_NAME --num-nodes=$DPRK_CLUSTER_NUM_NODES --machine-type=$DPRK_CLUSTER_MACHINE_TYPE
else
echo "cluster already exists, skipping creating cluster"
fi
# Generate the kubectl configuration
gcloud container clusters get-credentials $DPRK_CLUSTER_NAME --zone $DPRK_CLICONFIG_POINTER_REGION
# Delete and create the secret
kubectl delete secret $DPRK_SECRET_KEY_NAME 2>/dev/null || echo "secret does not exist"
kubectl create secret docker-registry $DPRK_SECRET_KEY_NAME --docker-username="$DPRK_DOCKERHUB_INTEGRATION_USERNAME" --docker-password="$DPRK_DOCKERHUB_INTEGRATION_PASSWORD" --docker-email="$DPRK_DOCKERHUB_INTEGRATION_EMAIL" --docker-server="$DPRK_DOCKERHUB_INTEGRATION_URL"/
- name: dprk-pod-deploy
type: deploy
steps:
- IN: dprk_pod_secret
- IN: dprk_cluster
- IN: dprk-pod-def
- IN: dprk_provision_cluster_and_secret
- name: dprk_provision_lb
type: provision
steps:
- IN: dprk_lb
- IN: dprk-pod-deploy