forked from VilledeMontreal/angular-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
159 lines (148 loc) · 4.21 KB
/
Jenkinsfile
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#!groovy
@Library('cicd-lib')
import vdmtl.cicd.*
import jenkins.model.*
import vdmtl.cicd.deployment.TargetEnv
import vdmtl.cicd.http.HttpUtils
import java.awt.Color
pipeline = new Pipeline()
// For more information on the configuration options,
// see https://bitbucket.org/villemontreal/cicd-lib/src/master/docs/Config.md
sbCtx = pipeline.createContext([
namespace: ["sn","components"],
application: [
name: "core-components-angular-lib-storybook",
type: "service",
tier: "backend",
runtime: "nginx",
framework: "Angular",
keywords: ["documentation", "Angular", "components", "Storybook"],
//labels: [key1: "infra", key2: "security"],
description: "This is the Storybook documentation for angular-ui (bao)",
//icon: "https://cdnjs.cloudflare.com/ajax/libs/foundicons/3.0.0/svgs/fi-lightbulb.svg"
],
build: [
containers: [
// [
// name: "hugo",
// image: "cibuilds/hugo:0.62.2",
// ttyEnabled: true,
// command: "cat",
// alwaysPullImage: true,
// ],
[
name: "nodejs",
image: "node:16.14-alpine",
ttyEnabled: true,
command: "cat",
],
pipeline.createCicdToolsContainerDefinition(),
]
],
packaging: [
dockerfilePath: "./Dockerfile.storybook", // The location of the Dockerfile to use
],
execution: [
service: [
port: 80
],
resources: [
minCpu: "100m",
minMemory: "128Mi",
maxCpu: "500m",
maxMemory: "556Mi"
],
autoScaling: [
minReplicas: 1,
maxReplicas: 3,
cpuUsagePercentage: 70
],
probes: [
liveness: [
enabled: true,
path: '/',
],
readiness: [
enabled: true,
path: '/',
],
],
monitoring: [
enabled: false,
],
],
ingress: [
hosts: [
[
uri: 'services.kube.<ENV>.ile.montreal.qc.ca',
paths: [
'/bao-storybook'
]
],
[
uri : "services.<ENV>.interne.montreal.ca",
paths: [
'/bao-storybook'
]
],
[
uri : "services.<ENV>.montreal.ca",
paths: [
'/bao-storybook'
]
]
]
],
approval: [
enabled: false,
approvers: ["usamtol"]
],
notifications: [
chat: [
room: "core-components-angular-lib-notifications",
notify: true
],
mail: [
to: [
// Full email, or prefix of the email address ville.montreal.qc.ca
// ex: "john.doe", "jane.dear@mailinator.com"
// Note that the code U (e.g., udev123) will not work since there
// is no email using that id.
"tola.sam",
"olivier.albertini"
]
]
],
vars: [
],
secrets : [
],
])
pipeline.start(sbCtx) {
pipeline.withSourceCode(sbCtx) {
// Build the static storybook
// that will be stored in a container and served by a NGINX server.
pipeline.buildStage(sbCtx) {
// first, regen the static web assets used by the Hugo site
container("nodejs") {
sh "npm ci --ignore-scripts"
sh "npm run build-storybook"
}
// finally, build the image
pipeline.buildDockerImage(sbCtx)
}
pipeline.prePublishStage(sbCtx) {
pipeline.publishDraftDockerImage(sbCtx)
}
}
pipeline.withDraftDockerImage(sbCtx) {
pipeline.testInDraftDockerContainerStage(sbCtx) {
}
pipeline.publishStage(sbCtx) {
pipeline.publishDockerImage(sbCtx)
}
pipeline.deployStage(sbCtx) {
pipeline.deployApp(sbCtx)
}
}
}