From c51e9a7935eb40cda66d83d29b570a3ef2a56964 Mon Sep 17 00:00:00 2001 From: Baptiste Mathus Date: Fri, 29 Mar 2019 10:46:57 +0100 Subject: [PATCH 1/8] First stab at adding PCT ITs for the Docker image --- Jenkinsfile | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index dc3a75011..5690884a9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -53,3 +53,23 @@ for (int i = 0; i < platforms.size(); ++i) { /* Execute our platforms in parallel */ parallel(branches) + +node('docker') { + checkout scm + + stage('Build Docker Image') { + sh 'make docker' + } + + stage("Run known successful case(s)") { + sh '''docker run --rm \ + -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"' + + } +} From 17c594445bf4b1d4ff11aff803c1c7c9226fcf2f Mon Sep 17 00:00:00 2001 From: Baptiste Mathus Date: Mon, 1 Apr 2019 13:05:39 +0200 Subject: [PATCH 2/8] Download Jenkins.war to run always on the same (not used yet in PCT run though) --- Jenkinsfile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 5690884a9..9f3973f73 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -61,8 +61,15 @@ node('docker') { 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 From 67436a3807b0ec824c1bba6240e84f624f5bb3f8 Mon Sep 17 00:00:00 2001 From: Baptiste Mathus Date: Fri, 19 Apr 2019 13:17:21 +0200 Subject: [PATCH 3/8] Prepare parallelization --- Jenkinsfile | 74 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 57 insertions(+), 17 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9f3973f73..e1c936178 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -50,33 +50,73 @@ for (int i = 0; i < platforms.size(); ++i) { } } } - -/* Execute our platforms in parallel */ parallel(branches) -node('docker') { - checkout scm +// Integration testing, using a locally built Docker image +def itBranches = [:] - stage('Build Docker Image') { - sh 'make docker' - } +itBranches['buildtriggerbadge:2.10 tests success'] = { + node('docker') { + checkout scm - 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 - ''' - } + // 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 \ + 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/**" + ''' + archiveArtifacts artifacts: "out/**" + + sh 'cat out/pct-report.html | grep "Tests : Success"' + } + } +} + +itBranches['buildtriggerbadge:2.10 tests success'] = { + node('docker') { + checkout scm - sh 'cat out/pct-report.html | grep "Tests : Success"' + // 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.failFast = false +parallel itBranches From 50365d3e4a789b3f35f7359f09373b05401b7c38 Mon Sep 17 00:00:00 2001 From: Baptiste Mathus Date: Fri, 19 Apr 2019 13:10:19 +0200 Subject: [PATCH 4/8] Add same run on JDK8 --- Jenkinsfile | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index e1c936178..9d9e67283 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -86,7 +86,7 @@ itBranches['buildtriggerbadge:2.10 tests success'] = { } } -itBranches['buildtriggerbadge:2.10 tests success'] = { +itBranches['buildtriggerbadge:2.10 tests success on JDK11'] = { node('docker') { checkout scm @@ -117,6 +117,36 @@ itBranches['buildtriggerbadge:2.10 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 From 6bd3014f625d117b1387485bb60f8a80e4722e96 Mon Sep 17 00:00:00 2001 From: Baptiste Mathus Date: Fri, 19 Apr 2019 13:34:01 +0200 Subject: [PATCH 5/8] Remove dupe run --- Jenkinsfile | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 9d9e67283..c87eeb6bd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -55,36 +55,6 @@ parallel(branches) // Integration testing, using a locally built Docker image def itBranches = [:] -itBranches['buildtriggerbadge:2.10 tests success'] = { - 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 JDK11'] = { node('docker') { From e70e9e298754f44397a85a5cd88c04377baf46d3 Mon Sep 17 00:00:00 2001 From: Oleg Nenashev Date: Fri, 3 May 2019 15:10:22 +0200 Subject: [PATCH 6/8] Update the Makefile to use 2.164.2 by default --- Makefile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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 From d6ce90e1c90a2db0f4b934ccc2784b66a26e8298 Mon Sep 17 00:00:00 2001 From: Oleg Nenashev Date: Fri, 3 May 2019 15:15:06 +0200 Subject: [PATCH 7/8] [JENKINS-56312] - Implement proper version comparison for plugin splits --- .../main/java/org/jenkins/tools/test/PluginCompatTester.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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..0c1d87a3c 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 @@ -930,7 +930,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); From ce2ff5d21deeb78f706b86769b894e3b747e8337 Mon Sep 17 00:00:00 2001 From: Oleg Nenashev Date: Fri, 3 May 2019 15:38:59 +0200 Subject: [PATCH 8/8] [JENKINS-57320] - PCT was malfunctional on any Jenkins WAR without bundled plugins --- .../tools/test/PluginCompatTester.java | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) 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 0c1d87a3c..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()) {