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 1
/
wercker.yml
91 lines (82 loc) · 3.54 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
86
87
88
89
90
91
# This references the default nodejs container from
# the Docker Hub: https://registry.hub.docker.com/_/node/
# If you want Nodesource's container you would reference nodesource/node
# Read more about containers on our dev center
# https://devcenter.wercker.com/overview-and-core-concepts/containers/
box: node:current-slim
# 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/
# You can also use services such as databases. Read more on our dev center:
# https://devcenter.wercker.com/administration/services/
# services:
# - postgres
# https://devcenter.wercker.com/administration/services/examples/postgresql/
# - mongo
# https://devcenter.wercker.com/administration/services/examples/mongodb/
build:
# The steps that will be executed on build
# Steps make up the actions in your pipeline
# Read more about steps on our dev center:
# https://devcenter.wercker.com/development/steps/
steps:
# A step that executes `npm install` command
- npm-install
# A step that executes `npm test` command
- npm-test
# A custom script step, name value is used in the UI
# and the code value contains the command that get executed
- script:
name: echo nodejs information
code: |
echo "node version $(node -v) running"
echo "npm version $(npm -v) running"
# Take our tested application revision and its dependencies, bake it in to a
# Docker image, and push to OCIR.
- internal/docker-push:
entrypoint: node app.js
#cmd: 0.0.0.0 8080
working-dir: $WERCKER_ROOT
tag: $WERCKER_GIT_COMMIT
ports: "3000"
username: $DOCKER_USERNAME
password: $DOCKER_PASSWORD
repository: $DOCKER_REPO
#registry: https://iad.ocir.io/v2
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/nodesample -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/nodesample