2021-07-06 06:55:10 -04:00
|
|
|
/*
|
|
|
|
* Hibernate, Relational Persistence for Idiomatic Java
|
|
|
|
*
|
|
|
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
|
|
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
import groovy.transform.Field
|
|
|
|
|
|
|
|
/*
|
|
|
|
* See https://github.com/hibernate/hibernate-jenkins-pipeline-helpers
|
|
|
|
*/
|
|
|
|
@Library('hibernate-jenkins-pipeline-helpers@1.5') _
|
|
|
|
import org.hibernate.jenkins.pipeline.helpers.job.JobHelper
|
|
|
|
|
|
|
|
@Field final String NODE_PATTERN_BASE = 'Worker&&Containers'
|
|
|
|
@Field List<BuildEnvironment> environments
|
|
|
|
|
|
|
|
this.helper = new JobHelper(this)
|
|
|
|
|
|
|
|
helper.runWithNotification {
|
2022-04-06 12:52:56 -04:00
|
|
|
def defaultJdk = '11'
|
2021-07-06 06:55:10 -04:00
|
|
|
stage('Configure') {
|
|
|
|
this.environments = [
|
2022-04-06 12:52:56 -04:00
|
|
|
// buildEnv(defaultJdk, 'h2'),
|
|
|
|
// buildEnv(defaultJdk, 'hsqldb'),
|
|
|
|
// buildEnv(defaultJdk, 'derby'),
|
|
|
|
// buildEnv(defaultJdk, 'mysql8'),
|
|
|
|
// buildEnv(defaultJdk, 'mariadb'),
|
|
|
|
// buildEnv(defaultJdk, 'postgresql_9_5'),
|
|
|
|
// buildEnv(defaultJdk, 'postgresql_13'),
|
|
|
|
// buildEnv(defaultJdk, 'oracle'),
|
|
|
|
buildEnv(defaultJdk, 'oracle_ee'),
|
|
|
|
// buildEnv(defaultJdk, 'db2'),
|
|
|
|
// buildEnv(defaultJdk, 'mssql'),
|
|
|
|
// buildEnv(defaultJdk, 'sybase'),
|
|
|
|
buildEnv(defaultJdk, 'hana', 'HANA'),
|
|
|
|
buildEnv(defaultJdk, 's390x', 's390x'),
|
|
|
|
buildEnv(defaultJdk, 'tidb', 'tidb', 'tidb_hibernate@pingcap.com'),
|
2021-07-29 10:15:53 -04:00
|
|
|
// Disable EDB for now as the image is not available anymore
|
2022-04-06 12:52:56 -04:00
|
|
|
// buildEnv(defaultJdk, 'edb')
|
2022-04-07 15:17:01 -04:00
|
|
|
jdkBuildEnv(defaultJdk, '17', 'yoann@hibernate.org sanne@hibernate.org'),
|
|
|
|
jdkBuildEnv(defaultJdk, '18', 'yoann@hibernate.org sanne@hibernate.org'),
|
|
|
|
jdkBuildEnv(defaultJdk, '19', 'yoann@hibernate.org sanne@hibernate.org'),
|
2021-07-06 06:55:10 -04:00
|
|
|
];
|
|
|
|
|
|
|
|
helper.configure {
|
|
|
|
file 'job-configuration.yaml'
|
|
|
|
// We don't require the following, but the build helper plugin apparently does
|
|
|
|
jdk {
|
2022-04-06 12:52:56 -04:00
|
|
|
defaultTool "OpenJDK ${defaultJdk} Latest"
|
2021-07-06 06:55:10 -04:00
|
|
|
}
|
|
|
|
maven {
|
|
|
|
defaultTool 'Apache Maven 3.8'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
properties([
|
|
|
|
buildDiscarder(
|
2022-02-07 12:16:07 -05:00
|
|
|
logRotator(daysToKeepStr: '30', numToKeepStr: '10')
|
2021-07-06 06:55:10 -04:00
|
|
|
),
|
2022-02-04 04:25:58 -05:00
|
|
|
// If two builds are about the same branch or pull request,
|
|
|
|
// the older one will be aborted when the newer one starts.
|
|
|
|
disableConcurrentBuilds(abortPrevious: true),
|
2021-07-06 06:55:10 -04:00
|
|
|
helper.generateNotificationProperty()
|
|
|
|
])
|
|
|
|
}
|
|
|
|
|
2022-03-25 10:36:38 -04:00
|
|
|
// Avoid running the pipeline on branch indexing
|
|
|
|
if (currentBuild.getBuildCauses().toString().contains('BranchIndexingCause')) {
|
|
|
|
print "INFO: Build skipped due to trigger being Branch Indexing"
|
|
|
|
currentBuild.result = 'ABORTED'
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2021-07-06 06:55:10 -04:00
|
|
|
stage('Build') {
|
|
|
|
Map<String, Closure> executions = [:]
|
2022-04-08 04:39:36 -04:00
|
|
|
Map<String, Map<String, String>> state = [:]
|
2021-07-06 06:55:10 -04:00
|
|
|
environments.each { BuildEnvironment buildEnv ->
|
2022-04-06 12:52:56 -04:00
|
|
|
// Don't build environments for newer JDKs when this is a PR
|
2022-04-08 04:39:36 -04:00
|
|
|
if ( buildEnv.getVersion() != defaultJdk ) {
|
2022-04-07 15:17:01 -04:00
|
|
|
if ( helper.scmSource.pullRequest ) {
|
|
|
|
return
|
|
|
|
}
|
2022-04-06 12:52:56 -04:00
|
|
|
}
|
2022-04-08 05:13:30 -04:00
|
|
|
state[buildEnv.tag] = [:]
|
|
|
|
env[buildEnv.tag + '_status'] = null;
|
2021-07-06 06:55:10 -04:00
|
|
|
executions.put(buildEnv.tag, {
|
|
|
|
runBuildOnNode(buildEnv.node) {
|
2021-10-20 06:15:44 -04:00
|
|
|
// Use withEnv instead of setting env directly, as that is global!
|
|
|
|
// See https://github.com/jenkinsci/pipeline-plugin/blob/master/TUTORIAL.md
|
2022-04-07 15:17:01 -04:00
|
|
|
withEnv(["JAVA_HOME=${tool buildEnv.buildJdkTool}", "PATH+JAVA=${tool buildEnv.buildJdkTool}/bin", "TEST_JAVA_HOME=${tool buildEnv.testJdkTool}"]) {
|
2022-04-08 04:39:36 -04:00
|
|
|
if ( buildEnv.getVersion() != defaultJdk ) {
|
|
|
|
state[buildEnv.tag]['additionalOptions'] = " -Ptest.jdk.version=${buildEnv.getTestVersion()} -Porg.gradle.java.installations.paths=${JAVA_HOME},${TEST_JAVA_HOME}";
|
2022-04-07 15:17:01 -04:00
|
|
|
}
|
2022-04-08 04:39:36 -04:00
|
|
|
else {
|
|
|
|
state[buildEnv.tag]['additionalOptions'] = "";
|
|
|
|
}
|
|
|
|
state[buildEnv.tag]['containerName'] = null;
|
2021-10-20 06:15:44 -04:00
|
|
|
stage('Checkout') {
|
|
|
|
checkout scm
|
2021-07-06 06:55:10 -04:00
|
|
|
}
|
2021-10-20 06:15:44 -04:00
|
|
|
try {
|
|
|
|
stage('Start database') {
|
|
|
|
switch (buildEnv.dbName) {
|
|
|
|
case "mysql8":
|
|
|
|
docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') {
|
|
|
|
docker.image('mysql:8.0.21').pull()
|
|
|
|
}
|
|
|
|
sh "./docker_db.sh mysql_8_0"
|
2022-04-08 04:39:36 -04:00
|
|
|
state[buildEnv.tag]['containerName'] = "mysql"
|
2021-10-20 06:15:44 -04:00
|
|
|
break;
|
|
|
|
case "mariadb":
|
|
|
|
docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') {
|
|
|
|
docker.image('mariadb:10.5.8').pull()
|
|
|
|
}
|
|
|
|
sh "./docker_db.sh mariadb"
|
2022-04-08 04:39:36 -04:00
|
|
|
state[buildEnv.tag]['containerName'] = "mariadb"
|
2021-10-20 06:15:44 -04:00
|
|
|
break;
|
|
|
|
case "postgresql_9_5":
|
|
|
|
// use the postgis image to enable the PGSQL GIS (spatial) extension
|
|
|
|
docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') {
|
|
|
|
docker.image('postgis/postgis:9.5-2.5').pull()
|
|
|
|
}
|
|
|
|
sh "./docker_db.sh postgresql_9_5"
|
2022-04-08 04:39:36 -04:00
|
|
|
state[buildEnv.tag]['containerName'] = "postgres"
|
2021-10-20 06:15:44 -04:00
|
|
|
break;
|
|
|
|
case "postgresql_13":
|
|
|
|
// use the postgis image to enable the PGSQL GIS (spatial) extension
|
|
|
|
docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') {
|
|
|
|
docker.image('postgis/postgis:13-3.1').pull()
|
|
|
|
}
|
|
|
|
sh "./docker_db.sh postgresql_13"
|
2022-04-08 04:39:36 -04:00
|
|
|
state[buildEnv.tag]['containerName'] = "postgres"
|
2021-10-20 06:15:44 -04:00
|
|
|
break;
|
|
|
|
case "oracle":
|
|
|
|
docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') {
|
|
|
|
docker.image('quillbuilduser/oracle-18-xe').pull()
|
|
|
|
}
|
2022-04-06 12:52:56 -04:00
|
|
|
sh "./docker_db.sh oracle_18"
|
2022-04-08 04:39:36 -04:00
|
|
|
state[buildEnv.tag]['containerName'] = "oracle"
|
2021-10-20 06:15:44 -04:00
|
|
|
break;
|
|
|
|
case "db2":
|
|
|
|
docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') {
|
2021-12-20 11:21:13 -05:00
|
|
|
docker.image('ibmcom/db2:11.5.7.0').pull()
|
2021-10-20 06:15:44 -04:00
|
|
|
}
|
|
|
|
sh "./docker_db.sh db2"
|
2022-04-08 04:39:36 -04:00
|
|
|
state[buildEnv.tag]['containerName'] = "db2"
|
2021-10-20 06:15:44 -04:00
|
|
|
break;
|
|
|
|
case "mssql":
|
|
|
|
docker.image('mcr.microsoft.com/mssql/server:2017-CU13').pull()
|
|
|
|
sh "./docker_db.sh mssql"
|
2022-04-08 04:39:36 -04:00
|
|
|
state[buildEnv.tag]['containerName'] = "mssql"
|
2021-10-20 06:15:44 -04:00
|
|
|
break;
|
|
|
|
case "sybase":
|
|
|
|
docker.withRegistry('https://index.docker.io/v1/', 'hibernateci.hub.docker.com') {
|
|
|
|
docker.image('nguoianphu/docker-sybase').pull()
|
|
|
|
}
|
|
|
|
sh "./docker_db.sh sybase"
|
2022-04-08 04:39:36 -04:00
|
|
|
state[buildEnv.tag]['containerName'] = "sybase"
|
2021-10-20 06:15:44 -04:00
|
|
|
break;
|
|
|
|
case "edb":
|
|
|
|
docker.withRegistry('https://containers.enterprisedb.com', 'hibernateci.containers.enterprisedb.com') {
|
|
|
|
// withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'hibernateci.containers.enterprisedb.com',
|
|
|
|
// usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
|
|
|
|
// sh 'docker login -u "$USERNAME" -p "$PASSWORD" https://containers.enterprisedb.com'
|
|
|
|
docker.image('containers.enterprisedb.com/edb/edb-as-lite:v11').pull()
|
|
|
|
}
|
|
|
|
sh "./docker_db.sh edb"
|
2022-04-08 04:39:36 -04:00
|
|
|
state[buildEnv.tag]['containerName'] = "edb"
|
2021-10-20 06:15:44 -04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Test') {
|
|
|
|
switch (buildEnv.dbName) {
|
|
|
|
case "h2":
|
|
|
|
case "derby":
|
|
|
|
case "hsqldb":
|
2022-04-08 04:39:36 -04:00
|
|
|
runTest("-Pdb=${buildEnv.dbName}${state[buildEnv.tag]['additionalOptions']}")
|
2021-10-20 06:15:44 -04:00
|
|
|
break;
|
|
|
|
case "mysql8":
|
2022-04-08 04:39:36 -04:00
|
|
|
runTest("-Pdb=mysql_ci${state[buildEnv.tag]['additionalOptions']}")
|
2021-10-20 06:15:44 -04:00
|
|
|
break;
|
|
|
|
case "tidb":
|
2022-04-08 04:39:36 -04:00
|
|
|
runTest("-Pdb=tidb -DdbHost=localhost:4000${state[buildEnv.tag]['additionalOptions']}", 'TIDB')
|
2021-10-20 06:15:44 -04:00
|
|
|
break;
|
|
|
|
case "postgresql_9_5":
|
|
|
|
case "postgresql_13":
|
2022-04-08 04:39:36 -04:00
|
|
|
runTest("-Pdb=pgsql_ci${state[buildEnv.tag]['additionalOptions']}")
|
2021-10-20 06:15:44 -04:00
|
|
|
break;
|
|
|
|
case "oracle":
|
2022-04-08 04:39:36 -04:00
|
|
|
runTest("-Pdb=oracle_ci -PexcludeTests=**.LockTest.testQueryTimeout*${state[buildEnv.tag]['additionalOptions']}")
|
2021-10-20 06:15:44 -04:00
|
|
|
break;
|
|
|
|
case "oracle_ee":
|
2022-04-08 04:39:36 -04:00
|
|
|
runTest("-Pdb=oracle_jenkins${state[buildEnv.tag]['additionalOptions']}", 'ORACLE_RDS')
|
2021-10-20 06:15:44 -04:00
|
|
|
break;
|
|
|
|
case "hana":
|
2022-04-08 04:39:36 -04:00
|
|
|
runTest("-Pdb=hana_jenkins${state[buildEnv.tag]['additionalOptions']}", 'HANA')
|
2021-10-20 06:15:44 -04:00
|
|
|
break;
|
|
|
|
case "edb":
|
2022-04-08 04:39:36 -04:00
|
|
|
runTest("-Pdb=edb_ci -DdbHost=localhost:5433${state[buildEnv.tag]['additionalOptions']}")
|
2021-10-20 06:15:44 -04:00
|
|
|
break;
|
|
|
|
case "s390x":
|
2022-04-08 04:39:36 -04:00
|
|
|
runTest("-Pdb=h2${state[buildEnv.tag]['additionalOptions']}")
|
2021-10-20 06:15:44 -04:00
|
|
|
break;
|
|
|
|
default:
|
2022-04-08 04:39:36 -04:00
|
|
|
runTest("-Pdb=${buildEnv.dbName}_ci${state[buildEnv.tag]['additionalOptions']}")
|
2021-10-20 06:15:44 -04:00
|
|
|
break;
|
|
|
|
}
|
2022-04-08 05:59:39 -04:00
|
|
|
env[buildEnv.tag + '_status'] = currentBuild.result;
|
2021-07-06 06:55:10 -04:00
|
|
|
}
|
|
|
|
}
|
2021-10-20 06:15:44 -04:00
|
|
|
finally {
|
2022-04-08 04:39:36 -04:00
|
|
|
if ( state[buildEnv.tag]['containerName'] != null ) {
|
|
|
|
sh "docker rm -f ${state[buildEnv.tag]['containerName']}"
|
2021-10-20 06:15:44 -04:00
|
|
|
}
|
2021-10-25 04:17:36 -04:00
|
|
|
// Skip this for PRs
|
|
|
|
if ( !env.CHANGE_ID && buildEnv.notificationRecipients != null ) {
|
2022-04-08 04:39:36 -04:00
|
|
|
handleNotifications(currentBuild, buildEnv)
|
2021-10-20 06:15:44 -04:00
|
|
|
}
|
2021-07-06 06:55:10 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
parallel(executions)
|
|
|
|
}
|
|
|
|
|
|
|
|
} // End of helper.runWithNotification
|
|
|
|
|
|
|
|
// Job-specific helpers
|
|
|
|
|
|
|
|
BuildEnvironment buildEnv(String version, String dbName) {
|
2022-04-07 15:17:01 -04:00
|
|
|
return new BuildEnvironment( version, version, dbName, NODE_PATTERN_BASE, null );
|
2021-07-06 06:55:10 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
BuildEnvironment buildEnv(String version, String dbName, String node) {
|
2022-04-07 15:17:01 -04:00
|
|
|
return new BuildEnvironment( version, version, dbName, node, null );
|
2021-10-20 06:15:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
BuildEnvironment buildEnv(String version, String dbName, String node, String notificationRecipients) {
|
2022-04-07 15:17:01 -04:00
|
|
|
return new BuildEnvironment( version, version, dbName, node, notificationRecipients );
|
|
|
|
}
|
|
|
|
|
|
|
|
BuildEnvironment jdkBuildEnv(String version, String testVersion, String notificationRecipients) {
|
2022-04-08 05:13:30 -04:00
|
|
|
return new BuildEnvironment( version,testVersion, "h2", NODE_PATTERN_BASE, notificationRecipients );
|
2021-07-06 06:55:10 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public class BuildEnvironment {
|
|
|
|
private String version;
|
2022-04-07 15:17:01 -04:00
|
|
|
private String testVersion;
|
2021-07-06 06:55:10 -04:00
|
|
|
private String buildJdkTool;
|
|
|
|
private String testJdkTool;
|
|
|
|
private String dbName;
|
|
|
|
private String node;
|
2021-10-20 06:15:44 -04:00
|
|
|
private String notificationRecipients;
|
2021-07-06 06:55:10 -04:00
|
|
|
|
2022-04-07 15:17:01 -04:00
|
|
|
public BuildEnvironment(String version, String testVersion, String dbName, String node, String notificationRecipients) {
|
2021-07-06 06:55:10 -04:00
|
|
|
this.version = version;
|
2022-04-07 15:17:01 -04:00
|
|
|
this.testVersion = testVersion;
|
2021-07-06 06:55:10 -04:00
|
|
|
this.dbName = dbName;
|
|
|
|
this.node = node;
|
2021-10-20 06:15:44 -04:00
|
|
|
this.notificationRecipients = notificationRecipients;
|
2022-04-07 15:17:01 -04:00
|
|
|
this.buildJdkTool = "OpenJDK ${version} Latest";
|
|
|
|
this.testJdkTool = "OpenJDK ${testVersion} Latest";
|
2021-07-06 06:55:10 -04:00
|
|
|
}
|
|
|
|
String toString() { getTag() }
|
2022-04-08 05:13:30 -04:00
|
|
|
String getTag() { "jdk_${testVersion}_${dbName}" }
|
2021-07-06 06:55:10 -04:00
|
|
|
String getNode() { node }
|
2022-04-06 12:52:56 -04:00
|
|
|
String getVersion() { version }
|
2022-04-07 15:17:01 -04:00
|
|
|
String getTestVersion() { testVersion }
|
2021-10-20 06:15:44 -04:00
|
|
|
String getNotificationRecipients() { notificationRecipients }
|
2021-07-06 06:55:10 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void runBuildOnNode(String label, Closure body) {
|
|
|
|
node( label ) {
|
|
|
|
pruneDockerContainers()
|
|
|
|
try {
|
2021-10-20 06:15:44 -04:00
|
|
|
timeout( [time: 120, unit: 'MINUTES'], body )
|
2021-07-06 06:55:10 -04:00
|
|
|
}
|
|
|
|
finally {
|
2021-08-05 05:33:43 -04:00
|
|
|
// If this is a PR, we clean the workspace at the end
|
|
|
|
if ( env.CHANGE_BRANCH != null ) {
|
|
|
|
cleanWs()
|
|
|
|
}
|
2021-07-06 06:55:10 -04:00
|
|
|
pruneDockerContainers()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void pruneDockerContainers() {
|
2021-10-12 08:58:19 -04:00
|
|
|
if ( !sh( script: 'command -v docker || true', returnStdout: true ).trim().isEmpty() ) {
|
2021-07-06 06:55:10 -04:00
|
|
|
sh 'docker container prune -f || true'
|
|
|
|
sh 'docker image prune -f || true'
|
|
|
|
sh 'docker network prune -f || true'
|
|
|
|
sh 'docker volume prune -f || true'
|
|
|
|
}
|
2021-10-12 08:58:19 -04:00
|
|
|
}
|
|
|
|
// Clean by default otherwise the PackagedEntityManager tests fail on a node that previously ran a different DB
|
|
|
|
void runTest(String goal, String lockableResource = null, boolean clean = true) {
|
|
|
|
String cmd = "./gradlew" + (clean ? " clean" : "") + " check ${goal} -Plog-test-progress=true --stacktrace";
|
|
|
|
try {
|
|
|
|
if (lockableResource == null) {
|
|
|
|
sh cmd
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
lock(lockableResource) {
|
|
|
|
sh cmd
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
finally {
|
2022-04-08 05:13:30 -04:00
|
|
|
junit '**/target/test-results/test/*.xml,**/target/test-results/testKitTest/*.xml'
|
2021-10-12 08:58:19 -04:00
|
|
|
}
|
2022-04-08 04:39:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void handleNotifications(currentBuild, buildEnv) {
|
2022-04-08 05:13:30 -04:00
|
|
|
def currentResult = env[buildEnv.tag + '_status']
|
|
|
|
boolean success = currentResult == 'SUCCESS'
|
|
|
|
def previousResult = currentBuild.previousBuild == null ? null : currentBuild.previousBuild.buildVariables[buildEnv.tag + '_status']
|
2022-04-08 04:39:36 -04:00
|
|
|
|
|
|
|
// Ignore success after success
|
2022-04-08 05:13:30 -04:00
|
|
|
if ( !( success && previousSuccess ) ) {
|
2022-04-08 04:39:36 -04:00
|
|
|
def subject
|
|
|
|
def body
|
|
|
|
if ( success ) {
|
|
|
|
if ( previousResult != 'SUCCESS' && previousResult != null ) {
|
|
|
|
subject = "${env.JOB_NAME} - Build ${env.BUILD_NUMBER} - Fixed"
|
|
|
|
body = """<p>${env.JOB_NAME} - Build ${env.BUILD_NUMBER} - Fixed:</p>
|
|
|
|
<p>Check console output at <a href='${env.BUILD_URL}'>${env.BUILD_URL}</a> to view the results.</p>"""
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
subject = "${env.JOB_NAME} - Build ${env.BUILD_NUMBER} - Success"
|
|
|
|
body = """<p>${env.JOB_NAME} - Build ${env.BUILD_NUMBER} - Success:</p>
|
|
|
|
<p>Check console output at <a href='${env.BUILD_URL}'>${env.BUILD_URL}</a> to view the results.</p>"""
|
|
|
|
}
|
|
|
|
}
|
2022-04-08 05:13:30 -04:00
|
|
|
else if ( currentResult == 'FAILURE' ) {
|
2022-04-08 04:39:36 -04:00
|
|
|
if ( previousResult != null && previousResult == "FAILURE" ) {
|
|
|
|
subject = "${env.JOB_NAME} - Build ${env.BUILD_NUMBER} - Still failing"
|
|
|
|
body = """<p>${env.JOB_NAME} - Build ${env.BUILD_NUMBER} - Still failing:</p>
|
|
|
|
<p>Check console output at <a href='${env.BUILD_URL}'>${env.BUILD_URL}</a> to view the results.</p>"""
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
subject = "${env.JOB_NAME} - Build ${env.BUILD_NUMBER} - Failure"
|
|
|
|
body = """<p>${env.JOB_NAME} - Build ${env.BUILD_NUMBER} - Failure:</p>
|
|
|
|
<p>Check console output at <a href='${env.BUILD_URL}'>${env.BUILD_URL}</a> to view the results.</p>"""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2022-04-08 05:13:30 -04:00
|
|
|
subject = "${env.JOB_NAME} - Build ${env.BUILD_NUMBER} - ${currentResult}"
|
|
|
|
body = """<p>${env.JOB_NAME} - Build ${env.BUILD_NUMBER} - ${currentResult}:</p>
|
2022-04-08 04:39:36 -04:00
|
|
|
<p>Check console output at <a href='${env.BUILD_URL}'>${env.BUILD_URL}</a> to view the results.</p>"""
|
|
|
|
}
|
|
|
|
|
|
|
|
emailext(
|
|
|
|
subject: subject,
|
|
|
|
body: body,
|
|
|
|
to: buildEnv.notificationRecipients
|
|
|
|
)
|
|
|
|
}
|
2021-07-06 06:55:10 -04:00
|
|
|
}
|