Merge branch 'stable-3.2' into stable-3.3

* stable-3.2:
  ForRef#check should permit internal users to read all refs
  Add Jacek Centkowski to developers
  Add support for Elasticsearch version 7.10.*
  Add support for Elasticsearch version 7.9.*
  Align http dependencies with elasticsearch-rest-client

Change-Id: I7515ca92f18a01931a79498d6c366cfb01fd743a
This commit is contained in:
Marco Miller
2020-12-21 12:08:00 -05:00
17 changed files with 60 additions and 17 deletions

View File

@@ -803,26 +803,30 @@ maven_jar(
sha1 = "fd369423346b2f1525c413e33f8cf95b09c92cbd",
)
# Note that all of the following org.apache.httpcomponents have newer versions,
# but 4.4.1 is the only version that is available for all of them.
HTTPCOMP_VERS = "4.4.1"
# Base the following org.apache.httpcomponents versions on what
# elasticsearch-rest-client explicitly depends on, except for
# commons-codec (non-http) which is not necessary yet. Note that
# below httpcore version(s) differs from the HTTPCOMP_VERS range,
# upstream: that specific dependency has no HTTPCOMP_VERS version
# equivalent currently.
HTTPCOMP_VERS = "4.5.2"
maven_jar(
name = "fluent-hc",
artifact = "org.apache.httpcomponents:fluent-hc:" + HTTPCOMP_VERS,
sha1 = "96fb842b68a44cc640c661186828b60590c71261",
sha1 = "7bfdfa49de6d720ad3c8cedb6a5238eec564dfed",
)
maven_jar(
name = "httpclient",
artifact = "org.apache.httpcomponents:httpclient:" + HTTPCOMP_VERS,
sha1 = "016d0bc512222f1253ee6b64d389c84e22f697f0",
sha1 = "733db77aa8d9b2d68015189df76ab06304406e50",
)
maven_jar(
name = "httpcore",
artifact = "org.apache.httpcomponents:httpcore:" + HTTPCOMP_VERS,
sha1 = "f5aa318bda4c6c8d688c9d00b90681dcd82ce636",
artifact = "org.apache.httpcomponents:httpcore:4.4.12",
sha1 = "21ebaf6d532bc350ba95bd81938fa5f0e511c132",
)
# Test-only dependencies below.

View File

