-
Notifications
You must be signed in to change notification settings - Fork 212
/
Jenkinsfile.ocne
542 lines (488 loc) · 33.3 KB
/
Jenkinsfile.ocne
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
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
// Copyright (c) 2023, Oracle and/or its affiliates.
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
//
CRON_SETTINGS = '''H 1 * * * % MAVEN_PROFILE_NAME=olcne-srg
H 5 * * * % MAVEN_PROFILE_NAME=olcne-mrg
H 14 * * * % MAVEN_PROFILE_NAME=olcne-sequential'''
pipeline {
agent { label 'large' }
options {
timeout(time: 1800, unit: 'MINUTES')
disableConcurrentBuilds()
}
triggers {
// timer trigger for "nightly build"
parameterizedCron(env.JOB_NAME == 'wko-ocne-main-nightly' ?
CRON_SETTINGS : '')
}
tools {
maven 'maven-3.8.7'
jdk 'jdk21'
}
environment {
ocir_host = "${env.WKT_OCIR_HOST}"
wko_tenancy = "${env.WKT_TENANCY}"
wko_images_rep = '${wko_tenancy}/wkt/infra'
wko_region = "${env.WKT_REGION}"
compartment_id = "${env.WKT_TEST_COMPARTMENT_ID}"
ocir_creds = 'wkt-ocir-creds'
wko_files_bucket_token = 'wko-system-test-files-bucket-par-token'
oci_profile = 'DEFAULT'
jenkins_user = sh(returnStdout: true, script: "id -nu").trim()
jenkins_home_directory = sh(returnStdout: true, script: "getent passwd ${jenkins_user} | cut -d: -f6").trim()
OCI_CLI_CONFIG_FILE = "${jenkins_home_directory}/.oci/config"
oci_config_file_creds = 'wkt-oci-config-file'
oci_signing_key_creds = 'wkt-oci-signing-key'
//terraform_property_file = 'tvarsFile'
compartmentName='test'
wkobuild_cert_fingerprint = 'wkotestcert_fingerprint'
wkobuild_user_ocid = 'wkotest-user-ocid'
wkotest_ssh_pubcert = "${WORKSPACE}/.ssh/wkotestkey.pub"
wkotest_ssh_pk = "${WORKSPACE}/.ssh/wkotestkey"
OCNE='true'
outdir = "${WORKSPACE}/staging"
result_root = "${outdir}/wl_k8s_test_results"
pv_root_parent = "${outdir}/k8s-pvroot"
pv_root = "${pv_root_parent}/newpvroot"
pv_root_for_sampletest = "/shared"
start_time = sh(script: 'date +"%Y-%m-%d %H:%M:%S"', returnStdout: true).trim()
wle_download_url="https://github.com/oracle/weblogic-logging-exporter/releases/latest"
CLUSTER_NAME = "${env.JOB_NAME == 'wko-ocne-main-nightly' ? 'mycluster1' : 'mycluster1'}"
kubeconfig_file = "${WORKSPACE}/ocne_kubeconfig1"
availability_domain = "${env.JOB_NAME == 'wko-ocne-main-nightly' ? 'mFEn:PHX-AD-1' : 'mFEn:PHX-AD-1'}"
PARALLEL_RUN = "${env.JOB_NAME == 'wko-ocne-main-nightly' ? true : false}"
}
parameters {
string(name: 'BRANCH',
description: 'The branch for weblogic-kubernetes-operator project',
defaultValue: "main"
)
choice(name: 'MAVEN_PROFILE_NAME',
description: 'Profile to use in mvn command to run the tests. Possible values are olcne (the default), wko-olcne-cert and integration-tests. Refer to weblogic-kubernetes-operator/integration-tests/pom.xml on the branch.',
choices: [
'olcne-srg',
'olcne-mrg',
'olcne-sequential',
'integration-tests'
]
)
string(name: 'IT_TEST',
description: 'Comma separated list of individual It test classes to be run e.g., ItParameterizedDomain, ItMiiUpdateDomainConfig, ItMiiDynamicUpdate*, ItMiiMultiMode',
defaultValue: ''
)
string(name: 'OPERATOR_LOG_LEVEL',
description: 'The default log level is not set',
defaultValue: ''
)
string(name: 'OCNE_KUBE_VERSION',
description: 'kube version for OCNE cluster',
defaultValue: '1.26.2'
)
string(name: 'IMAGE_ID',
description: 'oci image id for node pool, find image OCID for your region from https://docs.oracle.com/iaas/images/',
//defaultValue7.6: 'ocid1.image.oc1.phx.aaaaaaaancucg25pze6m52agxwxmmfszvsdnhp3kvim53pts2tw6mik4xtha'
defaultValue: 'ocid1.image.oc1.phx.aaaaaaaaaizmtmozeudeeuq7o5ir7dkl2bkxbbb3tgomshqbqn6jpomrsjza'
)
string(name: 'KUBECTL_VERSION',
description: 'kubectl version',
defaultValue: '1.26.2'
)
string(name: 'HELM_VERSION',
description: 'Helm version',
defaultValue: '3.11.2'
)
choice(name: 'ISTIO_VERSION',
description: 'Istio version',
choices: [
'1.17.2',
'1.16.1',
'1.13.2',
'1.12.6',
'1.11.1',
'1.10.4',
'1.9.9'
]
)
string(name: 'NUMBER_OF_THREADS',
description: 'Number of threads to run the classes in parallel, default is 2.',
defaultValue: "2"
)
string(name: 'WDT_DOWNLOAD_URL',
description: 'URL to download WDT.',
//defaultValue: 'https://github.com/oracle/weblogic-deploy-tooling/releases/latest'
)
string(name: 'WIT_DOWNLOAD_URL',
description: 'URL to download WIT.',
//defaultValue: 'https://github.com/oracle/weblogic-image-tool/releases/latest'
)
string(name: 'REPO_REGISTRY',
description: '',
defaultValue: "${env.WKT_OCIR_HOST}"
)
string(name: 'NODE_SHAPE',
description: '',
defaultValue: "VM.Standard.E3.Flex"
)
choice(name: 'BASE_IMAGES_REPO',
choices: ["${env.WKT_OCIR_HOST}", 'container-registry.oracle.com'],
description: 'Repository to pull the base images. Make sure to modify the image names if you are modifying this parameter value.'
)
string(name: 'TEST_IMAGES_REPO',
description: '',
defaultValue: "${env.WKT_OCIR_HOST}"
)
string(name: 'WEBLOGIC_IMAGE_NAME',
description: 'WebLogic base image name. Default is the image name in OCIR. Use middleware/weblogic for OCR.',
defaultValue: 'test-images/weblogic'
)
string(name: 'WEBLOGIC_IMAGE_TAG',
description: '12.2.1.3 (12.2.1.3-ol7) , 12.2.1.3-dev (12.2.1.3-dev-ol7), 12.2.1.3-ol8, 12.2.1.3-dev-ol8, 12.2.1.4, 12.2.1.4-dev(12.2.1.4-dev-ol7) , 12.2.1.4-slim(12.2.1.4-slim-ol7), 12.2.1.4-ol8, 12.2.1.4-dev-ol8, 12.2.1.4-slim-ol8, 14.1.1.0-11-ol7, 14.1.1.0-dev-11-ol7, 14.1.1.0-slim-11-ol7, 14.1.1.0-8-ol7, 14.1.1.0-dev-8-ol7, 14.1.1.0-slim-8-ol7, 14.1.1.0-11-ol8, 14.1.1.0-dev-11-ol8, 14.1.1.0-slim-11-ol8, 14.1.1.0-8-ol8, 14.1.1.0-dev-8-ol8, 14.1.1.0-slim-8-ol8',
defaultValue: '12.2.1.4'
)
string(name: 'FMWINFRA_IMAGE_NAME',
description: 'FWM Infra image name. Default is the image name in OCIR. Use middleware/fmw-infrastructure for OCR.',
defaultValue: 'test-images/fmw-infrastructure'
)
string(name: 'FMWINFRA_IMAGE_TAG',
description: 'FWM Infra image tag',
defaultValue: '12.2.1.4'
)
string(name: 'DB_IMAGE_NAME',
description: 'Oracle DB image name. Default is the image name in OCIR, use database/enterprise for OCR.',
defaultValue: 'test-images/database/enterprise'
)
string(name: 'DB_IMAGE_TAG',
description: 'Oracle DB image tag',
defaultValue: '12.2.0.1-slim'
)
string(name: 'MONITORING_EXPORTER_BRANCH',
description: '',
defaultValue: 'main'
)
string(name: 'MONITORING_EXPORTER_WEBAPP_VERSION',
description: '',
defaultValue: '2.1.3'
)
string(name: 'PROMETHEUS_CHART_VERSION',
description: '',
defaultValue: '17.0.0'
)
string(name: 'GRAFANA_CHART_VERSION',
description: '',
defaultValue: '6.44.11'
)
booleanParam(name: 'COLLECT_LOGS_ON_SUCCESS',
description: 'Collect logs for successful runs. Default is false.',
defaultValue: false
)
string(name: 'REMOTECONSOLE_VERSION',
description: 'RemoteConsole version.',
defaultValue: '2.4.7'
)
}
stages {
stage('Filter unwanted branches') {
stages {
stage('Workaround JENKINS-41929 Parameters bug') {
steps {
echo 'Initialize parameters as environment variables due to https://issues.jenkins-ci.org/browse/JENKINS-41929'
evaluate """${def script = ""; params.each { k, v -> script += "env.${k} = '''${v}'''\n" }; return script}"""
}
}
stage ('Echo environment') {
environment {
runtime_path = "${WORKSPACE}/bin:${PATH}"
}
steps {
sh '''
env|sort
java -version
mvn --version
python --version
docker version
ulimit -a
ulimit -aH
'''
}
}
stage('Make Workspace bin directory') {
steps {
sh "mkdir -m777 -p ${WORKSPACE}/bin"
}
}
stage('Install Helm') {
environment {
runtime_path = "${WORKSPACE}/bin:${PATH}"
}
steps {
sh '''
export PATH=${runtime_path}
oci os object get --namespace=${wko_tenancy} --bucket-name=wko-system-test-files \
--name=helm/helm-v${HELM_VERSION}.tar.gz --file=helm.tar.gz \
--auth=instance_principal
tar zxf helm.tar.gz
mv linux-amd64/helm ${WORKSPACE}/bin/helm
rm -rf linux-amd64
helm version
'''
}
}
stage ('Install kubectl') {
environment {
runtime_path = "${WORKSPACE}/bin:${PATH}"
}
steps {
sh '''
export PATH=${runtime_path}
oci os object get --namespace=${wko_tenancy} --bucket-name=wko-system-test-files \
--name=kubectl/kubectl-v${KUBECTL_VERSION} --file=${WORKSPACE}/bin/kubectl \
--auth=instance_principal
chmod +x ${WORKSPACE}/bin/kubectl
kubectl version --client=true
'''
}
}
stage('Setup OCI config file ') {
steps {
withCredentials([file(credentialsId: "${oci_config_file_creds}", variable: 'OCI_CONFIG_FILE'),
file(credentialsId: "${oci_signing_key_creds}", variable: 'OCI_SIGNING_KEY')]) {
sh "mkdir -p ${jenkins_home_directory}/.oci"
sh "sed -e \"s:__jenkins_home__:${jenkins_home_directory}:g\" \"\$OCI_CONFIG_FILE\" > ${jenkins_home_directory}/.oci/config"
sh "cp \"\$OCI_SIGNING_KEY\" ${jenkins_home_directory}/.oci/oci-signing-key.pem"
}
sh '''
cat ${jenkins_home_directory}/.oci/config
'''
}
}
stage('Build WebLogic Kubernetes Operator') {
steps {
withMaven(globalMavenSettingsConfig: 'wkt-maven-settings-xml', publisherStrategy: 'EXPLICIT') {
sh "mvn -DtrimStackTrace=false clean install"
}
}
}
stage('Preparing Integration Test Environment') {
steps {
sh '''
mt_privateip_id=`oci fs mount-target list --compartment-id=${compartment_id} --display-name="mt-ocne-test" --availability-domain=${availability_domain} | jq -r '.data[] | ."private-ip-ids"[]'`
mt_private_ip=`oci network private-ip get --private-ip-id "${mt_privateip_id}" | jq -r '.data | ."ip-address"'`
mkdir -m777 -p ${result_root}
echo "Results will be in ${result_root}"
mkdir -m777 -p ${pv_root_parent}
sudo mount ${mt_private_ip}:/fs-ocne-test ${pv_root_parent}
mkdir -m777 -p ${pv_root}
echo "Persistent volume files, if any, will be in ${pv_root}"
echo "Create pv root for sample test in ${pv_root_for_sampletest}"
sudo mkdir -m777 -p ${pv_root_for_sampletest}
sudo mount ${mt_private_ip}:/fs-ocne-test ${pv_root_for_sampletest}
'''
}
}
stage('Populate kubeconfig file') {
steps {
sh '''
#################
k8s_master_instance_id=`oci compute instance list --compartment-id=${compartment_id} --display-name=ocne-new2 |jq -r '.data[]."id"'`
k8s_master_instance_private_ip=`oci compute instance list-vnics --compartment-id=${compartment_id} --instance-id=${k8s_master_instance_id} |jq -r '.data[]."private-ip"'`
echo "Generating kubeconfig file"
cat > $kubeconfig_file <<EOF
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUMvakNDQWVhZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJek1Ea3lNekF5TXpZeU1Gb1hEVE16TURreU1EQXlNell5TUZvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBT2NzCkxucXZreE56Y1ZIS292SW5mMXQ0OHJ1d3BQU215ZjE5NHMvdDB4OGllMnRhT25uRmNNUjhrT0E3eU5jL3h3eGEKQTl2RUNmL2xrOXZzVUNTSFZoa1pjYnpPU1JCUWRZampPSmFZNHZDd0RqVU5xc0lPeVhGU1EyWUROMFRwUUFJQwppMGZ6dmRqYytkREFkKzN6RmQvV2JBRzc0Z0JlZU0zZGxyenMvcGorZ2g3dzdMdlZ0Mjhra1hOTUUxNEFrTHV5Ck9SQXI1aHpVZ0txQ2dSSjIyTkxwc2xvSHpXL2w1WGVIa0F4OGU1YlZPbkREYmFidXFQZXNBVlIwYVdLb3BmWjUKTFFFUnU4WXhVcUREYXBsTVY5UTZCOXV2bDV0VEdzTmRjRXRqLzZWSnBEZ3RZTFJwc3FrdXZ1TDFEQVJubnNnagp1VGhRaDNGTTFkK3ZWK1FBYjE4Q0F3RUFBYU5aTUZjd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0hRWURWUjBPQkJZRUZKYm1QWmFRYWFDdVBUSUdGa1lUbDdxeXJTdE1NQlVHQTFVZEVRUU8KTUF5Q0NtdDFZbVZ5Ym1WMFpYTXdEUVlKS29aSWh2Y05BUUVMQlFBRGdnRUJBSUlmVmpzcHBCTCtrU2p4V2ZSNgpqbng2T1BkSElkY29PZ29SbllUc3E4cDlYK3JhMkRBaGdXMXhrbTJUcnBmai9VRzBiWEoyZHBuTFF4eU5YT05WCmN3SnA2SkxlODZ0T0k0UGRXKy9lTFZFdzRMWGRubHlLOGxGSzFLK1UzbUpPaGp6MDlvR0xhbEFJUndhSEY5UmkKRlltWXFFZUQ0OVJkUHljQXAyTFl0S1RUNitlRWV0U3o2eEo3VVp6OXo1ZU52dHB6L2dVWkQwZjhRbWduWm1EcwpKVk56Q2pJc2JsOXkxZFVaZGtITzIvaDU3d0tsdEF0TXlYN25ibDNoUG1OSmppR1AxcHBZeWNkMXRqK3JlV2MwCkVWQXVEazNxZlR6MjJBeno2TjVTYkRsRitXNGh0dEJRN2lPV21BUVRkVlRDWDJhTVZsT2dDUm10dU5ydTFiZ2MKTWpVPQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
server: https://${k8s_master_instance_private_ip}:6443
name: kubernetes
contexts:
- context:
cluster: kubernetes
user: kubernetes-admin
name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
kind: Config
preferences: {}
users:
- name: kubernetes-admin
user:
client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0t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9WYzNKNFcweHFUaThLMUd0dSsramhmCjViZDVkYlpZOEtPSW1tY3dpanp5SWFVQ2dZQkZsZFVoSWZ5a3MyZ2hTR3BmK1liR1M5SDNGaVZteXU3eDVZSkgKTWxRb3hHbnJLaDBFNXl5dS9hbS9HalNLWVg2cnVaeElUUDlaeWpRcU1PNlRvcHRMK0YrRDZwUVkzcjd1cThwcwpoVytQQzl4YlRvdUNDOTZxRlZIQUVoNm9ScmlpeG5HazhBRm1BQnU0Ri9QaFJMK1VJMFpzTC8yZWJmNGpkTTdDCnRZVXAwUUtCZ1FDNDgvUVlkcnQ3N1RZSm9JMmhXYVpKUkRmOER4NEwrbzByOE9CTlFteE1PYThmNS9SNjIra3kKelJsUHZvVG9qUW5Jamt3WjJtQWhtN2JYRVR0cVZkQnhCQUZaNFVrZGpnK0tKd09OZ1VaUzF4ck1uMnphMS9RbAoxT25Ib0h4dk5MYUxBS3RiVmhGWWQvK0NNRHFSdjJML2w3MngvZ2RMeG1Xbk9uRzNxeTFiOHc9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=
EOF
##################
echo "kubeconfig file: "
cat $kubeconfig_file
'''
}
}
stage('Run integration tests') {
environment {
runtime_path = "${WORKSPACE}/bin:${PATH}"
clusterName = "${CLUSTER_NAME}"
}
steps {
script {
currentBuild.description = "${GIT_BRANCH} ${MAVEN_PROFILE_NAME}"
def res = 0
res = sh(script: '''
if [ -z "${IT_TEST}" ] && [ "${MAVEN_PROFILE_NAME}" = "integration-tests" ]; then
echo 'ERROR: All tests cannot be run with integration-tests profile'
exit 1
fi
''', returnStatus: true)
if (res != 0 ) {
currentBuild.result = 'ABORTED'
error('Profile/ItTests Validation Failed')
}
}
withCredentials([
string(credentialsId: "${wko_files_bucket_token}", variable: 'WKO_BUCKET_TOKEN')
]) {
sh '''
if [ -z $WIT_DOWNLOAD_URL ]; then
WIT_DOWNLOAD_URL="https://objectstorage.${wko_region}.oraclecloud.com/p/${WKO_BUCKET_TOKEN}/n/${wko_tenancy}/b/wko-system-test-files/o/imagetool-main.zip"
fi
if [ -z $WDT_DOWNLOAD_URL ]; then
WDT_DOWNLOAD_URL="https://objectstorage.${wko_region}.oraclecloud.com/p/${WKO_BUCKET_TOKEN}/n/${wko_tenancy}/b/wko-system-test-files/o/weblogic-deploy-main.zip"
fi
export PATH=${runtime_path}
export OCI_CLI_PROFILE=${oci_profile}
compartment_ocid=${compartment_id}
mkdir -m777 -p "${WORKSPACE}/.mvn"
touch ${WORKSPACE}/.mvn/maven.config
export KUBECONFIG=${kubeconfig_file}
k8s_master_instance_id=`oci compute instance list --compartment-id=${compartment_id} --display-name=ocne-new2 |jq -r '.data[]."id"'`
k8s_master_instance_private_ip=`oci compute instance list-vnics --compartment-id=${compartment_id} --instance-id=${k8s_master_instance_id} |jq -r '.data[]."private-ip"'`
clusterIP=${k8s_master_instance_private_ip}
export NO_PROXY=$NO_PROXY,${clusterIP}
echo "NO_PROXY:" $NO_PROXY
export K8S_NODEPORT_HOST=${clusterIP}
if [ -n "${IT_TEST}" ]; then
echo "-Dit.test=\"${IT_TEST}\"" >> ${WORKSPACE}/.mvn/maven.config
fi
if [ "${MAVEN_PROFILE_NAME}" == "olcne-sequential" ]; then
PARALLEL_RUN='false'
fi
echo "MAVEN_PROFILE_NAME:" $MAVEN_PROFILE_NAME
echo "PARALLEL_RUN:" $PARALLEL_RUN
echo "-Dwko.it.wle.download.url=\"${wle_download_url}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "-Dwko.it.result.root=\"${result_root}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "-Dwko.it.pv.root=\"${pv_root}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "-Dwko.it.k8s.nodeport.host=\"${K8S_NODEPORT_HOST}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "-Dwko.it.nfs.server=\"${NFS_SERVER}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "-Dwko.it.istio.version=\"${ISTIO_VERSION}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "-DPARALLEL_CLASSES=\"${PARALLEL_RUN}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "-DNUMBER_OF_THREADS=\"${NUMBER_OF_THREADS}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "-Dwko.it.wdt.download.url=\"${WDT_DOWNLOAD_URL}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "-Dwko.it.wit.download.url=\"${WIT_DOWNLOAD_URL}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "-Dwko.it.base.images.repo=\"${BASE_IMAGES_REPO}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "-Dwko.it.base.images.tenancy=\"${wko_tenancy}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "-Dwko.it.test.images.repo=\"${TEST_IMAGES_REPO}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "-Dwko.it.test.images.tenancy=\"${wko_tenancy}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "-Dwko.it.weblogic.image.name=\"${WEBLOGIC_IMAGE_NAME}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "-Dwko.it.weblogic.image.tag=\"${WEBLOGIC_IMAGE_TAG}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "-Dwko.it.fmwinfra.image.name=\"${FMWINFRA_IMAGE_NAME}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "-Dwko.it.fmwinfra.image.tag=\"${FMWINFRA_IMAGE_TAG}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "-Dwko.it.db.image.name=\"${DB_IMAGE_NAME}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "-Dwko.it.db.image.tag=\"${DB_IMAGE_TAG}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "-Dwko.it.monitoring.exporter.branch=\"${MONITORING_EXPORTER_BRANCH}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "-Dwko.it.monitoring.exporter.webapp.version=\"${MONITORING_EXPORTER_WEBAPP_VERSION}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "-Dwko.it.prometheus.chart.version=\"${PROMETHEUS_CHART_VERSION}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "-Dwko.it.grafana.chart.version=\"${GRAFANA_CHART_VERSION}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "-Dwko.it.collect.logs.on.success=\"${COLLECT_LOGS_ON_SUCCESS}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "-Dwko.it.remoteconsole.version=\"${REMOTECONSOLE_VERSION}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "-DOPERATOR_LOG_LEVEL=\"${OPERATOR_LOG_LEVEL}\"" >> ${WORKSPACE}/.mvn/maven.config
echo "${WORKSPACE}/.mvn/maven.config contents:"
cat "${WORKSPACE}/.mvn/maven.config"
cp "${WORKSPACE}/.mvn/maven.config" "${result_root}"
'''
}
withMaven(globalMavenSettingsConfig: 'wkt-maven-settings-xml', publisherStrategy: 'EXPLICIT') {
withCredentials([
usernamePassword(credentialsId: "${ocir_creds}", usernameVariable: 'OCIR_USER', passwordVariable: 'OCIR_PASS')
]) {
sh '''
k8s_master_instance_id=`oci compute instance list --compartment-id=${compartment_id} --display-name=ocne-new2 |jq -r '.data[]."id"'`
k8s_master_instance_private_ip=`oci compute instance list-vnics --compartment-id=${compartment_id} --instance-id=${k8s_master_instance_id} |jq -r '.data[]."private-ip"'`
export HTTPS_PROXY='http://www-proxy-hqdc.us.oracle.com:80'
export https_proxy='http://www-proxy-hqdc.us.oracle.com:80'
export HTTP_PROXY='http://www-proxy-hqdc.us.oracle.com:80'
export http_proxy='http://www-proxy-hqdc.us.oracle.com:80'
export NO_PROXY="localhost,127.0.0.1,.us.oracle.com,.oraclecorp.com,/var/run/docker.sock,${k8s_master_instance_private_ip}"
export no_proxy="localhost,127.0.0.1,.us.oracle.com,.oraclecorp.com,/var/run/docker.sock,${k8s_master_instance_private_ip}"
export PATH=${runtime_path}
export OKE_CLUSTER="false"
export OCNE="true"
export OKD="false"
export KUBECONFIG=${kubeconfig_file}
export BASE_IMAGES_REPO_USERNAME="${OCIR_USER}"
export BASE_IMAGES_REPO_PASSWORD="${OCIR_PASS}"
export BASE_IMAGES_REPO_EMAIL="[email protected]"
export TEST_IMAGES_REPO_USERNAME="${OCIR_USER}"
export TEST_IMAGES_REPO_PASSWORD="${OCIR_PASS}"
export TEST_IMAGES_REPO_EMAIL="[email protected]"
if [[ -n "${IT_TEST}" && "${IT_TEST}" != "**/It*" ]]; then
echo 'Overriding MAVEN_PROFILE_NAME to integration-test when running individual test(s)'
export MAVEN_PROFILE_NAME="integration-tests"
fi
echo "MAVEN_PROFILE_NAME:" $MAVEN_PROFILE_NAME
if ! mvn -pl integration-tests -P ${MAVEN_PROFILE_NAME} verify 2>&1 | tee "${result_root}/oketest.log"; then
echo "integration-tests failed"
exit 1
fi
'''
}
}
}
post {
always {
sh '''
export PATH="${WORKSPACE}/bin:${PATH}"
export KUBECONFIG=${kubeconfig_file}
export OCI_CLI_PROFILE=${oci_profile}
mkdir -m777 -p ${result_root}/kubelogs
mkdir -m777 -p "${WORKSPACE}/logdir/${BUILD_TAG}/wl_k8s_test_results"
sudo mv -f ${result_root}/* "${WORKSPACE}/logdir/${BUILD_TAG}/wl_k8s_test_results"
'''
archiveArtifacts(artifacts:
"logdir/${BUILD_TAG}/wl_k8s_test_results/diagnostics/**/*,logdir/${BUILD_TAG}/wl_k8s_test_results/workdir/liftandshiftworkdir/**/*")
junit(testResults: 'integration-tests/target/failsafe-reports/*.xml', allowEmptyResults: true)
}
}
}
}
post {
always {
sh '''
export PATH="${WORKSPACE}/bin:${PATH}"
export KUBECONFIG=${kubeconfig_file}
rm -f ${jenkins_home_directory}/.oci/config
rm -f ${jenkins_home_directory}/.oci/oci-signing-key.pem
rm -f ${WORKSPACE}/.ssh/*
rm -rf ${WORKSPACE}/.mvn
sudo rm -rf ${pv_root}
sudo umount ${pv_root_parent}
sudo rm -rf ${pv_root_for_sampletest}/domains
sudo rm -rf ${pv_root_for_sampletest}/logs
sudo umount ${pv_root_for_sampletest}
kubectl delete pod $(kubectl get pod |grep recycler-for|awk '{print $1}') || true
'''
}
}
}
stage ('Sync') {
when {
anyOf {
branch 'main'
branch 'release/4.0'
branch 'release/3.4'
}
anyOf {
not { triggeredBy 'TimerTrigger' }
tag 'v*'
}
}
steps {
build job: "wkt-sync", parameters: [ string(name: 'REPOSITORY', value: 'weblogic-kubernetes-operator') ]
}
}
}
}