-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcac-test-local.yml
437 lines (434 loc) · 16.5 KB
/
cac-test-local.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
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
---
jenkins:
clouds:
- azureVM:
azureCredentialsId: "jenkinsServicePrincipal"
cloudName: "cnp-azure"
deploymentTimeout: 1200
existingResourceGroupName: "aks-infra-cftsbox-intsvc-rg"
maxVirtualMachinesLimit: 10
resourceGroupReferenceType: "existing"
vmTemplates:
- agentLaunchMethod: "SSH"
agentWorkspace: "/opt/jenkins"
builtInImage: "Windows Server 2016"
credentialsId: "vm_agent_creds"
diskType: "managed"
doNotUseMachineIfInitFails: true
enableMSI: false
executeInitScriptAsRoot: true
existingStorageAccountName: "hmctsjenkinssbox"
imageReference:
galleryImageDefinition: "jenkins-ubuntu"
galleryImageVersion: "1.4.19"
galleryName: "hmcts"
galleryResourceGroup: "hmcts-image-gallery-rg"
gallerySubscriptionId: "2b1afc19-5ca9-4796-a56f-574a58670244"
imageTopLevelType: "advanced"
initScript: |
usermod -a -G docker jenkinsssh
umount /mnt/resource
mkdir -pv /opt/jenkins
mount /dev/sdb1 /opt/jenkins
chown -R jenkinsssh:jenkinsssh /opt/jenkins
mv /tmp/jenkinsssh_id_rsa /home/jenkinsssh/.ssh/id_rsa
chown jenkinsssh:jenkinsssh /home/jenkinsssh/.ssh/id_rsa
chmod 0600 /home/jenkinsssh/.ssh/id_rsa
mkdir /opt/jenkins/.gradle && echo 'org.gradle.daemon=false' > /opt/jenkins/.gradle/gradle.properties
cat > /etc/dnsmasq.d/10-internal-forwarding<<EOF
server=/#/10.99.196.9
EOF
systemctl restart dnsmasq
cat > /etc/security/limits.d/30-jenkins.conf<<EOF
jenkinsssh soft nofile 40960
jenkinsssh hard nofile 40960
jenkinsssh soft
proc 32768
jenkinsssh hard nproc 32768
EOF
ssh-keyscan github.com github.com >> /home/jenkinsssh/.ssh/known_hosts
ssh-keygen -F github.com -f /home/jenkinsssh/.ssh/known_hosts # verifies key is correctly installed
installDocker: false
installGit: false
installMaven: false
jvmOptions: "-Xms4G -Xmx4G -XX:+UseG1GC -XX:+UseCompressedOops -XX:+UseCompressedClassPointers\
\ -XX:+AlwaysPreTouch -XX:+UseStringDeduplication -XX:+ParallelRefProcEnabled\
\ -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=20 -XX:+UnlockDiagnosticVMOptions\
\ -XX:G1SummarizeRSetStatsPeriod=1"
location: "UK South"
noOfParallelJobs: 1
osDiskSize: 0
osType: "Linux"
preInstallSsh: true
retentionStrategy:
azureVMCloudRetentionStrategy:
idleTerminationMinutes: 60
shutdownOnIdle: false
storageAccountNameReferenceType: "existing"
storageAccountType: "Standard_LRS"
subnetName: "iaas"
templateDesc: "Jenkins build agents for HMCTS"
templateDisabled: false
templateName: "cnp-jenkins-builders"
usageMode: "NORMAL"
usePrivateIP: true
virtualMachineSize: "Standard_D4s_v3"
virtualNetworkName: "cft-ptlsbox-vnet"
virtualNetworkResourceGroupName: "cft-ptlsbox-network-rg"
- kubernetes:
addMasterProxyEnvVars: true
containerCap: 10
containerCapStr: "10"
jenkinsTunnel: "jenkins-agent:50000"
jenkinsUrl: "http://jenkins:8080"
maxRequestsPerHost: 32
maxRequestsPerHostStr: "32"
name: "kubernetes"
namespace: "jenkins"
podLabels:
- key: "aadpodidbinding"
value: "jenkins"
- key: "cloud"
value: "kubernetes"
templates:
- activeDeadlineSeconds: 120
activeDeadlineSecondsStr: "120"
containers:
- args: "/bin/sh -c cat"
command: "/tini --"
image: "hmctspublic.azurecr.io/jenkins/build-agent:db8a7c"
livenessProbe:
failureThreshold: 3
initialDelaySeconds: 150
periodSeconds: 15
successThreshold: 1
timeoutSeconds: 5
name: "inbound-agent"
resourceLimitCpu: "3000m"
resourceLimitMemory: "8Gi"
resourceRequestCpu: "1000m"
resourceRequestMemory: "2Gi"
ttyEnabled: true
workingDir: "/home/jenkins/agent"
- image: "hmctspublic.azurecr.io/jenkins/minimal-agent:db6hu6"
livenessProbe:
failureThreshold: 3
initialDelaySeconds: 150
periodSeconds: 15
successThreshold: 1
timeoutSeconds: 5
name: "jnlp"
resourceLimitCpu: "2000m"
resourceLimitMemory: "6Gi"
resourceRequestCpu: "500m"
resourceRequestMemory: "1Gi"
ttyEnabled: false
workingDir: "/home/jenkins/agent"
hostNetwork: false
idleMinutes: 10
idleMinutesStr: "10"
instanceCap: 10
instanceCapStr: "10"
label: "k8s-agent"
name: "k8s-inbound-agent"
namespace: "jenkins"
podRetention: "never"
serviceAccount: "jenkins"
supplementalGroups: "118"
volumes:
- hostPathVolume:
hostPath: "/var/run/docker.sock"
mountPath: "/var/run/docker.sock"
- emptyDirVolume:
memory: false
mountPath: "/opt/jenkins"
- emptyDirVolume:
memory: false
mountPath: "/home/jenkins/.ssh"
- hostPathVolume:
hostPath: "/tmp/jenkins-agent"
mountPath: "/tmp/jenkins-agent"
yaml: |-
metadata:
labels:
app.kubernetes.io/name: jenkins
app.kubernetes.io/component: jenkins-agent
spec:
securityContext:
runAsUser: 1000
fsGroup: 118
initContainers:
- name: init-agent
image: hmctspublic.azurecr.io/jenkins/minimal-agent:db6hu6
command:
- /bin/sh
- -c
- "chown 0:118 /tmp/jenkins-agent && chmod g+rwx /tmp/jenkins-agent"
volumeMounts:
- mountPath: /tmp/jenkins-agent
name: volume-3
securityContext:
runAsUser: 0
runAsGroup: 0
privileged: true
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app.kubernetes.io/component
operator: In
values:
- jenkins-master
topologyKey: "kubernetes.io/hostname"
yamlMergeStrategy: "merge"
yamls:
- |-
metadata:
labels:
app.kubernetes.io/name: jenkins
app.kubernetes.io/component: jenkins-agent
spec:
securityContext:
runAsUser: 1000
fsGroup: 118
initContainers:
- name: init-agent
image: hmctspublic.azurecr.io/jenkins/minimal-agent:db6hu6
command:
- /bin/sh
- -c
- "chown 0:118 /tmp/jenkins-agent && chmod g+rwx /tmp/jenkins-agent"
volumeMounts:
- mountPath: /tmp/jenkins-agent
name: volume-3
securityContext:
runAsUser: 0
runAsGroup: 0
privileged: true
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app.kubernetes.io/component
operator: In
values:
- jenkins-master
topologyKey: "kubernetes.io/hostname"
systemMessage: >-
This jenkins is managed by configuration as code, update <a
href="https://github.com/hmcts/cnp-jenkins-config/blob/master/cac-test.yml">here</a>
globalNodeProperties:
- envVars:
env:
- key: INFRA_VAULT_NAME
value: infra-vault-sandbox
- key: NONPROD_ENVIRONMENT_NAME
value: saat
- key: NONPROD_SUBSCRIPTION_NAME
value: sandbox
- key: PROD_ENVIRONMENT_NAME
value: sprod
- key: PROD_SUBSCRIPTION_NAME
value: sandbox
- key: JAVA_OPTS
value: -Xmx2g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
- key: GRADLE_OPTS
value: -Xmx2g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
disabledAdministrativeMonitors:
- "jenkins.security.QueueItemAuthenticatorMonitor"
- "jenkins.security.s2m.MasterKillSwitchWarning"
crumbIssuer:
standard:
excludeClientIPFromCrumb: false
markupFormatter:
rawHtml:
disableSyntaxHighlighting: false
numExecutors: 0
primaryView:
all:
name: all
views:
- all:
name: all
- buildMonitor:
includeRegex: >-
^HMCTS_.*(Platform|CNP).*\/(draft-store|rpe-pdf-service|feature-toggle-api|service-auth-provider-app|spring-boot-template|cnp-rhubarb-recipes-service|cnp-plum-recipes-service|cnp-plum-frontend|cnp-plum-shared-infrastructure)\/master
name: Platform
recurse: true
title: Platform
- buildMonitor:
includeRegex: >-
^HMCTS_.*LABS-.*\/.+\/master
name: LABS
recurse: true
title: Labs
authorizationStrategy:
globalMatrix:
permissions:
- "GROUP:Overall/Administer:authenticated"
- "GROUP:Overall/Administer:e7ea2042-4ced-45dd-8ae3-e051c6551789"
- "GROUP:Overall/Read:authenticated"
- "GROUP:View/Create:authenticated"
- "GROUP:View/Read:authenticated"
- "GROUP:View/Configure:authenticated"
- "GROUP:View/Delete:authenticated"
- "GROUP:Agent/Create:authenticated"
- "GROUP:Agent/Build:authenticated"
- "GROUP:Agent/Connect:authenticated"
- "GROUP:Agent/Delete:authenticated"
- "GROUP:Agent/Configure:authenticated"
- "GROUP:Agent/Disconnect:authenticated"
- "GROUP:Run/Delete:authenticated"
- "GROUP:Run/Replay:authenticated"
- "GROUP:Run/Update:authenticated"
- "GROUP:Job/Configure:authenticated"
- "GROUP:Job/Cancel:authenticated"
- "GROUP:Job/Read:authenticated"
- "GROUP:Job/Build:authenticated"
- "GROUP:Job/Move:authenticated"
- "GROUP:Job/Discover:authenticated"
- "USER:Job/Discover:anonymous"
- "GROUP:Job/Create:authenticated"
- "GROUP:Job/Workspace:authenticated"
- "GROUP:Job/Delete:authenticated"
- "GROUP:Credentials/View:authenticated"
- "GROUP:Lockable Resources/Unlock:authenticated"
- "GROUP:Lockable Resources/Reserve:authenticated"
- "GROUP:SCM/Tag:authenticated"
securityRealm:
local:
allowsSignup: false
users:
- id: "admin"
password: "admin"
unclassified:
location:
adminAddress: [email protected]
url: 'http://localhost:8088'
gitHubConfiguration:
apiRateLimitChecker: ThrottleOnOver
globalLibraries:
libraries:
- name: 'Infrastructure'
includeInChangesets: false
defaultVersion: master
retriever:
modernSCM:
scm:
github:
credentialsId: hmcts-jenkins-cnp
repoOwner: hmcts
repository: cnp-jenkins-library
- name: 'Pipeline'
includeInChangesets: false
defaultVersion: master
retriever:
modernSCM:
scm:
github:
credentialsId: hmcts-jenkins-cnp
repoOwner: hmcts
repository: cnp-jenkins-library
defaultFolderConfiguration:
healthMetrics:
- "primaryBranchHealthMetric"
slackNotifier:
teamDomain: hmcts-reform
tokenCredentialId: slack-token
botUser: true
globalDefaultFlowDurabilityLevel:
durabilityHint: PERFORMANCE_OPTIMIZED
themeManager:
theme: "darkSystem"
azureKeyVault:
keyVaultURL: https://infra-vault-sandbox.vault.azure.net
credentialID: jenkinsServicePrincipal
sonarGlobalConfiguration:
installations:
- additionalAnalysisProperties: sonar.organization=hmcts
name: SonarQube
credentialsId: 'sonarcloud-api-token'
serverUrl: 'https://sonarcloud.io'
timestamper:
allPipelines: true
buildDiscarders:
configuredBuildDiscarders:
- "jobBuildDiscarder"
- simpleBuildDiscarder:
discarder:
logRotator:
artifactDaysToKeepStr: "14"
artifactNumToKeepStr: "20"
daysToKeepStr: "14"
numToKeepStr: "20"
credentials:
system:
domainCredentials:
- credentials:
- string:
scope: GLOBAL
id: sonarcloud-api-token
secret: '${sonarcloud-api-token}'
description: SonarCloud API token
- string:
scope: GLOBAL
id: slack-token
secret: '${slack-token}'
description: Slack token
- usernamePassword:
description: "SSH credentials for Jenkins agents"
id: "vm_agent_creds"
password: "${mgmt-bastion-creds-password}"
scope: GLOBAL
username: "jenkinsssh"
- string:
description: "Read/Write Key To Publish CosmosDB Metrics"
id: "COSMOSDB_TOKEN_KEY"
scope: GLOBAL
secret: "${pipelinemetrics-cosmosdb-key}"
- usernamePassword:
description: "Username and password for the OWASP vulnerability database"
id: "owasp-db-login"
password: "${OWASPDb-Password}"
scope: GLOBAL
username: "owasp_administrator"
- usernamePassword:
description: "Storage account name and access key for storing build reports"
id: "buildlog-storage-account"
password: "${jenkins-build-logs-key}"
scope: GLOBAL
username: "mgmtbuildlogstoresandbox"
- sauce:
apiKey: "${sauce-access-key}"
description: "Sauce Labs Reform Key"
id: "reform_tunnel"
scope: GLOBAL
username: "reform"
- azure:
azureEnvironmentName: "Azure"
clientId: "${jenkins-sp-client-id}"
clientSecret: "${jenkins-sp-client-secret}"
description: "Jenkins Service Principal - only has access to infra key vault"
id: "jenkinsServicePrincipal"
scope: GLOBAL
subscriptionId: "${jenkins-sp-subscription-id}"
tenant: "${jenkins-sp-tenant-id}"
- gitHubApp:
appID: "${hmcts-jenkins-a-to-c-appid}"
description: "GitHub APP Key - A to C"
id: "hmcts-jenkins-a-to-c"
privateKey: "${hmcts-jenkins-a-to-c-ghapp}"
- gitHubApp:
appID: "${hmcts-jenkins-d-to-i-appid}"
description: "GitHub APP Key - D to I"
id: "hmcts-jenkins-d-to-i"
privateKey: "${hmcts-jenkins-d-to-i-ghapp}"
- gitHubApp:
appID: "${hmcts-jenkins-j-to-z-appid}"
description: "GitHub APP Key - J to Z"
id: "hmcts-jenkins-j-to-z"
privateKey: "${hmcts-jenkins-j-to-z-ghapp}"
jobs:
- file: '/usr/share/jenkins/jobdsl/organisations-cnptest.groovy'