@@ -24,7 +24,9 @@ public enum ElasticVersion {
V7_5("7.5.*"),
V7_6("7.6.*"),
V7_7("7.7.*"),
V7_8("7.8.*");
V7_8("7.8.*"),
V7_9("7.9.*"),
V7_10("7.10.*");
private final String version;
private final Pattern pattern;

View File

@@ -606,6 +606,10 @@ class RefControl {
private boolean can(RefPermission perm) throws PermissionBackendException {
switch (perm) {
case READ:
/* Internal users such as plugin users should be able to read all refs. */
if (getUser().isInternalUser()) {
return true;
}
if (refName.startsWith(Constants.R_TAGS)) {
return isTagVisible();
}

View File

@@ -26,7 +26,7 @@ public class ElasticReindexIT extends AbstractReindexTests {
@ConfigSuite.Default
public static Config elasticsearchV7() {
return getConfig(ElasticVersion.V7_8);
return getConfig(ElasticVersion.V7_10);
}
@Override

View File

@@ -28,7 +28,7 @@ public class ElasticIndexIT extends AbstractIndexTests {
@ConfigSuite.Default
public static Config elasticsearchV7() {
return getConfig(ElasticVersion.V7_8);
return getConfig(ElasticVersion.V7_10);
}
@Override

View File

@@ -53,6 +53,10 @@ public class ElasticContainer extends ElasticsearchContainer {
return "blacktop/elasticsearch:7.7.1";
case V7_8:
return "blacktop/elasticsearch:7.8.1";
case V7_9:
return "blacktop/elasticsearch:7.9.3";
case V7_10:
return "blacktop/elasticsearch:7.10.1";
}
throw new IllegalStateException("No tests for version: " + version.name());
}

View File

@@ -36,7 +36,7 @@ public class ElasticV7QueryAccountsTest extends AbstractQueryAccountsTest {
public static void startIndexService() {
if (container == null) {
// Only start Elasticsearch once
container = ElasticContainer.createAndStart(ElasticVersion.V7_8);
container = ElasticContainer.createAndStart(ElasticVersion.V7_10);
}
}

View File

@@ -46,7 +46,7 @@ public class ElasticV7QueryChangesTest extends AbstractQueryChangesTest {
public static void startIndexService() {
if (container == null) {
// Only start Elasticsearch once
container = ElasticContainer.createAndStart(ElasticVersion.V7_8);
container = ElasticContainer.createAndStart(ElasticVersion.V7_10);
client = HttpAsyncClients.createDefault();
client.start();
}

View File

@@ -36,7 +36,7 @@ public class ElasticV7QueryGroupsTest extends AbstractQueryGroupsTest {
public static void startIndexService() {
if (container == null) {
// Only start Elasticsearch once
container = ElasticContainer.createAndStart(ElasticVersion.V7_8);
container = ElasticContainer.createAndStart(ElasticVersion.V7_10);
}
}

View File

@@ -36,7 +36,7 @@ public class ElasticV7QueryProjectsTest extends AbstractQueryProjectsTest {
public static void startIndexService() {
if (container == null) {
// Only start Elasticsearch once
container = ElasticContainer.createAndStart(ElasticVersion.V7_8);
container = ElasticContainer.createAndStart(ElasticVersion.V7_10);
}
}

View File

@@ -42,6 +42,12 @@ public class ElasticVersionTest {
assertThat(ElasticVersion.forVersion("7.8.0")).isEqualTo(ElasticVersion.V7_8);
assertThat(ElasticVersion.forVersion("7.8.1")).isEqualTo(ElasticVersion.V7_8);
assertThat(ElasticVersion.forVersion("7.9.0")).isEqualTo(ElasticVersion.V7_9);
assertThat(ElasticVersion.forVersion("7.9.1")).isEqualTo(ElasticVersion.V7_9);
assertThat(ElasticVersion.forVersion("7.10.0")).isEqualTo(ElasticVersion.V7_10);
assertThat(ElasticVersion.forVersion("7.10.1")).isEqualTo(ElasticVersion.V7_10);
}
@Test

View File

@@ -45,6 +45,7 @@ import com.google.gerrit.entities.PermissionRange;
import com.google.gerrit.entities.Project;
import com.google.gerrit.exceptions.InvalidNameException;
import com.google.gerrit.server.CurrentUser;
import com.google.gerrit.server.InternalUser;
import com.google.gerrit.server.account.GroupMembership;
import com.google.gerrit.server.account.ListGroupMembership;
import com.google.gerrit.server.config.AllProjectsName;
@@ -312,6 +313,11 @@ public class RefControlTest {
assertAllRefsAreNotVisible(user(allUsersName, DEVS));
}
@Test
public void userRefIsVisibleForInternalUser() throws Exception {
internalUser(localKey).controlForRef("refs/users/default").asForRef().check(RefPermission.READ);
}
@Test
public void branchDelegation1() throws Exception {
projectOperations
@@ -1220,6 +1226,10 @@ public class RefControlTest {
return projectCache.get(nameKey).orElseThrow(illegalState(nameKey));
}
private ProjectControl internalUser(Project.NameKey localKey) throws Exception {
return projectControlFactory.create(new InternalUser(), getProjectState(localKey));
}
private ProjectControl user(Project.NameKey localKey, AccountGroup.UUID... memberOf)
throws Exception {
return user(localKey, null, memberOf);

View File

@@ -40,6 +40,9 @@
<developer>
<name>Han-Wen Nienhuys</name>
</developer>
<developer>
<name>Jacek Centkowski</name>
</developer>
<developer>
<name>Luca Milanesio</name>
</developer>

View File

@@ -40,6 +40,9 @@
<developer>
<name>Han-Wen Nienhuys</name>
</developer>
<developer>
<name>Jacek Centkowski</name>
</developer>
<developer>
<name>Luca Milanesio</name>
</developer>

View File

@@ -40,6 +40,9 @@
<developer>
<name>Han-Wen Nienhuys</name>
</developer>
<developer>
<name>Jacek Centkowski</name>
</developer>
<developer>
<name>Luca Milanesio</name>
</developer>

View File

@@ -40,6 +40,9 @@
<developer>
<name>Han-Wen Nienhuys</name>
</developer>
<developer>
<name>Jacek Centkowski</name>
</developer>
<developer>
<name>Luca Milanesio</name>
</developer>

View File

@@ -93,11 +93,12 @@ def declare_nongoogle_deps():
)
# When upgrading elasticsearch-rest-client, also upgrade httpcore-nio
# and httpasyncclient as necessary.
# and httpasyncclient as necessary. Consider also the other
# org.apache.httpcomponents dependencies in ../WORKSPACE.
maven_jar(
name = "elasticsearch-rest-client",
artifact = "org.elasticsearch.client:elasticsearch-rest-client:7.8.1",
sha1 = "59feefe006a96a39f83b0dfb6780847e06c1d0a8",
artifact = "org.elasticsearch.client:elasticsearch-rest-client:7.10.1",
sha1 = "b2e89d266c2c0039a69504f78c9230582ea095ee",
)
maven_jar(