@@ -4,7 +4,7 @@ pipeline {
44 }
55 agent any
66 tools {
7- maven ' maven-3.6.0 '
7+ maven ' maven-3.8.7 '
88 jdk ' jdk11'
99 }
1010
@@ -15,10 +15,10 @@ pipeline {
1515
1616 environment {
1717 // 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'
2222 }
2323
2424 stages {
@@ -33,39 +33,59 @@ pipeline {
3333 }
3434 stage (' Build' ) {
3535 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+ }
3739 }
3840 }
3941 stage (' Unit Tests' ) {
4042 when {
4143 not { changelog ' \\ [skip-ci\\ ].*' }
4244 }
4345 steps {
44- sh ' mvn test'
46+ withMaven(globalMavenSettingsConfig : ' wkt-maven-settings-xml' , publisherStrategy : ' EXPLICIT' ) {
47+ sh ' mvn -B test'
48+ }
4549 }
4650 post {
4751 always {
4852 junit ' imagetool/target/surefire-reports/*.xml'
4953 }
5054 }
5155 }
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' ) {
5376 when {
5477 anyOf {
55- changeRequest()
56- branch " main"
78+ changeRequest target : ' main'
79+ triggeredBy ' TimerTrigger'
80+ changelog ' \\ [full-mats\\ ].*'
5781 }
5882 }
59- tools {
60- maven ' maven-3.6.0'
61- jdk ' jdk11'
62- }
6383 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+ '''
6989 }
7090 }
7191 stage (' SystemTest Gate' ) {
@@ -77,17 +97,22 @@ pipeline {
7797 }
7898 }
7999 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+ }
85107 }
86108 }
87109 post {
88110 always {
89111 junit ' tests/target/failsafe-reports/*.xml'
90112 }
113+ failure {
114+ archiveArtifacts artifacts : ' tests/target/logs/*.*' , onlyIfSuccessful : ' false'
115+ }
91116 }
92117 }
93118 stage (' SystemTest Full' ) {
@@ -101,21 +126,25 @@ pipeline {
101126 script {
102127 docker. image(" ${ env.DB_IMAGE} " ). pull()
103128 }
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+ }
109136 }
110137 }
111138 post {
112139 always {
113140 junit ' tests/target/failsafe-reports/*.xml'
114141 }
115142 failure {
116- mail to : " ${ env.WIT_BUILD_NOTIFICATION_EMAIL_TO} " , from : ' noreply@oracle.com' ,
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} >"
119148 }
120149 }
121150 }
@@ -128,48 +157,48 @@ pipeline {
128157 }
129158 steps {
130159 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
132161 '''
133162 }
134163 }
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+ // }
155184 }
156185}
157186
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