Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 69 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [:]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is definitely some level of copy paste below. I think we'll want to factor this out at some point.

But I didn't want to spend too much making this generic yet (like having a way to simply provide the command the pass, the expected result, etc.). I'd rather first have this merged as-is, once green, and we iterate on growing the test coverage and will refactor in followups.



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') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use 2.164.2?

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'] = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to prevent copy-paste ?

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
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,16 +172,22 @@ public PluginCompatReport testPlugins()

// Determine the plugin data
HashMap<String,String> pluginGroupIds = new HashMap<String, String>(); // 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<String, Plugin> pluginsToCheck;
final List<String> pluginsToInclude = config.getIncludePlugins();
if (data.plugins.isEmpty() && pluginsToInclude != null && !pluginsToInclude.isEmpty()) {
Expand Down Expand Up @@ -930,7 +936,7 @@ private List<String> removeSplitsBasedOnJDK(List<String> 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);
Expand Down