forked from aneeshtv84/wercker-oke-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wercker.yml
66 lines (58 loc) · 2.37 KB
/
wercker.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
build:
box: python:2.7
steps:
# Check that our application's tests are passing. Since this is a python
# application, our entry script will also install the application's dependencies
# with Virtualenv
- script:
name: Nose tests
code: bin/tests
# Take our tested application revision and its dependencies, bake it in to a
# Docker image, and push to OCIR.
- internal/docker-push:
entrypoint: bin/get_ip
cmd: 0.0.0.0 8080
working-dir: $WERCKER_ROOT
tag: $WERCKER_GIT_COMMIT
ports: "8080"
username: $DOCKER_USERNAME
password: $DOCKER_PASSWORD
repository: $DOCKER_REPO
registry: https://phx.ocir.io/v2
deploy-to-kubernetes:
box: python:2.7
steps:
# https://github.com/wercker/step-bash-template
# This Wercker step will look for files in our repo with a .template extension.
# It will expand any environment variables in those files, then remove the
# template extension.
- bash-template
# The step above should leave us with a Kubernetes service and deployment yml files.
# We'll create a directory to move them to.
- script:
name: Prepare Kubernetes files
code: |
mkdir $WERCKER_OUTPUT_DIR/kubernetes
mv kubernetes_*.yml $WERCKER_OUTPUT_DIR/kubernetes
# `apply` is a good command to use here, as it'll create Kubernetes entities if they are missing.
- kubectl:
name: deploy to kubernetes
server: $OKE_MASTER
token: $OKE_TOKEN
insecure-skip-tls-verify: true
command: apply -f $WERCKER_OUTPUT_DIR/kubernetes/
# Tell Kubernetes that we're going to wait 60 seconds for the deploy to be successful
- kubectl:
name: set deployment timeout
server: $OKE_MASTER
token: $OKE_TOKEN
insecure-skip-tls-verify: true
command: patch deployment/get-ip -p '{"spec":{"progressDeadlineSeconds":300}}'
# Watch the Kubernetes deployment. Once the pods are considered healthy the step will exit 0
# If they aren't healthy within 60 seconds, it will exit with a non 0 exit code, and cause the run to fail.
- kubectl:
name: check deployment status
server: $OKE_MASTER
token: $OKE_TOKEN
insecure-skip-tls-verify: true
command: rollout status deployment/get-ip