-
Notifications
You must be signed in to change notification settings - Fork 90
/
Jenkinsfile
129 lines (128 loc) · 4.48 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
pipeline {
agent any
environment {
wdt_tenancy = "${env.WKT_TENANCY}"
alias_test_job_name = 'wdt-alias-test-verify'
jenkins_uid = sh(returnStdout: true, script: 'id -u').trim()
jenkins_gid = sh(returnStdout: true, script: 'id -g').trim()
docker_gid = sh(returnStdout: true, script: 'getent group docker | cut -d: -f3').trim()
}
triggers {
// timer trigger for "nightly build" on main branch
cron( env.BRANCH_NAME.equals('main') ? 'H H(2-3) * * 1-5' : '')
}
stages {
stage ('Environment') {
tools {
maven 'maven-3.9.5'
jdk 'jdk17'
}
steps {
sh 'env|sort'
sh 'mvn -v'
}
}
stage ('Build') {
tools {
maven 'maven-3.9.5'
jdk 'jdk17'
}
steps {
// Using Maven batch mode to suppress download progress lines in Jenkins output
//
withMaven(globalMavenSettingsConfig: 'wkt-maven-settings-xml', publisherStrategy: 'EXPLICIT') {
sh "mvn -B -DskipTests clean package"
}
}
}
stage ('Test') {
agent {
docker {
alwaysPull true
reuseNode true
image 'phx.ocir.io/devweblogic/wdt/jenkins-slave:12.2.1.3.0'
args "-u ${jenkins_uid}:${jenkins_gid} --group-add oracle --group-add opc -v /var/run/docker.sock:/var/run/docker.sock"
}
}
steps {
// Using Maven batch mode to suppress download progress lines in Jenkins output
//
sh 'mvn -B -Dunit-test-wlst-dir=${WLST_DIR} test'
}
post {
always {
junit 'core/target/surefire-reports/*.xml'
}
}
}
stage ('Verify') {
when {
anyOf {
changeRequest()
triggeredBy 'TimerTrigger'
tag "release-*"
}
}
agent {
docker {
alwaysPull true
reuseNode true
image "phx.ocir.io/${wdt_tenancy}/wdt/jenkins-slave:12.2.1.3.0"
args "-u ${jenkins_uid}:${docker_gid} --group-add oracle --group-add opc --group-add docker -v /var/run/docker.sock:/var/run/docker.sock"
}
}
steps {
// Using Maven batch mode to suppress download progress lines in Jenkins output
//
sh 'mvn -B -DskipITs=false -Dmw_home=${ORACLE_HOME} -Ddb.use.container.network=true install'
}
}
stage ('Sync') {
when {
branch 'main'
anyOf {
not { triggeredBy 'TimerTrigger' }
tag 'release-*'
}
}
steps {
build job: "wkt-sync", parameters: [ string(name: 'REPOSITORY', value: 'weblogic-deploy-tooling') ]
}
}
stage ('Alias Test') {
// only run this stage when triggered by a cron timer and the commit does not have []skip-ci in the message
// for example, only run integration tests during the timer triggered nightly build
when {
allOf {
triggeredBy 'TimerTrigger'
branch "main"
}
}
steps {
build job: "${alias_test_job_name}"
}
}
stage ('Save Nightly Installer'){
when {
allOf {
triggeredBy 'TimerTrigger'
branch "main"
}
}
steps {
sh '''
oci os object put --namespace=${wdt_tenancy} --bucket-name=wko-system-test-files --force \
--auth=instance_principal --file=installer/target/weblogic-deploy.zip \
--name=weblogic-deploy-main.zip
'''
}
}
}
post {
failure {
slackSend channel: '#wkt-build-failure-notifications',
botUser: false, color: 'danger',
message: "Build <${env.BUILD_URL}|${env.JOB_NAME}:${env.BUILD_NUMBER}> failed"
}
}
}