Skip to content

Commit

Permalink
Merge branch 'master' into feature-add-vote-patches-same-topic
Browse files Browse the repository at this point in the history
  • Loading branch information
ckreisl committed Oct 6, 2022
2 parents 3dcf040 + 069a994 commit 77dfd06
Show file tree
Hide file tree
Showing 78 changed files with 1,946 additions and 1,513 deletions.
2 changes: 1 addition & 1 deletion .mvn/extensions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<extension>
<groupId>io.jenkins.tools.incrementals</groupId>
<artifactId>git-changelist-maven-extension</artifactId>
<version>1.2</version>
<version>1.4</version>
</extension>
</extensions>
9 changes: 4 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
buildPlugin(
platforms: ['linux'],
jenkinsVersions: [null],
jdkVersions: [8]
)
buildPlugin(useContainerAgent: true, configurations: [
[ platform: 'linux', jdk: '8' ],
[ platform: 'linux', jdk: '11' ],
])
1 change: 1 addition & 0 deletions build-config/swe_checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
<module name="JavadocMethod">
<property name="logLoadErrors" value="true"/>
<property name="suppressLoadErrors" value="true"/>
<property name="allowedAnnotations" value="Override, Test, Before, BeforeClass, After, AfterClass"/>
</module>
<module name="JavadocStyle">
<property name="scope" value="protected"/>
Expand Down
164 changes: 72 additions & 92 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.25</version>
<version>4.47</version>
<relativePath />
</parent>

Expand All @@ -13,12 +14,12 @@
<packaging>hpi</packaging>
<name>Gerrit Trigger</name>
<description>Integrates with Gerrit code review.</description>
<url>https://github.com/jenkinsci/gerrit-trigger-plugin/blob/master/docs/README.adoc</url>
<url>https://github.com/jenkinsci/${project.artifactId}-plugin/blob/master/docs/README.adoc</url>

<licenses>
<license>
<name>MIT</name>
<url>http://www.opensource.org/licenses/mit-license.php</url>
<name>MIT License</name>
<url>https://opensource.org/licenses/MIT</url>
<comments>
Copyright 2010 Sony Ericsson Mobile Communications. All rights reserved.
Copyright 2012 Sony Mobile Communications AB. All rights reserved.
Expand Down Expand Up @@ -53,19 +54,16 @@
</developers>

<properties>
<jenkins.version>2.222.4</jenkins.version>
<jenkins.version>2.346.3</jenkins.version>
<revision>2.36.1</revision>
<changelist>-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/gerrit-trigger-plugin</gitHubRepo>
<java.level>8</java.level>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
<!--<java.level>8</java.level>-->
<no-test-jar>false</no-test-jar>
<findbugs.failOnError>false</findbugs.failOnError>
<concurrency>0.5C</concurrency>
<powermock.version>1.6.2</powermock.version>
<!--<concurrency>0.5C</concurrency>-->
<checkstyle.version>2.16</checkstyle.version>
<mockito.version>1.10.19</mockito.version>
<surefire.rerunFailingTestsCount>3</surefire.rerunFailingTestsCount>
<reuseForks>false</reuseForks>
<forkCount>0.5C</forkCount>
<spotbugs.threshold>High</spotbugs.threshold>
</properties>
Expand All @@ -74,8 +72,13 @@
<dependency>
<groupId>com.sonymobile.tools.gerrit</groupId>
<artifactId>gerrit-events</artifactId>
<version>2.19.0</version>
<version>2.19.0</version>
<exclusions>
<!-- Provided by core -->
<exclusion>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</exclusion>
<exclusion>
<!-- json-lib-2.4-jenkins-2 is provided by core/stapler -->
<groupId>net.sf.json-lib</groupId>
Expand All @@ -85,6 +88,11 @@
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</exclusion>
<!-- Provided by core -->
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
<!-- New source is here: https://github.com/sonyxperiadev/gerrit-events -->
</dependency>
Expand Down Expand Up @@ -116,7 +124,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>support-core</artifactId>
<version>2.75</version>
<!--<version>2.75</version>-->
<optional>true</optional>
</dependency>
<dependency>
Expand Down Expand Up @@ -180,75 +188,75 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<version>3.0</version>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>${mockito.version}</version>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>pipeline-stage-step</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>${powermock.version}</version>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8-standalone</artifactId>
<!--
wiremock-jre8 introduces many dependencies that interferes with jth and core functionality
during testing, the standalone jar shades all those so it doesn't break other tests.
-->
<version>2.28.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<version>${powermock.version}</version>
<groupId>io.jenkins.plugins</groupId>
<artifactId>caffeine-api</artifactId>
</dependency>
<dependency>
<artifactId>configuration-as-code</artifactId>
<groupId>io.jenkins</groupId>
<optional>true</optional>
</dependency>
<dependency>
<artifactId>test-harness</artifactId>
<groupId>io.jenkins.configuration-as-code</groupId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>pipeline-stage-step</artifactId>
<artifactId>jackson2-api</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>matrix-project</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8-standalone</artifactId>
<!--
wiremock-jre8 introduces many dependencies that interferes with jth and core functionality
during testing, the standalone jar shades all those so it doesn't break other tests.
-->
<version>2.28.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.jenkins.plugins</groupId>
<artifactId>caffeine-api</artifactId>
</dependency>
<dependency>
<artifactId>configuration-as-code</artifactId>
<groupId>io.jenkins</groupId>
<optional>true</optional>
</dependency>
<dependency>
<artifactId>test-harness</artifactId>
<groupId>io.jenkins.configuration-as-code</groupId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>jackson2-api</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>matrix-project</artifactId>
<scope>test</scope>
</dependency>

