diff --git a/Jenkinsfile b/Jenkinsfile index dc3a75011..c87eeb6bd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -50,6 +50,73 @@ for (int i = 0; i < platforms.size(); ++i) { } } } - -/* Execute our platforms in parallel */ parallel(branches) + +// Integration testing, using a locally built Docker image +def itBranches = [:] + + +itBranches['buildtriggerbadge:2.10 tests success on JDK11'] = { + node('docker') { + checkout scm + + // should we build the image only once and somehow export and stash/unstash it then? + // not sure this would be that quicker + stage('Build Docker Image') { + sh 'make docker' + } + + stage('Download Jenkins 2.164.1') { + sh ''' + curl -sL http://mirrors.jenkins.io/war-stable/2.164.1/jenkins.war --output jenkins.war + echo "65543f5632ee54344f3351b34b305702df12393b3196a95c3771ddb3819b220b jenkins.war" | sha256sum --check + ''' + } + + stage("Run known successful case(s)") { + sh '''docker run --rm \ + -v $(pwd)/jenkins.war:/pct/jenkins.war:ro \ + -v $(pwd)/out:/pct/out -e JDK_VERSION=11 \ + -e ARTIFACT_ID=buildtriggerbadge -e VERSION=buildtriggerbadge-2.10 \ + jenkins/pct + ''' + archiveArtifacts artifacts: "out/**" + + sh 'cat out/pct-report.html | grep "Tests : Success"' + } + } +} + +itBranches['buildtriggerbadge:2.10 tests success on JDK8'] = { + node('docker') { + checkout scm + + // should we build the image only once and somehow export and stash/unstash it then? + // not sure this would be that quicker + stage('Build Docker Image') { + sh 'make docker' + } + + stage('Download Jenkins 2.164.1') { + sh ''' + curl -sL http://mirrors.jenkins.io/war-stable/2.164.1/jenkins.war --output jenkins.war + echo "65543f5632ee54344f3351b34b305702df12393b3196a95c3771ddb3819b220b jenkins.war" | sha256sum --check + ''' + } + + stage("Run known successful case(s)") { + sh '''docker run --rm \ + -v $(pwd)/jenkins.war:/pct/jenkins.war:ro \ + -v $(pwd)/out:/pct/out -e JDK_VERSION=8 \ + -e ARTIFACT_ID=buildtriggerbadge -e VERSION=buildtriggerbadge-2.10 \ + jenkins/pct + ''' + archiveArtifacts artifacts: "out/**" + + sh 'cat out/pct-report.html | grep "Tests : Success"' + } + } +} + +itBranches.failFast = false +parallel itBranches diff --git a/Makefile b/Makefile index 9190df69d..b24636e06 100644 --- a/Makefile +++ b/Makefile @@ -2,9 +2,7 @@ TEST_JDK_HOME?=$(JAVA_HOME) PLUGIN_NAME?=mailer -# TODO: Switch to 2.164.1 LTS once it is released -# Weekly with the latest Java 11 patches is used by default -JENKINS_VERSION=2.164 +JENKINS_VERSION=2.164.2 .PHONY: all all: clean package docker diff --git a/plugins-compat-tester/src/main/java/org/jenkins/tools/test/PluginCompatTester.java b/plugins-compat-tester/src/main/java/org/jenkins/tools/test/PluginCompatTester.java index bec7469ba..b9ec5cb56 100644 --- a/plugins-compat-tester/src/main/java/org/jenkins/tools/test/PluginCompatTester.java +++ b/plugins-compat-tester/src/main/java/org/jenkins/tools/test/PluginCompatTester.java @@ -172,16 +172,22 @@ public PluginCompatReport testPlugins() // Determine the plugin data HashMap pluginGroupIds = new HashMap(); // Used to track real plugin groupIds from WARs - // Scan normal plugins - UpdateSite.Data data = config.getWar() == null ? extractUpdateCenterData(pluginGroupIds) : scanWAR(config.getWar(), pluginGroupIds, "WEB-INF/(?:optional-)?plugins/([^/.]+)[.][hj]pi"); - // Scan detached plugins - UpdateSite.Data detachedData = config.getWar() == null ? extractUpdateCenterData(pluginGroupIds) : scanWAR(config.getWar(), pluginGroupIds, "WEB-INF/(?:detached-)?plugins/([^/.]+)[.][hj]pi"); - // Add detached if and only if no added as normal one - detachedData.plugins.entrySet().stream().forEach(entry -> { - if (!data.plugins.containsKey(entry.getKey())) { - data.plugins.put(entry.getKey(), entry.getValue()); - } - }); + + // Scan bundled plugins + // If there is any bundled plugin, only these plugins will be taken under the consideration for the PCT run + UpdateSite.Data data = config.getWar() == null ? extractUpdateCenterData(pluginGroupIds) : scanWAR(config.getWar(), pluginGroupIds, "WEB-INF/(?:optional-)?plugins/([^/.]+)[.][hj]pi"); + if (!data.plugins.isEmpty()) { + // Scan detached plugins to recover proper Group IDs for them + UpdateSite.Data detachedData = config.getWar() == null ? extractUpdateCenterData(pluginGroupIds) : scanWAR(config.getWar(), pluginGroupIds, "WEB-INF/(?:detached-)?plugins/([^/.]+)[.][hj]pi"); + + // Add detached if and only if no added as normal one + detachedData.plugins.entrySet().stream().forEach(entry -> { + if (!data.plugins.containsKey(entry.getKey())) { + data.plugins.put(entry.getKey(), entry.getValue()); + } + }); + } + final Map pluginsToCheck; final List pluginsToInclude = config.getIncludePlugins(); if (data.plugins.isEmpty() && pluginsToInclude != null && !pluginsToInclude.isEmpty()) { @@ -930,7 +936,7 @@ private List removeSplitsBasedOnJDK(List splits, JavaSpecificati for (String split : splits) { String[] tokens = split.trim().split("\\s+"); if (tokens.length == 4 ) { // We have a jdk field in the splits file - if (jdkVersion.isNewerThan(new JavaSpecificationVersion(tokens[3]))) { + if (jdkVersion.isNewerThanOrEqualTo(new JavaSpecificationVersion(tokens[3]))) { filterSplits.add(split); } else { System.out.println("Not adding " + split + " as split because jdk specified " + tokens[3] + " is newer than running jdk " + jdkVersion);