/
app-pipeline-config.yaml
83 lines (78 loc) · 1.94 KB
/
app-pipeline-config.yaml
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
#
# See https://github.com/bitsofinfo/cicdstatemgr/tree/master/examples/tekton
#
# The base pipeline-config yaml files that
# cicdstatmgr will merge with our customizations
# below to yield the final config file
#
bases:
- core.yaml
- dev.yaml
- prod.yaml
jinja2-macros:
#
# This will be parsed by jinja2
# see
# https://github.com/bitsofinfo/cicdstatemgr/blob/master/examples/tekton/pipelines/deploy/tasks/deploy.yaml
#
# In reality you would not create k8s manifests this way, but is mearly to serve
# as an example of the types of things you can build w/ cicdstatemgr
#
deploymentYamlTemplate: |
{%- macro deploymentYamlTemplate() -%}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{tmplctx.deploymentName}}
namespace: {{tmplctx.targetNamespace}}
spec:
replicas: 1
selector:
matchLabels:
deployment: {{tmplctx.deploymentName}}
template:
metadata:
labels:
deployment: {{tmplctx.deploymentName}}
spec:
containers:
- name: {{tmplctx.deploymentName}}
image: {{tmplctx.imageName}}
ports:
- containerPort: 80
env:
- name: APP_ENVIRONMENT
value: {{tmplctx.targetNamespace}}
---
apiVersion: v1
kind: Service
metadata:
name: {{tmplctx.deploymentName}}
namespace: {{tmplctx.targetNamespace}}
spec:
type: NodePort
ports:
- name: http
port: 80
protocol: TCP
targetPort: 80
selector:
deployment: {{tmplctx.deploymentName}}
{%- endmacro -%}
#
# Our app's customizations
#
cicd-contexts:
dev:
pipelines:
deploy:
deployTask:
deploymentYamlTemplate: |
{{ deploymentYamlTemplate() }}
prod:
pipelines:
deploy:
deployTask:
deploymentYamlTemplate: |
{{ deploymentYamlTemplate() }}