From 9606278409ff8a1f34ec9ca55f7a9b9c9997f144 Mon Sep 17 00:00:00 2001 From: Thomas Draebing Date: Mon, 18 May 2020 15:16:15 +0200 Subject: Hide "No Votes" notice for for labels added and approved by rules If a label was created by a prolog rule and approved by it, the Polygerrit UI still showed the notice "No Votes" in addition to the thumbs up vote, which was automatically created by the prolog rule. The placeholder will now also be hidden, if the LabelInfo-object does not have a values-field, but was either accepted or rejected, which will be the case, if the label was created and voted on by a prolog rule. Issue: 12777 Change-Id: Ic776a48ab03e7eb0993ea1fdcbc682ea64638c04 --- .../app/elements/shared/gr-label-info/gr-label-info.js | 3 +++ .../app/elements/shared/gr-label-info/gr-label-info_test.html | 10 +++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info.js b/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info.js index 202000835b..a8389dc756 100644 --- a/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info.js +++ b/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info.js @@ -148,6 +148,9 @@ * order to trigger computation when a label is removed from the change. */ _computeShowPlaceholder(labelInfo, changeLabelsRecord) { + if (!labelInfo.values && (labelInfo.rejected || labelInfo.approved)) { + return 'hidden'; + } if (labelInfo.all) { for (const label of labelInfo.all) { if (label.value && label.value != labelInfo.default_value) { diff --git a/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info_test.html b/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info_test.html index 8bc358d5a5..9cdd57cb8c 100644 --- a/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info_test.html +++ b/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info_test.html @@ -225,6 +225,14 @@ limitations under the License. assert.isFalse(isHidden(element.$$('.placeholder'))); element.labelInfo = {all: [{value: 1}]}; assert.isTrue(isHidden(element.$$('.placeholder'))); + element.labelInfo = {rejected: []}; + assert.isTrue(isHidden(element.$$('.placeholder'))); + element.labelInfo = {values: [], rejected: [], all: [{value: 1}]}; + assert.isTrue(isHidden(element.$$('.placeholder'))); + element.labelInfo = {accepted: []}; + assert.isTrue(isHidden(element.$$('.placeholder'))); + element.labelInfo = {values: [], accepted: [], all: [{value: 1}]}; + assert.isTrue(isHidden(element.$$('.placeholder'))); }); }); - \ No newline at end of file + -- cgit v1.2.3 From 24369c8d9c4ed694d41080c4afdb1c5ce2eb163f Mon Sep 17 00:00:00 2001 From: Marco Miller Date: Wed, 27 May 2020 15:45:48 -0400 Subject: e2e-tests: Add {Approve|Submit}Change core scenarios Add an ApproveChange scenario and base the SubmitChange scenario on it. Make the ApproveChange scenario runnable alone as well. In this case, allow the change number being approved to be set through the existing 'number' test environment property; cf. [1]. In the other case of running approval from SubmitChange, set the change number automatically. Adapt the existing standalone DeleteChange scenario, for SubmitChange. That scenario showed to be very similar to the added ApproveChange one. Adapt the existing standalone CreateChange scenario, so it can be run from SubmitChange now as well. Make the CreateChange project field no longer automatic or solely set by CreateChange alone. Instead, make it either set from composing scenarios such as SubmitChange or as per [1]. Enable this all by making CreateChange a core ProjectSimulation now. Rather than having DeleteChange hold the change number, move it to the CreateChange class. Enable this new SubmitChange scenario flow that way, while preserving existing scenario abilities. Having the CreateChange scenario generate *and* hold the resulting change number should also be more intuitive, compared to DeleteChange holding it before. [1] https://gerrit-documentation.storage.googleapis.com/Documentation/2.16.19/dev-e2e-tests.html#_environment_properties Change-Id: I86dda57672ef9f34a286bfd151226b5988cb7a34 --- .../gerrit/scenarios/ApproveChange-body.json | 5 ++ .../com/google/gerrit/scenarios/ApproveChange.json | 6 +++ .../com/google/gerrit/scenarios/CreateChange.json | 2 +- .../com/google/gerrit/scenarios/DeleteChange.json | 2 +- .../com/google/gerrit/scenarios/SubmitChange.json | 5 ++ .../google/gerrit/scenarios/ApproveChange.scala | 48 +++++++++++++++++ .../com/google/gerrit/scenarios/CreateChange.scala | 15 ++++-- .../com/google/gerrit/scenarios/DeleteChange.scala | 11 ++-- .../google/gerrit/scenarios/GerritSimulation.scala | 3 +- .../com/google/gerrit/scenarios/SubmitChange.scala | 62 ++++++++++++++++++++++ 10 files changed, 148 insertions(+), 11 deletions(-) create mode 100644 e2e-tests/src/test/resources/data/com/google/gerrit/scenarios/ApproveChange-body.json create mode 100644 e2e-tests/src/test/resources/data/com/google/gerrit/scenarios/ApproveChange.json create mode 100644 e2e-tests/src/test/resources/data/com/google/gerrit/scenarios/SubmitChange.json create mode 100644 e2e-tests/src/test/scala/com/google/gerrit/scenarios/ApproveChange.scala create mode 100644 e2e-tests/src/test/scala/com/google/gerrit/scenarios/SubmitChange.scala diff --git a/e2e-tests/src/test/resources/data/com/google/gerrit/scenarios/ApproveChange-body.json b/e2e-tests/src/test/resources/data/com/google/gerrit/scenarios/ApproveChange-body.json new file mode 100644 index 0000000000..670aa9f07b --- /dev/null +++ b/e2e-tests/src/test/resources/data/com/google/gerrit/scenarios/ApproveChange-body.json @@ -0,0 +1,5 @@ +{ + "labels": { + "Code-Review": 2 + } +} diff --git a/e2e-tests/src/test/resources/data/com/google/gerrit/scenarios/ApproveChange.json b/e2e-tests/src/test/resources/data/com/google/gerrit/scenarios/ApproveChange.json new file mode 100644 index 0000000000..3577a6a35b --- /dev/null +++ b/e2e-tests/src/test/resources/data/com/google/gerrit/scenarios/ApproveChange.json @@ -0,0 +1,6 @@ +[ + { + "url": "http://HOSTNAME:HTTP_PORT/a/changes/", + "number": "NUMBER" + } +] diff --git a/e2e-tests/src/test/resources/data/com/google/gerrit/scenarios/CreateChange.json b/e2e-tests/src/test/resources/data/com/google/gerrit/scenarios/CreateChange.json index c267ab3204..b4ee549d26 100644 --- a/e2e-tests/src/test/resources/data/com/google/gerrit/scenarios/CreateChange.json +++ b/e2e-tests/src/test/resources/data/com/google/gerrit/scenarios/CreateChange.json @@ -1,6 +1,6 @@ [ { "url": "http://HOSTNAME:HTTP_PORT/a/changes/", - "project": "_PROJECT" + "project": "PROJECT" } ] diff --git a/e2e-tests/src/test/resources/data/com/google/gerrit/scenarios/DeleteChange.json b/e2e-tests/src/test/resources/data/com/google/gerrit/scenarios/DeleteChange.json index 53b947a248..3577a6a35b 100644 --- a/e2e-tests/src/test/resources/data/com/google/gerrit/scenarios/DeleteChange.json +++ b/e2e-tests/src/test/resources/data/com/google/gerrit/scenarios/DeleteChange.json @@ -1,6 +1,6 @@ [ { "url": "http://HOSTNAME:HTTP_PORT/a/changes/", - "number": "_NUMBER" + "number": "NUMBER" } ] diff --git a/e2e-tests/src/test/resources/data/com/google/gerrit/scenarios/SubmitChange.json b/e2e-tests/src/test/resources/data/com/google/gerrit/scenarios/SubmitChange.json new file mode 100644 index 0000000000..a371757d23 --- /dev/null +++ b/e2e-tests/src/test/resources/data/com/google/gerrit/scenarios/SubmitChange.json @@ -0,0 +1,5 @@ +[ + { + "url": "http://HOSTNAME:HTTP_PORT/a/changes/" + } +] diff --git a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/ApproveChange.scala b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/ApproveChange.scala new file mode 100644 index 0000000000..fe46bd6506 --- /dev/null +++ b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/ApproveChange.scala @@ -0,0 +1,48 @@ +// Copyright (C) 2020 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.gerrit.scenarios + +import io.gatling.core.Predef.{atOnceUsers, _} +import io.gatling.core.feeder.FeederBuilder +import io.gatling.core.structure.ScenarioBuilder +import io.gatling.http.Predef.http + +class ApproveChange extends GerritSimulation { + private val data: FeederBuilder = jsonFile(resource).convert(keys).queue + private var createChange: Option[CreateChange] = None + + def this(createChange: CreateChange) { + this() + this.createChange = Some(createChange) + } + + val test: ScenarioBuilder = scenario(unique) + .feed(data) + .exec(session => { + if (createChange.nonEmpty) { + session.set("number", createChange.get.number) + } else { + session + } + }) + .exec(http(unique) + .post("${url}${number}/revisions/current/review") + .body(ElFileBody(body)).asJson) + + setUp( + test.inject( + atOnceUsers(1) + )).protocols(httpProtocol) +} diff --git a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/CreateChange.scala b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/CreateChange.scala index 57e6bcddc6..c7fb8ed279 100644 --- a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/CreateChange.scala +++ b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/CreateChange.scala @@ -21,26 +21,31 @@ import io.gatling.http.Predef._ import scala.concurrent.duration._ -class CreateChange extends GerritSimulation { +class CreateChange extends ProjectSimulation { private val data: FeederBuilder = jsonFile(resource).convert(keys).queue - private val default: String = name private val numberKey = "_number" + var number = 0 override def relativeRuntimeWeight = 2 - private val test: ScenarioBuilder = scenario(unique) + def this(default: String) { + this() + this.default = default + } + + val test: ScenarioBuilder = scenario(unique) .feed(data) .exec(httpRequest .body(ElFileBody(body)).asJson .check(regex("\"" + numberKey + "\":(\\d+),").saveAs(numberKey))) .exec(session => { - deleteChange.number = Some(session(numberKey).as[Int]) + number = session(numberKey).as[Int] session }) private val createProject = new CreateProject(default) private val deleteProject = new DeleteProject(default) - private val deleteChange = new DeleteChange + private val deleteChange = new DeleteChange(this) setUp( createProject.test.inject( diff --git a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/DeleteChange.scala b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/DeleteChange.scala index 1b3bbc1e98..aa6fe0d0dc 100644 --- a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/DeleteChange.scala +++ b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/DeleteChange.scala @@ -21,15 +21,20 @@ import io.gatling.http.Predef.http class DeleteChange extends GerritSimulation { private val data: FeederBuilder = jsonFile(resource).convert(keys).queue - var number: Option[Int] = None + private var createChange: Option[CreateChange] = None override def relativeRuntimeWeight = 2 + def this(createChange: CreateChange) { + this() + this.createChange = Some(createChange) + } + val test: ScenarioBuilder = scenario(unique) .feed(data) .exec(session => { - if (number.nonEmpty) { - session.set("number", number.get) + if (createChange.nonEmpty) { + session.set("number", createChange.get.number) } else { session } diff --git a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/GerritSimulation.scala b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/GerritSimulation.scala index b427c0d036..5d6176d1c7 100644 --- a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/GerritSimulation.scala +++ b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/GerritSimulation.scala @@ -66,7 +66,8 @@ class GerritSimulation extends Simulation { val precedes = replaceKeyWith("_number", 0, number.toString) replaceProperty("number", 1, precedes) case ("project", project) => - val precedes = replaceKeyWith("_project", name, project.toString) + var precedes = replaceKeyWith("_project", name, project.toString) + precedes = replaceOverride(precedes) replaceProperty("project", precedes) case ("entries", entries) => replaceProperty("projects_entries", "1", entries.toString) diff --git a/e2e-tests/src/test/scala/com/google/gerrit/scenarios/SubmitChange.scala b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/SubmitChange.scala new file mode 100644 index 0000000000..2f67274d3f --- /dev/null +++ b/e2e-tests/src/test/scala/com/google/gerrit/scenarios/SubmitChange.scala @@ -0,0 +1,62 @@ +// Copyright (C) 2020 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.gerrit.scenarios + +import io.gatling.core.Predef.{atOnceUsers, _} +import io.gatling.core.feeder.FeederBuilder +import io.gatling.core.structure.ScenarioBuilder +import io.gatling.http.Predef.http + +import scala.concurrent.duration._ + +class SubmitChange extends GerritSimulation { + private val data: FeederBuilder = jsonFile(resource).convert(keys).queue + private val default: String = name + + private val test: ScenarioBuilder = scenario(unique) + .feed(data) + .exec(session => { + session.set("number", createChange.number) + }) + .exec(http(unique).post("${url}${number}/submit")) + + private val createProject = new CreateProject(default) + private val createChange = new CreateChange(default) + private val approveChange = new ApproveChange(createChange) + private val deleteProject = new DeleteProject(default) + + setUp( + createProject.test.inject( + nothingFor(stepWaitTime(createProject) seconds), + atOnceUsers(1) + ), + createChange.test.inject( + nothingFor(stepWaitTime(createChange) seconds), + atOnceUsers(1) + ), + approveChange.test.inject( + nothingFor(stepWaitTime(approveChange) seconds), + atOnceUsers(1) + ), + test.inject( + nothingFor(stepWaitTime(this) seconds), + atOnceUsers(1) + ), + deleteProject.test.inject( + nothingFor(stepWaitTime(deleteProject) seconds), + atOnceUsers(1) + ), + ).protocols(httpProtocol) +} -- cgit v1.2.3 From 8f96af906728a57bc4949cfd909cd58a6bf2a5e8 Mon Sep 17 00:00:00 2001 From: Luca Milanesio Date: Thu, 28 May 2020 06:04:11 +0100 Subject: Update git submodules * Update plugins/replication from branch 'stable-2.16' to a46a886822c8fab3cbcbbabbff250ba69f640563 - Improve project creation replication integration test Make sure project creation is correctly managed and tested, asserting that the repository contains at least one ref replicated and not just the bare repo showing up. Change-Id: I0fdc1e73390c2abd3e40d2a02fd7e4ce7f20bb67 --- plugins/replication | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/replication b/plugins/replication index 2cb6112e08..a46a886822 160000 --- a/plugins/replication +++ b/plugins/replication @@ -1 +1 @@ -Subproject commit 2cb6112e081e97d4dfd8e677b6f02c779db95e85 +Subproject commit a46a886822c8fab3cbcbbabbff250ba69f640563 -- cgit v1.2.3 From 52ac1dacc728af2658b9c8cd1a48607956ee9939 Mon Sep 17 00:00:00 2001 From: Luca Milanesio Date: Thu, 28 May 2020 06:04:24 +0100 Subject: Update git submodules * Update plugins/replication from branch 'stable-2.16' to 564ed20845bab16e8df7366813a23b56b62b95d2 - Fix replication of project deletion Fix a regression where the project deletion was not propagated to the remote nodes because its associated project state was missing from the project cache. When replicating deletions, the project state is not present as the replication plugin is receiving the deletions ex-post and therefore do not have access to the project anymore. The associated checks for project visibility and read only state are not valid for project deletions. Bug: Issue 12806 Change-Id: I7a9ac01b01d5dd40b8bf0c4d3347256f430329ac --- plugins/replication | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/replication b/plugins/replication index a46a886822..564ed20845 160000 --- a/plugins/replication +++ b/plugins/replication @@ -1 +1 @@ -Subproject commit a46a886822c8fab3cbcbbabbff250ba69f640563 +Subproject commit 564ed20845bab16e8df7366813a23b56b62b95d2 -- cgit v1.2.3 From ec6456dee4f1bcfdf8f21c3afda6f8b77c9e4bc3 Mon Sep 17 00:00:00 2001 From: Luca Milanesio Date: Thu, 28 May 2020 06:38:07 +0100 Subject: Update git submodules * Update plugins/replication from branch 'stable-3.0' to 562976a0a38e21e4a54026d910b17fa3060c2f4a - Merge branch 'stable-2.16' into stable-3.0 * stable-2.16: Fix replication of project deletion Improve project creation replication integration test Change-Id: I1818511118ed1738cf76d48cb49b66a52f1d83c8 - Fix replication of project deletion Fix a regression where the project deletion was not propagated to the remote nodes because its associated project state was missing from the project cache. When replicating deletions, the project state is not present as the replication plugin is receiving the deletions ex-post and therefore do not have access to the project anymore. The associated checks for project visibility and read only state are not valid for project deletions. Bug: Issue 12806 Change-Id: I7a9ac01b01d5dd40b8bf0c4d3347256f430329ac - Improve project creation replication integration test Make sure project creation is correctly managed and tested, asserting that the repository contains at least one ref replicated and not just the bare repo showing up. Change-Id: I0fdc1e73390c2abd3e40d2a02fd7e4ce7f20bb67 --- plugins/replication | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/replication b/plugins/replication index cb61577630..562976a0a3 160000 --- a/plugins/replication +++ b/plugins/replication @@ -1 +1 @@ -Subproject commit cb61577630f52e90234f054bf596cc495e12f576 +Subproject commit 562976a0a38e21e4a54026d910b17fa3060c2f4a -- cgit v1.2.3 From d6dfdf821330fc1a2327f57d83924e5c646fba77 Mon Sep 17 00:00:00 2001 From: Luca Milanesio Date: Thu, 28 May 2020 06:39:52 +0100 Subject: Update git submodules * Update plugins/replication from branch 'stable-3.1' to e10dac7b5ab1dd9ed690c97d74b154bb7a9f1ea5 - Merge branch 'stable-3.0' into stable-3.1 * stable-3.0: Fix replication of project deletion Improve project creation replication integration test Change-Id: Id1a8412e6bfc09e6e22ddb236c37472bd7e5df96 - Merge branch 'stable-2.16' into stable-3.0 * stable-2.16: Fix replication of project deletion Improve project creation replication integration test Change-Id: I1818511118ed1738cf76d48cb49b66a52f1d83c8 - Fix replication of project deletion Fix a regression where the project deletion was not propagated to the remote nodes because its associated project state was missing from the project cache. When replicating deletions, the project state is not present as the replication plugin is receiving the deletions ex-post and therefore do not have access to the project anymore. The associated checks for project visibility and read only state are not valid for project deletions. Bug: Issue 12806 Change-Id: I7a9ac01b01d5dd40b8bf0c4d3347256f430329ac - Improve project creation replication integration test Make sure project creation is correctly managed and tested, asserting that the repository contains at least one ref replicated and not just the bare repo showing up. Change-Id: I0fdc1e73390c2abd3e40d2a02fd7e4ce7f20bb67 --- plugins/replication | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/replication b/plugins/replication index 5316fcbd13..e10dac7b5a 160000 --- a/plugins/replication +++ b/plugins/replication @@ -1 +1 @@ -Subproject commit 5316fcbd139760efa87e0bbf95ac110bc6117645 +Subproject commit e10dac7b5ab1dd9ed690c97d74b154bb7a9f1ea5 -- cgit v1.2.3 From 7c6f3ab5cee30f9d47d1b246c3770d0fb7472c9d Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Fri, 29 May 2020 14:52:35 +0900 Subject: Update git submodules * Update plugins/replication from branch 'stable-3.0' to 2622a644d964c0c5903055c0b018fffcc6adf6ee - Make SecureCredentialsFactory public This allows it to be used in implementations that extend the replication plugin. Change-Id: Id81f5986f24720b9575c1987c21b2ae9672ddd37 --- plugins/replication | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/replication b/plugins/replication index 562976a0a3..2622a644d9 160000 --- a/plugins/replication +++ b/plugins/replication @@ -1 +1 @@ -Subproject commit 562976a0a38e21e4a54026d910b17fa3060c2f4a +Subproject commit 2622a644d964c0c5903055c0b018fffcc6adf6ee -- cgit v1.2.3 From a1e53f581ef3534e43101d0d567300219ef9f9b2 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Fri, 29 May 2020 16:04:50 +0900 Subject: Update git submodules * Update plugins/replication from branch 'stable-3.1' to 2fbc9a44324fc2cfc4f4ba6e916a3c487f997216 - Merge branch 'stable-3.0' into stable-3.1 * stable-3.0: Make SecureCredentialsFactory public Change-Id: I4dfd9e37da5e67ee7efb4a2657da014e9d35bbc0 - Make SecureCredentialsFactory public This allows it to be used in implementations that extend the replication plugin. Change-Id: Id81f5986f24720b9575c1987c21b2ae9672ddd37 --- plugins/replication | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/replication b/plugins/replication index e10dac7b5a..2fbc9a4432 160000 --- a/plugins/replication +++ b/plugins/replication @@ -1 +1 @@ -Subproject commit e10dac7b5ab1dd9ed690c97d74b154bb7a9f1ea5 +Subproject commit 2fbc9a44324fc2cfc4f4ba6e916a3c487f997216 -- cgit v1.2.3 From 2d9a44d5f50696746b14df00025f68fb2613a92d Mon Sep 17 00:00:00 2001 From: Christian Aistleitner Date: Fri, 29 May 2020 16:41:01 +0200 Subject: Set Api version for plugin jars Since we did not set the Api in the manifest per default, most built plugins do not expose the Api version they got against. Yet this version would help with upgrades as it would help to assure the correct plugins are in place. This holds especially true, where a single commit of a plugin gets used to build for different Api versions (E.g.: commit-message-length-validator). The Api version in the jar is currently only shown in a plugin's about page. Change-Id: I0a786a911474a7024a63227f6d28be664c88af18 --- tools/bzl/plugin.bzl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/bzl/plugin.bzl b/tools/bzl/plugin.bzl index ef2963e745..40a361346d 100644 --- a/tools/bzl/plugin.bzl +++ b/tools/bzl/plugin.bzl @@ -1,5 +1,6 @@ load("@rules_java//java:defs.bzl", "java_binary", "java_library") load("//tools/bzl:genrule2.bzl", "genrule2") +load("//:version.bzl", "GERRIT_VERSION") load( "//tools/bzl:gwt.bzl", "GWT_COMPILER_ARGS", @@ -103,7 +104,7 @@ def gerrit_plugin( "GEN_VERSION=$$(cat bazel-out/stable-status.txt | grep -w STABLE_BUILD_%s_LABEL | cut -d ' ' -f 2)" % dir_name.upper(), "cd $$TMP", "unzip -q $$ROOT/$<", - "echo \"Implementation-Version: $$GEN_VERSION\n$$(cat META-INF/MANIFEST.MF)\" > META-INF/MANIFEST.MF", + "echo \"Implementation-Version: $$GEN_VERSION\nGerrit-ApiVersion: " + GERRIT_VERSION + "\n$$(cat META-INF/MANIFEST.MF)\" > META-INF/MANIFEST.MF", "find . -exec touch '{}' ';'", "zip -Xqr $$ROOT/$@ .", ]), -- cgit v1.2.3 From d505dccf5c438868ab0a1192d066a9500fb04ff3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C5=A1a=20=C5=BDivkov?= Date: Thu, 28 May 2020 17:50:58 +0200 Subject: Update account full name when it changes in LDAP The LdapRealm declares the FULL_NAME as a read-only account field and the read-only policy is enforced when update request comes via the REST API [1]. However, the same read-only policy was also enforced in the AccountManager code which is actually executed after we authenticate a user against LDAP. Thus, if someone's name changes in LDAP, Gerrit rejected to update the full name of that user on the next login. We already had several such cases and had to update the full name manually in the All-Users repository. I believe that we should accept the (new) full name as returned by LDAP and unconditionally update it in Gerrit. [1] https://gerrit.googlesource.com/gerrit/+/52ac1dacc728af2658b9c8cd1a48607956ee9939/java/com/google/gerrit/server/restapi/account/PutName.java#86 Bug: Issue 12844 Change-Id: I9bf7187c9302fa8e24e724b497cdd9a05e6e2b00 --- .../gerrit/server/account/AccountManager.java | 12 ++---- .../acceptance/api/accounts/AccountManagerIT.java | 39 +++++++++++++++++- .../google/gerrit/acceptance/api/accounts/BUILD | 10 +++++ .../gerrit/acceptance/api/accounts/TestRealm.java | 46 ++++++++++++++++++++++ 4 files changed, 98 insertions(+), 9 deletions(-) create mode 100644 javatests/com/google/gerrit/acceptance/api/accounts/TestRealm.java diff --git a/java/com/google/gerrit/server/account/AccountManager.java b/java/com/google/gerrit/server/account/AccountManager.java index 713c1c4b8a..fcf9c6ba32 100644 --- a/java/com/google/gerrit/server/account/AccountManager.java +++ b/java/com/google/gerrit/server/account/AccountManager.java @@ -17,6 +17,7 @@ package com.google.gerrit.server.account; import static com.google.common.base.Preconditions.checkArgument; import static com.google.gerrit.server.account.externalids.ExternalId.SCHEME_USERNAME; +import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Strings; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; @@ -77,8 +78,9 @@ public class AccountManager { private final boolean autoUpdateAccountActiveStatus; private final SetInactiveFlag setInactiveFlag; + @VisibleForTesting @Inject - AccountManager( + public AccountManager( Sequences sequences, @GerritServerConfig Config cfg, Accounts accounts, @@ -238,13 +240,7 @@ public class AccountManager { if (!Strings.isNullOrEmpty(who.getDisplayName()) && !Objects.equals(user.getAccount().getFullName(), who.getDisplayName())) { - if (realm.allowsEdit(AccountFieldName.FULL_NAME)) { - accountUpdates.add(a -> a.setFullName(who.getDisplayName())); - } else { - logger.atWarning().log( - "Not changing already set display name '%s' to '%s'", - user.getAccount().getFullName(), who.getDisplayName()); - } + accountUpdates.add(a -> a.setFullName(who.getDisplayName())); } if (!realm.allowsEdit(AccountFieldName.USER_NAME) diff --git a/javatests/com/google/gerrit/acceptance/api/accounts/AccountManagerIT.java b/javatests/com/google/gerrit/acceptance/api/accounts/AccountManagerIT.java index b5bab32506..36c4da16d6 100644 --- a/javatests/com/google/gerrit/acceptance/api/accounts/AccountManagerIT.java +++ b/javatests/com/google/gerrit/acceptance/api/accounts/AccountManagerIT.java @@ -22,7 +22,9 @@ import com.google.common.collect.ImmutableSet; import com.google.gerrit.acceptance.AbstractDaemonTest; import com.google.gerrit.acceptance.GerritConfig; import com.google.gerrit.common.Nullable; +import com.google.gerrit.extensions.client.AccountFieldName; import com.google.gerrit.reviewdb.client.Account; +import com.google.gerrit.server.IdentifiedUser; import com.google.gerrit.server.Sequences; import com.google.gerrit.server.ServerInitiated; import com.google.gerrit.server.account.AccountException; @@ -31,11 +33,15 @@ import com.google.gerrit.server.account.AccountState; import com.google.gerrit.server.account.AccountsUpdate; import com.google.gerrit.server.account.AuthRequest; import com.google.gerrit.server.account.AuthResult; +import com.google.gerrit.server.account.SetInactiveFlag; import com.google.gerrit.server.account.externalids.ExternalId; import com.google.gerrit.server.account.externalids.ExternalIdNotes; import com.google.gerrit.server.account.externalids.ExternalIds; import com.google.gerrit.server.git.meta.MetaDataUpdate; +import com.google.gerrit.server.group.db.GroupsUpdate; +import com.google.gerrit.server.ssh.SshKeyCache; import com.google.inject.Inject; +import com.google.inject.util.Providers; import java.util.Optional; import java.util.Set; import org.eclipse.jgit.lib.Repository; @@ -48,6 +54,12 @@ public class AccountManagerIT extends AbstractDaemonTest { @Inject @ServerInitiated private AccountsUpdate accountsUpdate; @Inject private ExternalIdNotes.Factory extIdNotesFactory; + @Inject private Sequences sequences; + @Inject private IdentifiedUser.GenericFactory userFactory; + @Inject private SshKeyCache sshKeyCache; + @Inject private GroupsUpdate.Factory groupsUpdateFactory; + @Inject private SetInactiveFlag setInactiveFlag; + @Test public void authenticateNewAccountWithEmail() throws Exception { String email = "foo@example.com"; @@ -197,6 +209,31 @@ public class AccountManagerIT extends AbstractDaemonTest { @Test public void authenticateWithUsernameAndUpdateDisplayName() throws Exception { + authenticateWithUsernameAndUpdateDisplayName(accountManager); + } + + @Test + public void readOnlyFullNameField_authenticateWithUsernameAndUpdateDisplayName() + throws Exception { + TestRealm realm = server.getTestInjector().getInstance(TestRealm.class); + realm.denyEdit(AccountFieldName.FULL_NAME); + authenticateWithUsernameAndUpdateDisplayName( + new AccountManager( + sequences, + cfg, + accounts, + Providers.of(accountsUpdate), + accountCache, + realm, + userFactory, + sshKeyCache, + projectCache, + externalIds, + groupsUpdateFactory, + setInactiveFlag)); + } + + private void authenticateWithUsernameAndUpdateDisplayName(AccountManager am) throws Exception { String username = "foo"; String email = "foo@example.com"; Account.Id accountId = new Account.Id(seq.nextAccountId()); @@ -212,7 +249,7 @@ public class AccountManagerIT extends AbstractDaemonTest { AuthRequest who = AuthRequest.forUser(username); String newName = "Updated Name"; who.setDisplayName(newName); - AuthResult authResult = accountManager.authenticate(who); + AuthResult authResult = am.authenticate(who); assertAuthResultForExistingAccount(authResult, accountId, gerritExtIdKey); Optional accountState = accounts.get(accountId); diff --git a/javatests/com/google/gerrit/acceptance/api/accounts/BUILD b/javatests/com/google/gerrit/acceptance/api/accounts/BUILD index 31f3f91fce..ad2bfa6a77 100644 --- a/javatests/com/google/gerrit/acceptance/api/accounts/BUILD +++ b/javatests/com/google/gerrit/acceptance/api/accounts/BUILD @@ -9,7 +9,17 @@ acceptance_tests( "no_windows", ], deps = [ + ":util", "//java/com/google/gerrit/mail", "//java/com/google/gerrit/server/util/time", ], ) + +java_library( + name = "util", + testonly = True, + srcs = glob(["TestRealm.java"]), + deps = [ + "//java/com/google/gerrit/acceptance:lib", + ], +) diff --git a/javatests/com/google/gerrit/acceptance/api/accounts/TestRealm.java b/javatests/com/google/gerrit/acceptance/api/accounts/TestRealm.java new file mode 100644 index 0000000000..94b6cd38ba --- /dev/null +++ b/javatests/com/google/gerrit/acceptance/api/accounts/TestRealm.java @@ -0,0 +1,46 @@ +// Copyright (C) 2020 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package com.google.gerrit.acceptance.api.accounts; + +import com.google.gerrit.extensions.client.AccountFieldName; +import com.google.gerrit.server.account.DefaultRealm; +import com.google.gerrit.server.account.EmailExpander; +import com.google.gerrit.server.account.Emails; +import com.google.gerrit.server.config.AuthConfig; +import com.google.inject.Inject; +import com.google.inject.Provider; +import com.google.inject.Singleton; +import java.util.HashSet; +import java.util.Set; + +@Singleton +public class TestRealm extends DefaultRealm { + + private final Set readOnlyFields = new HashSet<>(); + + @Inject + public TestRealm(EmailExpander emailExpander, Provider emails, AuthConfig authConfig) { + super(emailExpander, emails, authConfig); + } + + public void denyEdit(AccountFieldName field) { + readOnlyFields.add(field); + } + + @Override + public boolean allowsEdit(AccountFieldName field) { + return !readOnlyFields.contains(field); + } +} -- cgit v1.2.3 From c475b57ba17ca4100c624568b29f2dfc51ab9a61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C5=A1a=20=C5=BDivkov?= Date: Wed, 27 May 2020 16:45:13 +0200 Subject: Trim parameterized strings evaluated from LdapRealm The fullName attribute is computed based on the following parameterized string: "${givenName} ${sn}" for Active Directory LDAP. If the "sn" attribute is not set for a user in LDAP then the result of this evaluation will end with a whitespace which is ugly for a full name. Change-Id: Ic4ae0a47417d401a223c059c5ba7a35309aa2c58 --- java/com/google/gerrit/server/auth/ldap/LdapRealm.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/com/google/gerrit/server/auth/ldap/LdapRealm.java b/java/com/google/gerrit/server/auth/ldap/LdapRealm.java index b047488097..be6303dfca 100644 --- a/java/com/google/gerrit/server/auth/ldap/LdapRealm.java +++ b/java/com/google/gerrit/server/auth/ldap/LdapRealm.java @@ -217,7 +217,7 @@ class LdapRealm extends AbstractRealm { values.put(name, m.get(name)); } - String r = p.replace(values); + String r = p.replace(values).trim(); return r.isEmpty() ? null : r; } -- cgit v1.2.3 From 4fdf6a1a6a667066a4c48172e89d45d8b640f350 Mon Sep 17 00:00:00 2001 From: Luca Milanesio Date: Fri, 29 May 2020 22:26:48 +0000 Subject: Set version to 2.16.20 Change-Id: I092ad1f31434d754f9b2c39c91d04d2d0ab5072b --- tools/maven/gerrit-acceptance-framework_pom.xml | 2 +- tools/maven/gerrit-extension-api_pom.xml | 2 +- tools/maven/gerrit-plugin-api_pom.xml | 2 +- tools/maven/gerrit-plugin-gwtui_pom.xml | 2 +- tools/maven/gerrit-war_pom.xml | 2 +- version.bzl | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/maven/gerrit-acceptance-framework_pom.xml b/tools/maven/gerrit-acceptance-framework_pom.xml index b4e1124f44..19cbe28ee3 100644 --- a/tools/maven/gerrit-acceptance-framework_pom.xml +++ b/tools/maven/gerrit-acceptance-framework_pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.google.gerrit gerrit-acceptance-framework - 2.16.20-SNAPSHOT + 2.16.20 jar Gerrit Code Review - Acceptance Test Framework Framework for Gerrit's acceptance tests diff --git a/tools/maven/gerrit-extension-api_pom.xml b/tools/maven/gerrit-extension-api_pom.xml index 77fe0a4ebd..71e09f488a 100644 --- a/tools/maven/gerrit-extension-api_pom.xml +++ b/tools/maven/gerrit-extension-api_pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.google.gerrit gerrit-extension-api - 2.16.20-SNAPSHOT + 2.16.20 jar Gerrit Code Review - Extension API API for Gerrit Extensions diff --git a/tools/maven/gerrit-plugin-api_pom.xml b/tools/maven/gerrit-plugin-api_pom.xml index 796d9b9c82..24fc17a408 100644 --- a/tools/maven/gerrit-plugin-api_pom.xml +++ b/tools/maven/gerrit-plugin-api_pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.google.gerrit gerrit-plugin-api - 2.16.20-SNAPSHOT + 2.16.20 jar Gerrit Code Review - Plugin API API for Gerrit Plugins diff --git a/tools/maven/gerrit-plugin-gwtui_pom.xml b/tools/maven/gerrit-plugin-gwtui_pom.xml index 4e2dc4de54..48ce5ed900 100644 --- a/tools/maven/gerrit-plugin-gwtui_pom.xml +++ b/tools/maven/gerrit-plugin-gwtui_pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.google.gerrit gerrit-plugin-gwtui - 2.16.20-SNAPSHOT + 2.16.20 jar Gerrit Code Review - Plugin GWT UI Common Classes for Gerrit GWT UI Plugins diff --git a/tools/maven/gerrit-war_pom.xml b/tools/maven/gerrit-war_pom.xml index 26763048c8..064b6c4a94 100644 --- a/tools/maven/gerrit-war_pom.xml +++ b/tools/maven/gerrit-war_pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.google.gerrit gerrit-war - 2.16.20-SNAPSHOT + 2.16.20 war Gerrit Code Review - WAR Gerrit WAR diff --git a/version.bzl b/version.bzl index 5a4e53221c..182861429a 100644 --- a/version.bzl +++ b/version.bzl @@ -2,4 +2,4 @@ # Used by :api_install and :api_deploy targets # when talking to the destination repository. # -GERRIT_VERSION = "2.16.20-SNAPSHOT" +GERRIT_VERSION = "2.16.20" -- cgit v1.2.3 From 2ba0f27106f321ae59d470c8808c9fb054c648ad Mon Sep 17 00:00:00 2001 From: Luca Milanesio Date: Fri, 29 May 2020 23:22:30 +0000 Subject: Set version to 2.16.21-SNAPSHOT Change-Id: If2a3928250070ed24247f751649e0417694a9a77 --- tools/maven/gerrit-acceptance-framework_pom.xml | 2 +- tools/maven/gerrit-extension-api_pom.xml | 2 +- tools/maven/gerrit-plugin-api_pom.xml | 2 +- tools/maven/gerrit-plugin-gwtui_pom.xml | 2 +- tools/maven/gerrit-war_pom.xml | 2 +- version.bzl | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/maven/gerrit-acceptance-framework_pom.xml b/tools/maven/gerrit-acceptance-framework_pom.xml index 19cbe28ee3..a68d2a1794 100644 --- a/tools/maven/gerrit-acceptance-framework_pom.xml +++ b/tools/maven/gerrit-acceptance-framework_pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.google.gerrit gerrit-acceptance-framework - 2.16.20 + 2.16.21-SNAPSHOT jar Gerrit Code Review - Acceptance Test Framework Framework for Gerrit's acceptance tests diff --git a/tools/maven/gerrit-extension-api_pom.xml b/tools/maven/gerrit-extension-api_pom.xml index 71e09f488a..585ce55925 100644 --- a/tools/maven/gerrit-extension-api_pom.xml +++ b/tools/maven/gerrit-extension-api_pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.google.gerrit gerrit-extension-api - 2.16.20 + 2.16.21-SNAPSHOT jar Gerrit Code Review - Extension API API for Gerrit Extensions diff --git a/tools/maven/gerrit-plugin-api_pom.xml b/tools/maven/gerrit-plugin-api_pom.xml index 24fc17a408..e5611c2359 100644 --- a/tools/maven/gerrit-plugin-api_pom.xml +++ b/tools/maven/gerrit-plugin-api_pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.google.gerrit gerrit-plugin-api - 2.16.20 + 2.16.21-SNAPSHOT jar Gerrit Code Review - Plugin API API for Gerrit Plugins diff --git a/tools/maven/gerrit-plugin-gwtui_pom.xml b/tools/maven/gerrit-plugin-gwtui_pom.xml index 48ce5ed900..489ca3c5ca 100644 --- a/tools/maven/gerrit-plugin-gwtui_pom.xml +++ b/tools/maven/gerrit-plugin-gwtui_pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.google.gerrit gerrit-plugin-gwtui - 2.16.20 + 2.16.21-SNAPSHOT jar Gerrit Code Review - Plugin GWT UI Common Classes for Gerrit GWT UI Plugins diff --git a/tools/maven/gerrit-war_pom.xml b/tools/maven/gerrit-war_pom.xml index 064b6c4a94..5cf22b1209 100644 --- a/tools/maven/gerrit-war_pom.xml +++ b/tools/maven/gerrit-war_pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.google.gerrit gerrit-war - 2.16.20 + 2.16.21-SNAPSHOT war Gerrit Code Review - WAR Gerrit WAR diff --git a/version.bzl b/version.bzl index 182861429a..2ed20a8876 100644 --- a/version.bzl +++ b/version.bzl @@ -2,4 +2,4 @@ # Used by :api_install and :api_deploy targets # when talking to the destination repository. # -GERRIT_VERSION = "2.16.20" +GERRIT_VERSION = "2.16.21-SNAPSHOT" -- cgit v1.2.3 From f34f4b3b2da8324953c0e16d264e20d843579074 Mon Sep 17 00:00:00 2001 From: Paladox none Date: Sat, 30 May 2020 14:30:28 +0000 Subject: Fix gr-label-info test Change-Id: Ie56521970490c6d8fd16ab7ea8af46d895d7baff --- .../app/elements/shared/gr-label-info/gr-label-info_test.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info_test.html b/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info_test.html index 9cdd57cb8c..e6e72d26c7 100644 --- a/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info_test.html +++ b/polygerrit-ui/app/elements/shared/gr-label-info/gr-label-info_test.html @@ -229,9 +229,9 @@ limitations under the License. assert.isTrue(isHidden(element.$$('.placeholder'))); element.labelInfo = {values: [], rejected: [], all: [{value: 1}]}; assert.isTrue(isHidden(element.$$('.placeholder'))); - element.labelInfo = {accepted: []}; + element.labelInfo = {approved: []}; assert.isTrue(isHidden(element.$$('.placeholder'))); - element.labelInfo = {values: [], accepted: [], all: [{value: 1}]}; + element.labelInfo = {values: [], approved: [], all: [{value: 1}]}; assert.isTrue(isHidden(element.$$('.placeholder'))); }); }); -- cgit v1.2.3 From 5d18fabc04500626b4765a88cff28cab2a24ddf2 Mon Sep 17 00:00:00 2001 From: Antonio Barone Date: Mon, 1 Jun 2020 01:29:43 +0100 Subject: Update git submodules * Update plugins/replication from branch 'stable-2.16' to 815d1f5626761e03e46e0efb7bc4cf91d8b9732f - Make SecureCredentialsFactory public Access to secure.config is useful to more than just replication plugin. Allow instantiating this class from packages other than replication plugin. Specifically this is useful, as this class can be used from pull-replication too. Change-Id: Id268c869e993c6cabacfa0043ec269172e0efba1 (cherry picked from commit c09a7c08fb44094c7475313ac52154adac39a54c) --- plugins/replication | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/replication b/plugins/replication index 564ed20845..815d1f5626 160000 --- a/plugins/replication +++ b/plugins/replication @@ -1 +1 @@ -Subproject commit 564ed20845bab16e8df7366813a23b56b62b95d2 +Subproject commit 815d1f5626761e03e46e0efb7bc4cf91d8b9732f -- cgit v1.2.3 From 4f54cd4a415cd0ec1a960fa143e71e32499b2135 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Mon, 1 Jun 2020 11:01:47 +0900 Subject: Update git submodules * Update plugins/replication from branch 'stable-3.0' to 116cbc11573e7afb0ce0782518a172cf798ec15c - Merge branch 'stable-2.16' into stable-3.0 * stable-2.16: Make SecureCredentialsFactory public Change-Id: I757ba1004ce2a851c7857762b178de9294deae21 - Make SecureCredentialsFactory public Access to secure.config is useful to more than just replication plugin. Allow instantiating this class from packages other than replication plugin. Specifically this is useful, as this class can be used from pull-replication too. Change-Id: Id268c869e993c6cabacfa0043ec269172e0efba1 (cherry picked from commit c09a7c08fb44094c7475313ac52154adac39a54c) --- plugins/replication | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/replication b/plugins/replication index 2622a644d9..116cbc1157 160000 --- a/plugins/replication +++ b/plugins/replication @@ -1 +1 @@ -Subproject commit 2622a644d964c0c5903055c0b018fffcc6adf6ee +Subproject commit 116cbc11573e7afb0ce0782518a172cf798ec15c -- cgit v1.2.3 From 7bfa1c320b96ffca50e6479ffcb61c5310cd6077 Mon Sep 17 00:00:00 2001 From: Christian Aistleitner Date: Sun, 31 May 2020 15:27:12 +0200 Subject: When writing temporary plugin files, ensure the directory exists When adding plugins as streams in PluginIT (which upcoming commits will do), installing the plugin failed, as the temporary directory does not exist. Instead of fixing the caller of `asTemp` to create the directory before the call, we instead change `asTemp` itself to create the directory, and can thereby simplify other callers, which also manually create the directory. Change-Id: If7962ee2898f52c0db43cf030528a82530a2442b --- java/com/google/gerrit/server/plugins/JarPluginProvider.java | 3 --- java/com/google/gerrit/server/plugins/PluginUtil.java | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/java/com/google/gerrit/server/plugins/JarPluginProvider.java b/java/com/google/gerrit/server/plugins/JarPluginProvider.java index 5b800596ee..82f97c95e6 100644 --- a/java/com/google/gerrit/server/plugins/JarPluginProvider.java +++ b/java/com/google/gerrit/server/plugins/JarPluginProvider.java @@ -110,9 +110,6 @@ public class JarPluginProvider implements ServerPluginProvider { public static Path storeInTemp(String pluginName, InputStream in, SitePaths sitePaths) throws IOException { - if (!Files.exists(sitePaths.tmp_dir)) { - Files.createDirectories(sitePaths.tmp_dir); - } return PluginUtil.asTemp(in, tempNameFor(pluginName), ".jar", sitePaths.tmp_dir); } diff --git a/java/com/google/gerrit/server/plugins/PluginUtil.java b/java/com/google/gerrit/server/plugins/PluginUtil.java index d4110ca8d2..932a01d143 100644 --- a/java/com/google/gerrit/server/plugins/PluginUtil.java +++ b/java/com/google/gerrit/server/plugins/PluginUtil.java @@ -53,6 +53,7 @@ public class PluginUtil { } static Path asTemp(InputStream in, String prefix, String suffix, Path dir) throws IOException { + Files.createDirectories(dir); Path tmp = Files.createTempFile(dir, prefix, suffix); boolean keep = false; try (OutputStream out = Files.newOutputStream(tmp)) { -- cgit v1.2.3