diff options
author | Luke Granger-Brown <git@lukegb.com> | 2023-10-15T00·43+0000 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2023-10-16T00·35+0000 |
commit | 70b4eadb5f257d94b2f5f8dbaaf712f1a5c962c7 (patch) | |
tree | facac560ef6abc2c6129478bfeece626ac1edb0a | |
parent | 71297499685d7d2c1c839c94187cf8d2fda54e4c (diff) |
chore(3p/gerrit): 3.7.0-rc4 -> 3.8.2 r/6821
Bump gerrit plugins dep hashes, and for code-owners rebase it against master. Change-Id: If7da0ca391b4a5c0102560ca8d52b6f5a2dfd223 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9734 Autosubmit: lukegb <lukegb@tvl.fyi> Tested-by: BuildkiteCI Reviewed-by: lukegb <lukegb@tvl.fyi>
-rw-r--r-- | third_party/gerrit/default.nix | 12 | ||||
-rw-r--r-- | third_party/gerrit_plugins/code-owners/default.nix | 6 | ||||
-rw-r--r-- | third_party/gerrit_plugins/code-owners/using-usernames.patch | 63 | ||||
-rw-r--r-- | third_party/gerrit_plugins/oauth/default.nix | 2 |
4 files changed, 37 insertions, 46 deletions
diff --git a/third_party/gerrit/default.nix b/third_party/gerrit/default.nix index b228e600fdc9..ef3e628a1e64 100644 --- a/third_party/gerrit/default.nix +++ b/third_party/gerrit/default.nix @@ -23,7 +23,7 @@ let runScript = "/bin/bazel-run"; }; bazel = bazelTop // { override = x: bazelTop; }; - version = "3.7.0-rc4"; + version = "3.8.2"; in pkgs.lib.makeOverridable pkgs.buildBazelPackage { pname = "gerrit"; @@ -31,9 +31,9 @@ pkgs.lib.makeOverridable pkgs.buildBazelPackage { src = pkgs.fetchgit { url = "https://gerrit.googlesource.com/gerrit"; - rev = "3e445c7833c4acf49f1171fe4c82ceb32e93c780"; + rev = "67500d39b5bceee8f3ae8b9d605f01428aacb740"; branchName = "v${version}"; - sha256 = "sha256:002aw2bfifyla66v8khyiq4m9qj6ahs6r1dzb5kjk8xqpf6c6q9p"; + sha256 = "sha256:06bmzbcb9717s4b016kcbn8nr9pgaz04i8bnzg7ybkbdwpl8vxvl"; fetchSubmodules = true; }; @@ -55,7 +55,7 @@ pkgs.lib.makeOverridable pkgs.buildBazelPackage { fetchConfigured = true; fetchAttrs = { - sha256 = "sha256:1a31bkl723dyd906h0m54j2mnvgs82j3xr85ca07g35vncmh3lm2"; + sha256 = "sha256:1syy44n1nvrlypa8jv83yzf0miwmsn8bvh97js6v5ygllx04mvf1"; preBuild = '' rm .bazelversion ''; @@ -97,7 +97,7 @@ pkgs.lib.makeOverridable pkgs.buildBazelPackage { # Gerrit fixups: # Normalize permissions on .yarn-{tarball,metadata} files - find $bazelOut/external/yarn_cache \( -name .yarn-tarball.tgz -or -name .yarn-metadata.json \) -exec chmod 644 {} + + test -d $bazelOut/external/yarn_cache && find $bazelOut/external/yarn_cache \( -name .yarn-tarball.tgz -or -name .yarn-metadata.json \) -exec chmod 644 {} + mkdir $bazelOut/_bits/ find . -name node_modules -prune -print | while read d; do @@ -116,7 +116,7 @@ pkgs.lib.makeOverridable pkgs.buildBazelPackage { preConfigure = '' rm .bazelversion - cp -R $bazelOut/_bits/* ./ + [ "$(ls -A $bazelOut/_bits)" ] && cp -R $bazelOut/_bits/* ./ || true ''; postPatch = '' # Disable all errorprone checks, since we might be using a different version. diff --git a/third_party/gerrit_plugins/code-owners/default.nix b/third_party/gerrit_plugins/code-owners/default.nix index 3c0c4bed0fd7..d35a15827961 100644 --- a/third_party/gerrit_plugins/code-owners/default.nix +++ b/third_party/gerrit_plugins/code-owners/default.nix @@ -5,11 +5,11 @@ let in buildGerritBazelPlugin rec { name = "code-owners"; - depsOutputHash = "sha256:07mgvd7fvg1xqlabjn644505yx98vjrmwxx1arwsykir1h82h0b2"; + depsOutputHash = "sha256:1hd63b54zkgv8j7323inp7rdnhs2jdsb232jqlwsd9pai2f12m7n"; src = pkgs.fetchgit { url = "https://gerrit.googlesource.com/plugins/code-owners"; - rev = "6fdf3ce2e52904b35e2a5824a4197155c2c6b4e4"; - sha256 = "sha256:17k6310py71wax3881mf3vsf9zas648j4xzs9h0d7migv5nzsdzs"; + rev = "e654ae5bda2085bce9a99942bec440e004a114f3"; + sha256 = "sha256:14d3x3iqskgw16pvyaa0swh252agj84p9pzlf24l8lgx9d7y4biz"; }; patches = [ ./using-usernames.patch diff --git a/third_party/gerrit_plugins/code-owners/using-usernames.patch b/third_party/gerrit_plugins/code-owners/using-usernames.patch index 7383aecc08c3..25079ae13688 100644 --- a/third_party/gerrit_plugins/code-owners/using-usernames.patch +++ b/third_party/gerrit_plugins/code-owners/using-usernames.patch @@ -1,19 +1,13 @@ -From ba76ff8b7cd128383c86aeeacf12d1001670eec4 Mon Sep 17 00:00:00 2001 -From: Luke Granger-Brown <git@lukegb.com> -Date: Wed, 21 Sep 2022 03:15:38 +0100 -Subject: [PATCH] Add support for usernames and groups +commit 29ace6c38ac513f7ec56ca425230d5712c081043 +Author: Luke Granger-Brown <git@lukegb.com> +Date: Wed Sep 21 03:15:38 2022 +0100 -Change-Id: I3ba8527f66216d08e555a6ac4451fe0d1e090de5 ---- - .../codeowners/backend/CodeOwnerResolver.java | 120 ++++++++++++++++-- - .../FindOwnersCodeOwnerConfigParser.java | 3 +- - ...AbstractFileBasedCodeOwnerBackendTest.java | 2 +- - .../backend/CodeOwnerResolverTest.java | 87 ++++++++++++- - .../FindOwnersCodeOwnerConfigParserTest.java | 32 ++++- - 5 files changed, 230 insertions(+), 14 deletions(-) + Add support for usernames and groups + + Change-Id: I3ba8527f66216d08e555a6ac4451fe0d1e090de5 diff --git a/java/com/google/gerrit/plugins/codeowners/backend/CodeOwnerResolver.java b/java/com/google/gerrit/plugins/codeowners/backend/CodeOwnerResolver.java -index 07894ced..40943659 100644 +index 70009591..6dc596c9 100644 --- a/java/com/google/gerrit/plugins/codeowners/backend/CodeOwnerResolver.java +++ b/java/com/google/gerrit/plugins/codeowners/backend/CodeOwnerResolver.java @@ -17,6 +17,8 @@ package com.google.gerrit.plugins.codeowners.backend; @@ -47,7 +41,7 @@ index 07894ced..40943659 100644 +import com.google.gerrit.server.account.GroupBackends; +import com.google.gerrit.server.account.InternalGroupBackend; import com.google.gerrit.server.account.externalids.ExternalId; - import com.google.gerrit.server.account.externalids.ExternalIds; + import com.google.gerrit.server.account.externalids.ExternalIdCache; import com.google.gerrit.server.permissions.GlobalPermission; import com.google.gerrit.server.permissions.PermissionBackend; import com.google.gerrit.server.permissions.PermissionBackendException; @@ -58,7 +52,7 @@ index 07894ced..40943659 100644 import com.google.inject.Provider; import java.io.IOException; import java.nio.file.Path; -@@ -103,6 +113,8 @@ public class CodeOwnerResolver { +@@ -102,6 +112,8 @@ public class CodeOwnerResolver { @VisibleForTesting public static final String ALL_USERS_WILDCARD = "*"; @@ -67,7 +61,7 @@ index 07894ced..40943659 100644 private final CodeOwnersPluginConfiguration codeOwnersPluginConfiguration; private final PermissionBackend permissionBackend; private final Provider<CurrentUser> currentUser; -@@ -113,6 +125,8 @@ public class CodeOwnerResolver { +@@ -112,6 +124,8 @@ public class CodeOwnerResolver { private final CodeOwnerMetrics codeOwnerMetrics; private final UnresolvedImportFormatter unresolvedImportFormatter; private final TransientCodeOwnerCache transientCodeOwnerCache; @@ -76,7 +70,7 @@ index 07894ced..40943659 100644 // Enforce visibility by default. private boolean enforceVisibility = true; -@@ -133,7 +147,9 @@ public class CodeOwnerResolver { +@@ -132,7 +146,9 @@ public class CodeOwnerResolver { PathCodeOwners.Factory pathCodeOwnersFactory, CodeOwnerMetrics codeOwnerMetrics, UnresolvedImportFormatter unresolvedImportFormatter, @@ -87,7 +81,7 @@ index 07894ced..40943659 100644 this.codeOwnersPluginConfiguration = codeOwnersPluginConfiguration; this.permissionBackend = permissionBackend; this.currentUser = currentUser; -@@ -144,6 +160,8 @@ public class CodeOwnerResolver { +@@ -143,6 +159,8 @@ public class CodeOwnerResolver { this.codeOwnerMetrics = codeOwnerMetrics; this.unresolvedImportFormatter = unresolvedImportFormatter; this.transientCodeOwnerCache = transientCodeOwnerCache; @@ -96,7 +90,7 @@ index 07894ced..40943659 100644 } /** -@@ -357,6 +375,12 @@ public class CodeOwnerResolver { +@@ -361,6 +379,12 @@ public class CodeOwnerResolver { "cannot resolve code owner email %s: no account with this email exists", CodeOwnerResolver.ALL_USERS_WILDCARD)); } @@ -109,7 +103,7 @@ index 07894ced..40943659 100644 ImmutableList.Builder<String> messageBuilder = ImmutableList.builder(); AtomicBoolean ownedByAllUsers = new AtomicBoolean(false); -@@ -401,9 +425,53 @@ public class CodeOwnerResolver { +@@ -405,9 +429,53 @@ public class CodeOwnerResolver { ImmutableMultimap<CodeOwnerReference, CodeOwnerAnnotation> annotations) { requireNonNull(codeOwnerReferences, "codeOwnerReferences"); @@ -163,7 +157,7 @@ index 07894ced..40943659 100644 .filter(filterOutAllUsersWildCard(ownedByAllUsers)) .collect(toImmutableSet()); -@@ -438,7 +506,8 @@ public class CodeOwnerResolver { +@@ -442,7 +510,8 @@ public class CodeOwnerResolver { ImmutableMap<String, CodeOwner> codeOwnersByEmail = accountsByEmail.map(mapToCodeOwner()).collect(toImmutableMap(Pair::key, Pair::value)); @@ -173,7 +167,7 @@ index 07894ced..40943659 100644 hasUnresolvedCodeOwners.set(true); } -@@ -452,7 +521,9 @@ public class CodeOwnerResolver { +@@ -456,7 +525,9 @@ public class CodeOwnerResolver { cachedCodeOwnersByEmail.entrySet().stream() .filter(e -> e.getValue().isPresent()) .map(e -> Pair.of(e.getKey(), e.getValue().get())); @@ -184,7 +178,7 @@ index 07894ced..40943659 100644 .forEach( p -> { ImmutableSet.Builder<CodeOwnerAnnotation> annotationBuilder = ImmutableSet.builder(); -@@ -463,6 +534,12 @@ public class CodeOwnerResolver { +@@ -467,6 +538,12 @@ public class CodeOwnerResolver { annotationBuilder.addAll( annotations.get(CodeOwnerReference.create(ALL_USERS_WILDCARD))); @@ -197,7 +191,7 @@ index 07894ced..40943659 100644 if (!codeOwnersWithAnnotations.containsKey(p.value())) { codeOwnersWithAnnotations.put(p.value(), new HashSet<>()); } -@@ -566,7 +643,7 @@ public class CodeOwnerResolver { +@@ -570,7 +647,7 @@ public class CodeOwnerResolver { } messages.add(String.format("email %s has no domain", email)); @@ -206,7 +200,7 @@ index 07894ced..40943659 100644 } /** -@@ -581,11 +658,29 @@ public class CodeOwnerResolver { +@@ -585,11 +662,29 @@ public class CodeOwnerResolver { */ private ImmutableMap<String, Collection<ExternalId>> lookupExternalIds( ImmutableList.Builder<String> messages, ImmutableSet<String> emails) { @@ -218,11 +212,11 @@ index 07894ced..40943659 100644 + .collect(ImmutableSet.toImmutableSet()); try { - ImmutableMap<String, Collection<ExternalId>> extIdsByEmail = -- externalIds.byEmails(emails.toArray(new String[0])).asMap(); +- externalIdCache.byEmails(emails.toArray(new String[0])).asMap(); + ImmutableMap<String, Collection<ExternalId>> extIds = + new ImmutableMap.Builder<String, Collection<ExternalId>>() -+ .putAll(externalIds.byEmails(actualEmails).asMap()) -+ .putAll(externalIds.allByAccount().entries().stream() ++ .putAll(externalIdCache.byEmails(actualEmails).asMap()) ++ .putAll(externalIdCache.allByAccount().entries().stream() + .map(entry -> entry.getValue()) + .filter(externalId -> + externalId.key().scheme() != null && @@ -239,7 +233,7 @@ index 07894ced..40943659 100644 .forEach( email -> { transientCodeOwnerCache.cacheNonResolvable(email); -@@ -594,7 +689,7 @@ public class CodeOwnerResolver { +@@ -598,7 +693,7 @@ public class CodeOwnerResolver { "cannot resolve code owner email %s: no account with this email exists", email)); }); @@ -248,7 +242,7 @@ index 07894ced..40943659 100644 } catch (IOException e) { throw newInternalServerError( String.format("cannot resolve code owner emails: %s", emails), e); -@@ -811,6 +906,15 @@ public class CodeOwnerResolver { +@@ -815,6 +910,15 @@ public class CodeOwnerResolver { user != null ? user.getLoggableName() : currentUser.get().getLoggableName())); return true; } @@ -292,7 +286,7 @@ index 7ec92959..59cf7e05 100644 // Try to update the code owner config. diff --git a/javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerResolverTest.java b/javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerResolverTest.java -index b32c3b5e..6b0f0cf8 100644 +index 6171aca9..37699012 100644 --- a/javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerResolverTest.java +++ b/javatests/com/google/gerrit/plugins/codeowners/backend/CodeOwnerResolverTest.java @@ -24,8 +24,10 @@ import com.google.gerrit.acceptance.TestAccount; @@ -352,7 +346,7 @@ index b32c3b5e..6b0f0cf8 100644 @Test public void resolveCodeOwnerReferenceForAmbiguousEmailIfOtherAccountIsInactive() throws Exception { -@@ -391,6 +418,64 @@ public class CodeOwnerResolverTest extends AbstractCodeOwnersTest { +@@ -397,6 +424,64 @@ public class CodeOwnerResolverTest extends AbstractCodeOwnersTest { assertThat(result.hasUnresolvedCodeOwners()).isFalse(); } @@ -417,7 +411,7 @@ index b32c3b5e..6b0f0cf8 100644 @Test public void resolvePathCodeOwnersNonResolvableCodeOwnersAreFilteredOut() throws Exception { CodeOwnerConfig codeOwnerConfig = -@@ -649,7 +734,7 @@ public class CodeOwnerResolverTest extends AbstractCodeOwnersTest { +@@ -655,7 +740,7 @@ public class CodeOwnerResolverTest extends AbstractCodeOwnersTest { "domain example.com of email foo@example.org@example.com is allowed"); assertIsEmailDomainAllowed( "foo@example.org", false, "domain example.org of email foo@example.org is not allowed"); @@ -476,6 +470,3 @@ index 260e635e..7aab99d0 100644 @Test public void codeOwnerConfigWithComment() throws Exception { assertParseAndFormat( --- -2.37.3 - diff --git a/third_party/gerrit_plugins/oauth/default.nix b/third_party/gerrit_plugins/oauth/default.nix index 39493ffb081d..71936bf82e1e 100644 --- a/third_party/gerrit_plugins/oauth/default.nix +++ b/third_party/gerrit_plugins/oauth/default.nix @@ -5,7 +5,7 @@ let in buildGerritBazelPlugin rec { name = "oauth"; - depsOutputHash = "sha256:12y8493y8ns6c6c69g89bkrahd42mircqykldair1xrb3yg26hqp"; + depsOutputHash = "sha256:16lv1glsfkn2bagx0vs6sgjf1mdd8vf3dl3iby1zvcm3wnrwfz7y"; src = pkgs.fetchgit { url = "https://gerrit.googlesource.com/plugins/oauth"; rev = "f9bef7476bc99f7b1dc3fe2d52ec95cd7ac571dc"; |