This repository has been archived by the owner on Mar 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wercker.yml
72 lines (65 loc) · 2.75 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
67
68
69
70
71
# This references an OpenJDK container from the
# Docker Hub https://hub.docker.com/_/openjdk/
# Read more about containers on our dev center
# https://devcenter.wercker.com/overview-and-core-concepts/containers/
box: openjdk:8-jdk
# This is the build pipeline. Pipelines are the core of wercker
# Read more about pipelines on our dev center
# https://devcenter.wercker.com/development/pipelines/
build:
# Steps make up the actions in your pipeline
# Read more about steps on our dev center:
# https://devcenter.wercker.com/development/steps/
steps:
# https://github.com/wercker/step-maven
- wercker/maven:
goals: package
cache_repo: true
version: 3.5.2
# Take our tested application revision and its dependencies, bake it in to a
# Docker image, and push to OCIR.
- internal/docker-push:
entrypoint: java -jar ./target/myproject-0.0.1-SNAPSHOT.jar
working-dir: $WERCKER_ROOT
tag: $WERCKER_GIT_COMMIT
ports: "3000"
username: $DOCKER_USERNAME
password: $DOCKER_PASSWORD
repository: $DOCKER_REPO
deploy-to-kubernetes:
box: node:current-slim
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/sbootsample -p '{"spec":{"progressDeadlineSeconds":60}}'
# 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/sbootsample