-
Notifications
You must be signed in to change notification settings - Fork 2
/
wercker.yml
85 lines (74 loc) · 2.39 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
box: java
# Developer.
dev:
steps:
- script:
name: gradle bootRun
code: |
./gradlew bootRun
# Build Application
build:
steps:
- script:
name: Run Junit tests
code: |
./gradlew --full-stacktrace test
- script:
name: Gradle Build
code: |
./gradlew --full-stacktrace -q --project-cache-dir=$WERCKER_CACHE_DIR build
- script:
name: Place JAR in output directory
code: |
mv build/libs/time-api-*.jar $WERCKER_OUTPUT_DIR/time-api.jar
mv *.template $WERCKER_OUTPUT_DIR/
# Push Docker Image
push-image:
steps:
- internal/docker-push:
repository: $DOCKER_REPO
registry: https://registry.hub.docker.com/v2
username: $DOCKER_USERNAME
password: $DOCKER_PASSWORD
cmd: java -jar /pipeline/source/time-api.jar
tag: $WERCKER_GIT_BRANCH
ports: "8080"
# Deploy to a Kubernetes cluster
deploy-to-kubernetes:
# We only need a minimal shell environment to run Kubectl.
box:
id: alpine
cmd: /bin/sh
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: |
ls -lth
cat kubernetes_*.yml
mkdir $WERCKER_OUTPUT_DIR/kubernetes
mv kubernetes_*.yml $WERCKER_OUTPUT_DIR/kubernetes
- kubectl:
name: deploy to kubernetes
server: $KUBERNETES_MASTER
token: $KUBERNETES_TOKEN
insecure-skip-tls-verify: true
command: apply -f $WERCKER_OUTPUT_DIR/kubernetes/
- kubectl:
name: set deployment timeout
server: $KUBERNETES_MASTER
token: $KUBERNETES_TOKEN
insecure-skip-tls-verify: true
command: patch deployment/time-api -p '{"spec":{"progressDeadlineSeconds":60}}'
- kubectl:
name: check deployment status
server: $KUBERNETES_MASTER
token: $KUBERNETES_TOKEN
insecure-skip-tls-verify: true
command: rollout status deployment/time-api