@@ -4,7 +4,7 @@ pipeline {
4
4
}
5
5
agent any
6
6
tools {
7
- maven ' maven-3.6.0 '
7
+ maven ' maven-3.8.7 '
8
8
jdk ' jdk11'
9
9
}
10
10
@@ -15,10 +15,10 @@ pipeline {
15
15
16
16
environment {
17
17
// variables for SystemTest stages (integration tests)
18
- STAGING_DIR = " /scratch/artifacts/imagetool "
19
- DB_IMAGE = " phx.ocir.io/weblogick8s /database/enterprise:12.2.0.1-slim"
20
- GITHUB_API_TOKEN = credentials(' encj_github_token' )
21
- GH_TOOL = tool name : ' github-cli' , type : ' com.cloudbees.jenkins.plugins.customtools.CustomTool'
18
+ STAGING_DIR = " ${ WORKSPACE } /wit-system-test-files "
19
+ DB_IMAGE = " ${ WKT_OCIR_HOST } / ${ WKT_TENANCY } /database/enterprise:12.2.0.1-slim"
20
+ // GITHUB_API_TOKEN = credentials('encj_github_token')
21
+ // GH_TOOL = tool name: 'github-cli', type: 'com.cloudbees.jenkins.plugins.customtools.CustomTool'
22
22
}
23
23
24
24
stages {
@@ -33,39 +33,59 @@ pipeline {
33
33
}
34
34
stage (' Build' ) {
35
35
steps {
36
- sh ' mvn -B -DskipTests -DskipITs clean install'
36
+ withMaven(globalMavenSettingsConfig : ' wkt-maven-settings-xml' , publisherStrategy : ' EXPLICIT' ) {
37
+ sh ' mvn -B -DskipTests -DskipITs clean install'
38
+ }
37
39
}
38
40
}
39
41
stage (' Unit Tests' ) {
40
42
when {
41
43
not { changelog ' \\ [skip-ci\\ ].*' }
42
44
}
43
45
steps {
44
- sh ' mvn test'
46
+ withMaven(globalMavenSettingsConfig : ' wkt-maven-settings-xml' , publisherStrategy : ' EXPLICIT' ) {
47
+ sh ' mvn -B test'
48
+ }
45
49
}
46
50
post {
47
51
always {
48
52
junit ' imagetool/target/surefire-reports/*.xml'
49
53
}
50
54
}
51
55
}
52
- stage (' Sonar Analysis' ) {
56
+ // stage ('Sonar Analysis') {
57
+ // when {
58
+ // anyOf {
59
+ // changeRequest()
60
+ // branch "main"
61
+ // }
62
+ // }
63
+ // tools {
64
+ // maven 'maven-3.8.7'
65
+ // jdk 'jdk11'
66
+ // }
67
+ // steps {
68
+ // withSonarQubeEnv('SonarCloud') {
69
+ // withCredentials([string(credentialsId: 'encj_github_token', variable: 'GITHUB_TOKEN')]) {
70
+ // runSonarScanner()
71
+ // }
72
+ // }
73
+ // }
74
+ // }
75
+ stage (' Download System Test Files' ) {
53
76
when {
54
77
anyOf {
55
- changeRequest()
56
- branch " main"
78
+ changeRequest target : ' main'
79
+ triggeredBy ' TimerTrigger'
80
+ changelog ' \\ [full-mats\\ ].*'
57
81
}
58
82
}
59
- tools {
60
- maven ' maven-3.6.0'
61
- jdk ' jdk11'
62
- }
63
83
steps {
64
- withSonarQubeEnv( ' SonarCloud ' ) {
65
- withCredentials([string( credentialsId : ' encj_github_token ' , variable : ' GITHUB_TOKEN ' )]) {
66
- runSonarScanner()
67
- }
68
- }
84
+ sh '''
85
+ rm -rf ${STAGING_DIR}
86
+ mkdir ${STAGING_DIR}
87
+ oci os object bulk-download --namespace devweblogic --bucket-name wit-system-test-files --config-file=/dev/null --auth=instance_principal --download-dir ${STAGING_DIR }
88
+ '''
69
89
}
70
90
}
71
91
stage (' SystemTest Gate' ) {
@@ -77,17 +97,22 @@ pipeline {
77
97
}
78
98
}
79
99
steps {
80
- withCredentials([[$class : ' UsernamePasswordMultiBinding' , credentialsId : ' otn-cred' , passwordVariable : ' ORACLE_SUPPORT_PASSWORD' , usernameVariable : ' ORACLE_SUPPORT_USERNAME' ]]) {
81
- sh '''
82
- cd tests
83
- mvn clean verify -Dtest.staging.dir=${STAGING_DIR} -Dtest.groups=gate -DskipITs=false
84
- '''
100
+ withCredentials([[$class : ' UsernamePasswordMultiBinding' , credentialsId : ' wkt-otn-credential' , passwordVariable : ' ORACLE_SUPPORT_PASSWORD' , usernameVariable : ' ORACLE_SUPPORT_USERNAME' ]]) {
101
+ withMaven(globalMavenSettingsConfig : ' wkt-maven-settings-xml' , publisherStrategy : ' EXPLICIT' ) {
102
+ sh '''
103
+ cd tests
104
+ mvn -B clean verify -Dtest.staging.dir=${STAGING_DIR} -Dtest.groups=gate -DskipITs=false
105
+ '''
106
+ }
85
107
}
86
108
}
87
109
post {
88
110
always {
89
111
junit ' tests/target/failsafe-reports/*.xml'
90
112
}
113
+ failure {
114
+ archiveArtifacts artifacts : ' tests/target/logs/*.*' , onlyIfSuccessful : ' false'
115
+ }
91
116
}
92
117
}
93
118
stage (' SystemTest Full' ) {
@@ -101,21 +126,25 @@ pipeline {
101
126
script {
102
127
docker. image(" ${ env.DB_IMAGE} " ). pull()
103
128
}
104
- withCredentials([[$class : ' UsernamePasswordMultiBinding' , credentialsId : ' otn-cred' , passwordVariable : ' ORACLE_SUPPORT_PASSWORD' , usernameVariable : ' ORACLE_SUPPORT_USERNAME' ]]) {
105
- sh '''
106
- cd tests
107
- mvn clean verify -Dtest.staging.dir=${STAGING_DIR} -Dtest.groups=gate,nightly -DskipITs=false
108
- '''
129
+ withCredentials([[$class : ' UsernamePasswordMultiBinding' , credentialsId : ' wkt-otn-credential' , passwordVariable : ' ORACLE_SUPPORT_PASSWORD' , usernameVariable : ' ORACLE_SUPPORT_USERNAME' ]]) {
130
+ withMaven(globalMavenSettingsConfig : ' wkt-maven-settings-xml' , publisherStrategy : ' EXPLICIT' ) {
131
+ sh '''
132
+ cd tests
133
+ mvn -B clean verify -Dtest.staging.dir=${STAGING_DIR} -Dtest.groups=gate,nightly -DskipITs=false
134
+ '''
135
+ }
109
136
}
110
137
}
111
138
post {
112
139
always {
113
140
junit ' tests/target/failsafe-reports/*.xml'
114
141
}
115
142
failure {
116
- mail
to :
" ${ env.WIT_BUILD_NOTIFICATION_EMAIL_TO} " ,
from :
' [email protected] ' ,
117
- subject : " WebLogic Image Tool: ${ env.JOB_NAME} - Failed" ,
118
- body : " Job Failed - \" ${ env.JOB_NAME} \" build: ${ env.BUILD_NUMBER} \n\n View the log at:\n ${ env.BUILD_URL} \n "
143
+ // save logs for debugging test failures
144
+ archiveArtifacts artifacts : ' tests/target/logs/*.*' , onlyIfSuccessful : ' false'
145
+ // notify staff when nightly builds fail
146
+ slackSend channel : ' #wkt-build-failure-notifications' , botUser : false , color : ' danger' ,
147
+ message : " Build failed. WebLogic Image Tool: <${ env.BUILD_URL} |${ env.JOB_NAME} :${ env.BUILD_NUMBER} >"
119
148
}
120
149
}
121
150
}
@@ -128,48 +157,48 @@ pipeline {
128
157
}
129
158
steps {
130
159
sh '''
131
- oci os object put --namespace=weblogick8s --bucket-name=wko-system-test-files --config-file=/dev/null --auth=instance_principal --force --file=installer/target/imagetool.zip --name=imagetool-main.zip
160
+ oci os object put --namespace=${WKT_TENANCY} --bucket-name=wko-system-test-files --config-file=/dev/null --auth=instance_principal --force --file=installer/target/imagetool.zip --name=imagetool-main.zip
132
161
'''
133
162
}
134
163
}
135
- stage (' Create Draft Release' ) {
136
- when {
137
- tag ' release-*'
138
- }
139
- steps {
140
- script {
141
- env. TAG_VERSION_NUMBER = env. TAG_NAME . replaceAll(' release-' ,' ' ). trim()
142
- }
143
-
144
- sh """
145
- echo '${ env.GITHUB_API_TOKEN} ' | ${ GH_TOOL} /bin/gh auth login --with-token
146
- ${ GH_TOOL} /bin/gh release create ${ TAG_NAME} \
147
- --draft \
148
- --generate-notes \
149
- --title 'WebLogic Image Tool ${ TAG_VERSION_NUMBER} ' \
150
- --repo https://github.com/oracle/weblogic-image-tool \
151
- installer/target/imagetool.zip
152
- """
153
- }
154
- }
164
+ // stage ('Create Draft Release') {
165
+ // when {
166
+ // tag 'release-*'
167
+ // }
168
+ // steps {
169
+ // script {
170
+ // env.TAG_VERSION_NUMBER = env.TAG_NAME.replaceAll('release-','').trim()
171
+ // }
172
+ //
173
+ // sh """
174
+ // echo '${env.GITHUB_API_TOKEN}' | ${GH_TOOL}/bin/gh auth login --with-token
175
+ // ${GH_TOOL}/bin/gh release create ${TAG_NAME} \
176
+ // --draft \
177
+ // --generate-notes \
178
+ // --title 'WebLogic Image Tool ${TAG_VERSION_NUMBER}' \
179
+ // --repo https://github.com/oracle/weblogic-image-tool \
180
+ // installer/target/imagetool.zip
181
+ // """
182
+ // }
183
+ // }
155
184
}
156
185
}
157
186
158
- void runSonarScanner () {
159
- def changeUrl = env. GIT_URL . split(" /" )
160
- def org = changeUrl[3 ]
161
- def repo = changeUrl[4 ]. substring(0 , changeUrl[4 ]. length() - 4 )
162
- if (env. CHANGE_ID != null ) {
163
- sh " mvn -B sonar:sonar \
164
- -Dsonar.projectKey=${ org} _${ repo} \
165
- -Dsonar.pullrequest.provider=GitHub \
166
- -Dsonar.pullrequest.github.repository=${ org} /${ repo} \
167
- -Dsonar.pullrequest.key=${ env.CHANGE_ID} \
168
- -Dsonar.pullrequest.branch=${ env.CHANGE_BRANCH} \
169
- -Dsonar.pullrequest.base=${ env.CHANGE_TARGET} "
170
- } else {
171
- sh " mvn -B sonar:sonar \
172
- -Dsonar.projectKey=${ org} _${ repo} \
173
- -Dsonar.branch.name=${ env.BRANCH_NAME} "
174
- }
175
- }
187
+ // void runSonarScanner() {
188
+ // def changeUrl = env.GIT_URL.split("/")
189
+ // def org = changeUrl[3]
190
+ // def repo = changeUrl[4].substring(0, changeUrl[4].length() - 4)
191
+ // if (env.CHANGE_ID != null) {
192
+ // sh "mvn -B sonar:sonar \
193
+ // -Dsonar.projectKey=${org}_${repo} \
194
+ // -Dsonar.pullrequest.provider=GitHub \
195
+ // -Dsonar.pullrequest.github.repository=${org}/${repo} \
196
+ // -Dsonar.pullrequest.key=${env.CHANGE_ID} \
197
+ // -Dsonar.pullrequest.branch=${env.CHANGE_BRANCH} \
198
+ // -Dsonar.pullrequest.base=${env.CHANGE_TARGET}"
199
+ // } else {
200
+ // sh "mvn -B sonar:sonar \
201
+ // -Dsonar.projectKey=${org}_${repo} \
202
+ // -Dsonar.branch.name=${env.BRANCH_NAME}"
203
+ // }
204
+ // }
0 commit comments