Romain Grecourt | f7e3a48 | 2018-11-20 00:47:09 -0800 | [diff] [blame] | 1 | /* |
arjantijms | 65dd03e | 2020-01-21 13:37:04 +0100 | [diff] [blame] | 2 | * Copyright (c) 2018-2020 Oracle and/or its affiliates. All rights reserved. |
Romain Grecourt | f7e3a48 | 2018-11-20 00:47:09 -0800 | [diff] [blame] | 3 | * |
| 4 | * This program and the accompanying materials are made available under the |
| 5 | * terms of the Eclipse Public License v. 2.0, which is available at |
| 6 | * http://www.eclipse.org/legal/epl-2.0. |
| 7 | * |
| 8 | * This Source Code may also be made available under the following Secondary |
| 9 | * Licenses when the conditions for such availability set forth in the |
| 10 | * Eclipse Public License v. 2.0 are satisfied: GNU General Public License, |
| 11 | * version 2 with the GNU Classpath Exception, which is available at |
| 12 | * https://www.gnu.org/software/classpath/license.html. |
| 13 | * |
| 14 | * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 |
| 15 | */ |
| 16 | |
| 17 | // list of test ids |
| 18 | def jobs = [ |
| 19 | "web_jsp", |
| 20 | //"web_servlet", |
| 21 | //"web_web-container", |
| 22 | //"web_group-1", |
| 23 | //"sqe_smoke_all", |
| 24 | //"security_all", |
| 25 | //"admin-cli-group-1", |
| 26 | //"admin-cli-group-2", |
| 27 | //"admin-cli-group-3", |
| 28 | //"admin-cli-group-4", |
| 29 | //"admin-cli-group-5", |
| 30 | "deployment_all", |
| 31 | //"deployment_cluster_all", |
| 32 | "ejb_group_1", |
| 33 | "ejb_group_2", |
| 34 | "ejb_group_3", |
| 35 | //"ejb_timer_cluster_all", |
| 36 | "ejb_web_all", |
| 37 | //"transaction-ee-1", |
| 38 | //"transaction-ee-2", |
| 39 | //"transaction-ee-3", |
| 40 | //"transaction-ee-4", |
| 41 | "cdi_all", |
| 42 | "ql_gf_full_profile_all", |
| 43 | "ql_gf_nucleus_all", |
| 44 | "ql_gf_web_profile_all", |
| 45 | // TODO fix this test suite (fails because of no test descriptor) |
| 46 | //"ql_gf_embedded_profile_all", |
| 47 | "nucleus_admin_all", |
| 48 | //"cts_smoke_group-1", |
| 49 | //"cts_smoke_group-2", |
| 50 | //"cts_smoke_group-3", |
| 51 | //"cts_smoke_group-4", |
| 52 | //"cts_smoke_group-5", |
| 53 | //"servlet_tck_servlet-api-servlet", |
| 54 | //"servlet_tck_servlet-api-servlet-http", |
| 55 | //"servlet_tck_servlet-compat", |
| 56 | //"servlet_tck_servlet-pluggability", |
| 57 | //"servlet_tck_servlet-spec", |
| 58 | //"findbugs_all", |
| 59 | //"findbugs_low_priority_all", |
| 60 | "jdbc_all", |
| 61 | //"jms_all", |
| 62 | //"copyright", |
| 63 | "batch_all", |
| 64 | //"naming_all", |
| 65 | "persistence_all", |
| 66 | //"webservice_all", |
| 67 | "connector_group_1", |
| 68 | "connector_group_2", |
| 69 | "connector_group_3", |
| 70 | "connector_group_4" |
| 71 | ] |
| 72 | |
| 73 | // the label is unique and identifies the pod descriptor and its resulting pods |
| 74 | // without this, the agent could be using a pod created from a different descriptor |
| 75 | env.label = "glassfish-ci-pod-${UUID.randomUUID().toString()}" |
| 76 | |
| 77 | def parallelStagesMap = jobs.collectEntries { |
| 78 | ["${it}": generateStage(it)] |
| 79 | } |
| 80 | |
| 81 | def generateStage(job) { |
| 82 | return { |
| 83 | podTemplate(label: env.label) { |
| 84 | node(label) { |
| 85 | stage("${job}") { |
| 86 | container('glassfish-ci') { |
Romain Grecourt | 0c4ae78 | 2018-11-21 14:32:26 -0800 | [diff] [blame] | 87 | // do the scm checkout |
Romain Grecourt | f7e3a48 | 2018-11-20 00:47:09 -0800 | [diff] [blame] | 88 | retry(10) { |
| 89 | sleep 60 |
Romain Grecourt | 0c4ae78 | 2018-11-21 14:32:26 -0800 | [diff] [blame] | 90 | checkout scm |
Romain Grecourt | f7e3a48 | 2018-11-20 00:47:09 -0800 | [diff] [blame] | 91 | } |
| 92 | // run the test |
| 93 | unstash 'build-bundles' |
| 94 | try { |
| 95 | retry(3) { |
| 96 | timeout(time: 2, unit: 'HOURS') { |
| 97 | sh "./appserver/tests/gftest.sh run_test ${job}" |
| 98 | } |
| 99 | } |
| 100 | } finally { |
| 101 | // archive what we can... |
| 102 | archiveArtifacts artifacts: "${job}-results.tar.gz" |
| 103 | junit testResults: 'results/junitreports/*.xml', allowEmptyResults: false |
| 104 | } |
| 105 | } |
| 106 | } |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | pipeline { |
| 113 | options { |
| 114 | // keep at most 50 builds |
| 115 | buildDiscarder(logRotator(numToKeepStr: '50')) |
| 116 | // preserve the stashes to allow re-running a test stage |
| 117 | preserveStashes() |
| 118 | // issue related to default 'implicit' checkout, disable it |
| 119 | skipDefaultCheckout() |
| 120 | // abort pipeline if previous stage is unstable |
| 121 | skipStagesAfterUnstable() |
| 122 | // show timestamps in logs |
| 123 | timestamps() |
| 124 | // global timeout, abort after 6 hours |
| 125 | timeout(time: 6, unit: 'HOURS') |
| 126 | } |
| 127 | agent { |
| 128 | kubernetes { |
| 129 | label "${env.label}" |
| 130 | defaultContainer 'glassfish-ci' |
| 131 | yaml """ |
| 132 | apiVersion: v1 |
| 133 | kind: Pod |
| 134 | metadata: |
| 135 | spec: |
Romain Grecourt | f7e3a48 | 2018-11-20 00:47:09 -0800 | [diff] [blame] | 136 | volumes: |
arjantijms | 937dc55 | 2020-01-24 18:41:39 +0100 | [diff] [blame] | 137 | - name: "jenkins-home" |
| 138 | emptyDir: {} |
| 139 | - name: maven-repo-shared-storage |
| 140 | persistentVolumeClaim: |
| 141 | claimName: glassfish-maven-repo-storage |
arjantijms | 65dd03e | 2020-01-21 13:37:04 +0100 | [diff] [blame] | 142 | - name: settings-xml |
| 143 | secret: |
| 144 | secretName: m2-secret-dir |
| 145 | items: |
| 146 | - key: settings.xml |
| 147 | path: settings.xml |
| 148 | - name: settings-security-xml |
| 149 | secret: |
| 150 | secretName: m2-secret-dir |
| 151 | items: |
| 152 | - key: settings-security.xml |
| 153 | path: settings-security.xml |
Romain Grecourt | f7e3a48 | 2018-11-20 00:47:09 -0800 | [diff] [blame] | 154 | - name: maven-repo-local-storage |
| 155 | emptyDir: {} |
Romain Grecourt | f7e3a48 | 2018-11-20 00:47:09 -0800 | [diff] [blame] | 156 | containers: |
| 157 | - name: jnlp |
| 158 | image: jenkins/jnlp-slave:alpine |
| 159 | imagePullPolicy: IfNotPresent |
| 160 | volumeMounts: |
| 161 | env: |
| 162 | - name: JAVA_TOOL_OPTIONS |
| 163 | value: -Xmx1G |
| 164 | resources: |
| 165 | limits: |
| 166 | memory: "1Gi" |
| 167 | cpu: "1" |
| 168 | - name: glassfish-ci |
RohitKumarJain | 43dc9b8 | 2020-02-13 08:14:15 +0000 | [diff] [blame] | 169 | image: ee4jglassfish/ci:tini-jdk-8.181 |
Romain Grecourt | f7e3a48 | 2018-11-20 00:47:09 -0800 | [diff] [blame] | 170 | args: |
| 171 | - cat |
| 172 | tty: true |
| 173 | imagePullPolicy: Always |
| 174 | volumeMounts: |
arjantijms | 937dc55 | 2020-01-24 18:41:39 +0100 | [diff] [blame] | 175 | - mountPath: "/home/jenkins" |
| 176 | name: "jenkins-home" |
| 177 | readOnly: false |
| 178 | - mountPath: /home/jenkins/.m2/repository |
| 179 | name: maven-repo-shared-storage |
arjantijms | 65dd03e | 2020-01-21 13:37:04 +0100 | [diff] [blame] | 180 | - name: settings-xml |
| 181 | mountPath: /home/jenkins/.m2/settings.xml |
| 182 | subPath: settings.xml |
| 183 | readOnly: true |
| 184 | - name: settings-security-xml |
| 185 | mountPath: /home/jenkins/.m2/settings-security.xml |
| 186 | subPath: settings-security.xml |
| 187 | readOnly: true |
Romain Grecourt | f7e3a48 | 2018-11-20 00:47:09 -0800 | [diff] [blame] | 188 | - mountPath: "/home/jenkins/.m2/repository/org/glassfish/main" |
| 189 | name: maven-repo-local-storage |
arjantijms | e93cce9 | 2020-01-22 13:42:36 +0100 | [diff] [blame] | 190 | env: |
| 191 | - name: "MAVEN_OPTS" |
| 192 | value: "-Duser.home=/home/jenkins" |
| 193 | - name: "MVN_EXTRA" |
| 194 | value: "--batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn" |
Romain Grecourt | f7e3a48 | 2018-11-20 00:47:09 -0800 | [diff] [blame] | 195 | resources: |
| 196 | limits: |
| 197 | memory: "7Gi" |
| 198 | cpu: "3" |
| 199 | """ |
| 200 | } |
| 201 | } |
| 202 | environment { |
arjantijms | 3cfb3a3 | 2020-02-18 23:13:47 +0100 | [diff] [blame] | 203 | S1AS_HOME = "${WORKSPACE}/glassfish6/glassfish" |
Romain Grecourt | f7e3a48 | 2018-11-20 00:47:09 -0800 | [diff] [blame] | 204 | APS_HOME = "${WORKSPACE}/appserver/tests/appserv-tests" |
| 205 | TEST_RUN_LOG = "${WORKSPACE}/tests-run.log" |
| 206 | GF_INTERNAL_ENV = credentials('gf-internal-env') |
| 207 | } |
| 208 | stages { |
| 209 | stage('build') { |
| 210 | agent { |
| 211 | kubernetes { |
| 212 | label "${env.label}" |
| 213 | } |
| 214 | } |
| 215 | steps { |
| 216 | container('glassfish-ci') { |
| 217 | timeout(time: 1, unit: 'HOURS') { |
| 218 | checkout scm |
Romain Grecourt | f7e3a48 | 2018-11-20 00:47:09 -0800 | [diff] [blame] | 219 | // do the build |
| 220 | sh ''' |
arjantijms | 65dd03e | 2020-01-21 13:37:04 +0100 | [diff] [blame] | 221 | echo Maven version |
| 222 | mvn -v |
| 223 | |
Romain Grecourt | f7e3a48 | 2018-11-20 00:47:09 -0800 | [diff] [blame] | 224 | bash -xe ./gfbuild.sh build_re_dev |
| 225 | ''' |
| 226 | archiveArtifacts artifacts: 'bundles/*.zip' |
| 227 | junit testResults: 'test-results/build-unit-tests/results/junitreports/test_results_junit.xml' |
| 228 | stash includes: 'bundles/*', name: 'build-bundles' |
| 229 | } |
| 230 | } |
| 231 | } |
| 232 | } |
| 233 | stage('tests') { |
| 234 | steps { |
| 235 | script { |
| 236 | parallel parallelStagesMap |
| 237 | } |
| 238 | } |
| 239 | } |
| 240 | } |
RohitKumarJain | 0b5633b | 2020-02-04 12:14:18 +0000 | [diff] [blame] | 241 | } |