<!-- TODO move to plugin dependencies (no server module yet)-->
<groupId>org.apache.sshd</groupId>
<artifactId>sshd-core</artifactId>
<version>1.7.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sonyericsson.jenkins.plugins.bfa</groupId>
<artifactId>build-failure-analyzer</artifactId>
<version>2.4.0</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sonyericsson.jenkins.plugins.bfa</groupId>
<artifactId>build-failure-analyzer</artifactId>
<version>2.4.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-2.222.x</artifactId>
<version>887.vae9c8ac09ff7</version>
<artifactId>bom-2.346.x</artifactId>
<version>1595.v8c71c13cc3a_9</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -291,7 +299,6 @@
<value>33849</value>
</property>
</systemProperties>
<argLine>-Xmx1024m -XX:MaxPermSize=380m</argLine>
<reuseForks>false</reuseForks>
<forkCount>${concurrency}</forkCount>
</configuration>
Expand Down Expand Up @@ -355,40 +362,13 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>java18</artifactId>
<version>1.0</version>
</signature>
</configuration>
<executions>
<execution>
<id>check-java-api</id>
<phase>test</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<distributionManagement>
<repository>
<id>maven.jenkins-ci.org</id>
<url>https://repo.jenkins-ci.org/releases</url>
</repository>
</distributionManagement>

<scm>
<connection>scm:git:ssh://github.com/jenkinsci/gerrit-trigger-plugin.git</connection>
<developerConnection>scm:git:ssh://git@github.com/jenkinsci/gerrit-trigger-plugin.git</developerConnection>
<url>https://github.com/jenkinsci/gerrit-trigger-plugin</url>
<connection>scm:git:https://github.com/${gitHubRepo}.git</connection>
<developerConnection>scm:git:git@github.com:${gitHubRepo}.git</developerConnection>
<url>https://github.com/${gitHubRepo}</url>
<tag>${scmTag}</tag>
</scm>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ public String getDisplayName() {
*/
public static DescriptorExtensionList<GerritServer, GerritServer.DescriptorImpl> serverDescriptorList() {
Jenkins jenkins = Jenkins.get();
return jenkins
.<GerritServer, GerritServer.DescriptorImpl>getDescriptorList(GerritServer.class);
return jenkins.getDescriptorList(GerritServer.class);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,15 @@ public void start() {
s.start();
}
active = true;
}

/**
* Forces initialization of the Dispatchers.
*
* They need to register and listen to GerritEvents. Normally, it is lazy loaded when the first build is started.
*/
@Initializer(after = InitMilestone.SYSTEM_CONFIG_ADAPTED)
public static void initializeDispatchers() {
// Call the following method for force initialization of the Dispatchers because
// it needs to register and listen to GerritEvent. Normally, it is lazy loaded when the first build is started.
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@

//CS IGNORE LineLength FOR NEXT 11 LINES. REASON: static import.
import static com.sonymobile.tools.gerrit.gerritevents.GerritDefaultValues.DEFAULT_BUILD_SCHEDULE_DELAY;
import static com.sonymobile.tools.gerrit.gerritevents.GerritDefaultValues.DEFAULT_DYNAMIC_CONFIG_REFRESH_INTERVAL;
import static com.sonymobile.tools.gerrit.gerritevents.GerritDefaultValues.DEFAULT_GERRIT_AUTH_KEY_FILE;
import static com.sonymobile.tools.gerrit.gerritevents.GerritDefaultValues.DEFAULT_GERRIT_AUTH_KEY_FILE_PASSWORD;
import static com.sonymobile.tools.gerrit.gerritevents.GerritDefaultValues.DEFAULT_GERRIT_HOSTNAME;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,26 +91,28 @@ public Class<PluginImpl> getTarget() {
protected void configure(
Mapping config, PluginImpl instance, boolean dryrun, ConfigurationContext context
) throws ConfiguratorException {
List<GerritServer> oldServers = instance.getServers();
List<GerritServer> oldServers = new ArrayList<>(instance.getServers());

try {
super.configure(config, instance, dryrun, context);
} catch (IllegalArgumentException ex) {
throw new ConfiguratorException(this, "Failed configuring gerrit trigger", ex);
}

instance.getPluginConfig().updateEventFilter();
if (!dryrun) {
instance.getPluginConfig().updateEventFilter();

for (GerritServer oldServer : oldServers) {
oldServer.stopConnection();
oldServer.stop();
}
for (GerritServer oldServer : oldServers) {
oldServer.stopConnection();
oldServer.stop();
}

for (GerritServer server : instance.getServers()) {
server.getConfig().setNumberOfSendingWorkerThreads(
for (GerritServer server : instance.getServers()) {
server.getConfig().setNumberOfSendingWorkerThreads(
instance.getPluginConfig().getNumberOfSendingWorkerThreads()
);
server.start();
);
server.start();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
Expand Down Expand Up @@ -94,7 +93,7 @@ public List<Map.Entry<GerritTriggeredEvent, List<BuildMemory.MemoryImprint.Entry
List<Map.Entry<GerritTriggeredEvent, List<BuildMemory.MemoryImprint.Entry>>> entries =
new LinkedList<Entry<GerritTriggeredEvent,
List<BuildMemory.MemoryImprint.Entry>>>(entrySet());
Collections.sort(entries, new Comparator<Entry<GerritTriggeredEvent,
entries.sort(new Comparator<Entry<GerritTriggeredEvent,
List<BuildMemory.MemoryImprint.Entry>>>() {
@Override
public int compare(Map.Entry<GerritTriggeredEvent, List<BuildMemory.MemoryImprint.Entry>> a,
Expand Down

0 comments on commit 77dfd06

Please sign in to comment.