aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-ce
diff options
context:
space:
mode:
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>2018-12-14 09:39:57 +0100
committerSonarTech <sonartech@sonarsource.com>2018-12-21 20:21:02 +0100
commit58de7147e843d25133e236a33d0c4ec23d020d0d (patch)
tree1a6383d6233f876c095c4783b13f9d9554ea72b2 /server/sonar-ce
parent13af1134fa44603308e5e40c5b3d20c626d38119 (diff)
downloadsonarqube-58de7147e843d25133e236a33d0c4ec23d020d0d.tar.gz
sonarqube-58de7147e843d25133e236a33d0c4ec23d020d0d.zip
SONARCLOUD-193 no Hazelcast in CE on SonarCloud
which implies that the cleaning job is no more run by the Compute Engine nodes on SonarCloud
Diffstat (limited to 'server/sonar-ce')
-rw-r--r--server/sonar-ce/src/main/java/org/sonar/ce/CeDistributedInformationImpl.java4
-rw-r--r--server/sonar-ce/src/main/java/org/sonar/ce/cleaning/NoopCeCleaningSchedulerImpl.java27
-rw-r--r--server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java28
-rw-r--r--server/sonar-ce/src/test/java/org/sonar/ce/queue/CeQueueInitializerTest.java3
4 files changed, 45 insertions, 17 deletions
diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/CeDistributedInformationImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/CeDistributedInformationImpl.java
index bfc2eff67b0..ce5735413d3 100644
--- a/server/sonar-ce/src/main/java/org/sonar/ce/CeDistributedInformationImpl.java
+++ b/server/sonar-ce/src/main/java/org/sonar/ce/CeDistributedInformationImpl.java
@@ -48,10 +48,6 @@ public class CeDistributedInformationImpl implements CeDistributedInformation, S
this.ceCeWorkerFactory = ceCeWorkerFactory;
}
- public CeDistributedInformationImpl(CeWorkerFactory ceCeWorkerFactory) {
- this(null, ceCeWorkerFactory);
- }
-
@Override
public Set<String> getWorkerUUIDs() {
Set<String> connectedWorkerUUIDs = hazelcastMember.getMemberUuids();
diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/cleaning/NoopCeCleaningSchedulerImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/cleaning/NoopCeCleaningSchedulerImpl.java
new file mode 100644
index 00000000000..ce08344cb1d
--- /dev/null
+++ b/server/sonar-ce/src/main/java/org/sonar/ce/cleaning/NoopCeCleaningSchedulerImpl.java
@@ -0,0 +1,27 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2018 SonarSource SA
+ * mailto:info AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.sonar.ce.cleaning;
+
+public class NoopCeCleaningSchedulerImpl implements CeCleaningScheduler {
+ @Override
+ public void startScheduling() {
+ // do nothing
+ }
+}
diff --git a/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java b/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java
index c5948636384..a8b8bd97bae 100644
--- a/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java
+++ b/server/sonar-ce/src/main/java/org/sonar/ce/container/ComputeEngineContainerImpl.java
@@ -50,6 +50,7 @@ import org.sonar.ce.CeTaskCommonsModule;
import org.sonar.ce.StandaloneCeDistributedInformation;
import org.sonar.ce.async.SynchronousAsyncExecution;
import org.sonar.ce.cleaning.CeCleaningModule;
+import org.sonar.ce.cleaning.NoopCeCleaningSchedulerImpl;
import org.sonar.ce.db.ReadOnlyPropertiesDao;
import org.sonar.ce.logging.CeProcessLogging;
import org.sonar.ce.monitoring.CEQueueStatusImpl;
@@ -162,6 +163,7 @@ import static org.sonar.core.extension.CoreExtensionsInstaller.noAdditionalSideF
import static org.sonar.core.extension.PlatformLevelPredicates.hasPlatformLevel;
import static org.sonar.core.extension.PlatformLevelPredicates.hasPlatformLevel4OrNone;
import static org.sonar.process.ProcessProperties.Property.CLUSTER_ENABLED;
+import static org.sonar.process.ProcessProperties.Property.SONARCLOUD_ENABLED;
public class ComputeEngineContainerImpl implements ComputeEngineContainer {
@@ -452,13 +454,20 @@ public class ComputeEngineContainerImpl implements ComputeEngineContainer {
WebhookModule.class,
QualityGateFinder.class,
- QualityGateEvaluatorImpl.class,
+ QualityGateEvaluatorImpl.class
- // cleaning
- CeCleaningModule.class);
+ );
- if (props.valueAsBoolean(CLUSTER_ENABLED.getKey())) {
+ if (props.valueAsBoolean(SONARCLOUD_ENABLED.getKey())) {
+ // no cleaning job on sonarcloud and no distributed information
+ container.add(
+ NoopCeCleaningSchedulerImpl.class,
+ StandaloneCeDistributedInformation.class,
+ CEQueueStatusImpl.class);
+ } else if (props.valueAsBoolean(CLUSTER_ENABLED.getKey())) {
container.add(
+ CeCleaningModule.class,
+
// system health
CeDistributedInformationImpl.class,
@@ -466,20 +475,17 @@ public class ComputeEngineContainerImpl implements ComputeEngineContainer {
DbSection.class,
ProcessInfoProvider.class,
- DistributedCEQueueStatusImpl.class
-
- );
+ DistributedCEQueueStatusImpl.class);
} else {
container.add(
+ CeCleaningModule.class,
StandaloneCeDistributedInformation.class,
- CEQueueStatusImpl.class
-
- );
+ CEQueueStatusImpl.class);
}
}
private static Object[] startupComponents() {
- return new Object[]{
+ return new Object[] {
ServerLifecycleNotifier.class,
PurgeCeActivities.class,
CeQueueCleaner.class
diff --git a/server/sonar-ce/src/test/java/org/sonar/ce/queue/CeQueueInitializerTest.java b/server/sonar-ce/src/test/java/org/sonar/ce/queue/CeQueueInitializerTest.java
index fb3337fd66c..af986304e9d 100644
--- a/server/sonar-ce/src/test/java/org/sonar/ce/queue/CeQueueInitializerTest.java
+++ b/server/sonar-ce/src/test/java/org/sonar/ce/queue/CeQueueInitializerTest.java
@@ -19,11 +19,10 @@
*/
package org.sonar.ce.queue;
-import java.io.IOException;
import org.junit.Test;
import org.sonar.api.platform.Server;
-import org.sonar.ce.cleaning.CeCleaningScheduler;
import org.sonar.ce.CeDistributedInformation;
+import org.sonar.ce.cleaning.CeCleaningScheduler;
import org.sonar.ce.taskprocessor.CeProcessingScheduler;
import static org.mockito.Mockito.mock;