├── .gitreview ├── src ├── main │ ├── webapp │ │ └── icons │ │ │ ├── gerrit-logo-16x16.png │ │ │ ├── gerrit-logo-24x24.png │ │ │ ├── gerrit-logo-32x32.png │ │ │ └── gerrit-logo-48x48.png │ ├── resources │ │ ├── jenkins │ │ │ └── plugins │ │ │ │ └── gerrit │ │ │ │ ├── GerritSCMNavigator │ │ │ │ ├── config_en.properties │ │ │ │ ├── help-insecureHttps.html │ │ │ │ ├── help-serverUri.html │ │ │ │ ├── help-apiKey.html │ │ │ │ ├── help-credentialsId.html │ │ │ │ └── config.jelly │ │ │ │ ├── GerritSCMSource │ │ │ │ ├── config-detail_en.properties │ │ │ │ ├── help-insecureHttps.html │ │ │ │ ├── help-apiKey.html │ │ │ │ ├── help-credentialsId.html │ │ │ │ ├── help-remote.html │ │ │ │ └── config-detail.jelly │ │ │ │ ├── Messages.properties │ │ │ │ └── traits │ │ │ │ ├── FilterChecksTrait │ │ │ │ ├── help-queryString.html │ │ │ │ └── config.jelly │ │ │ │ ├── ChangeDiscoveryTrait │ │ │ │ ├── config.jelly │ │ │ │ └── help-queryString.html │ │ │ │ └── Messages.properties │ │ └── index.jelly │ └── java │ │ ├── jenkins │ │ └── plugins │ │ │ └── gerrit │ │ │ ├── RefUpdateProjectName.java │ │ │ ├── GerritProjectName.java │ │ │ ├── GerritWebHookCrumbExclusion.java │ │ │ ├── GerritSCMNavigatorContext.java │ │ │ ├── GerritSCMNavigatorRequest.java │ │ │ ├── PendingChecksFilter.java │ │ │ ├── NullPrintStream.java │ │ │ ├── GerritProjectEvent.java │ │ │ ├── FakeTaskListener.java │ │ │ ├── ChangeSCMRevision.java │ │ │ ├── GerritVersion.java │ │ │ ├── GerritChange.java │ │ │ ├── ProjectChanges.java │ │ │ ├── GerritSCMSourceBuilder.java │ │ │ ├── UsernamePasswordCredentialsProvider.java │ │ │ ├── GerritLogo.java │ │ │ ├── SSLNoVerifyCertificateManagerClientBuilderExtension.java │ │ │ ├── ChangeSCMHead.java │ │ │ ├── UserAgentClientBuilderExtension.java │ │ │ ├── traits │ │ │ ├── ChangeDiscoveryTrait.java │ │ │ └── FilterChecksTrait.java │ │ │ ├── PagedCodeProjectsRequest.java │ │ │ ├── GerritSCMSourceContext.java │ │ │ ├── GerritSCMSourceRequest.java │ │ │ ├── workflow │ │ │ ├── GerritCommentStep.java │ │ │ ├── GerritCheckStep.java │ │ │ └── GerritReviewStep.java │ │ │ ├── GerritURI.java │ │ │ └── GerritApiBuilder.java │ │ └── com │ │ └── google │ │ └── gerrit │ │ └── plugins │ │ └── checks │ │ ├── api │ │ ├── CheckablePatchSetInfo.java │ │ ├── BlockingCondition.java │ │ ├── CheckerInput.java │ │ ├── PendingChecksInfo.java │ │ ├── CheckerStatus.java │ │ ├── PendingCheckInfo.java │ │ ├── RerunInput.java │ │ ├── CheckerInfo.java │ │ ├── CheckState.java │ │ ├── CheckInput.java │ │ └── CheckInfo.java │ │ └── client │ │ ├── GerritChecksApi.java │ │ ├── UTCTimestampTypeAdapter.java │ │ ├── AbstractEndpoint.java │ │ ├── GerritChecksApiBuilder.java │ │ ├── PendingChecks.java │ │ ├── Checkers.java │ │ └── Checks.java └── test │ └── java │ ├── hudson │ └── util │ │ └── TestSecret.java │ └── jenkins │ └── plugins │ └── gerrit │ ├── AbstractGerritSCMSourceTest.java │ ├── ChangeSCMRevisionTest.java │ ├── GerritProjectEventTest.java │ ├── GerritChangeTest.java │ ├── GerritSCMNavigatorDescriptorTest.java │ ├── PagedCodeProjectsRequestTest.java │ ├── GerritApiBuilderTest.java │ ├── ChecksTest.java │ ├── GerritWebHookTest.java │ ├── GerritVersionTest.java │ ├── GerritMockServerRule.java │ ├── GerritURITest.java │ ├── PendingChecksFilterTests.java │ ├── workflow │ └── GerritCommentStepTest.java │ ├── GerritSCMNavigatorTest.java │ └── GerritEnvironmentContributorTest.java ├── BUILD.md ├── .gitignore └── Jenkinsfile /.gitreview: -------------------------------------------------------------------------------- 1 | [gerrit] 2 | host=review.gerrithub.io 3 | port=29418 4 | project=jenkinsci/gerrit-code-review-plugin.git 5 | -------------------------------------------------------------------------------- /src/main/webapp/icons/gerrit-logo-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jenkinsci/gerrit-code-review-plugin/HEAD/src/main/webapp/icons/gerrit-logo-16x16.png -------------------------------------------------------------------------------- /src/main/webapp/icons/gerrit-logo-24x24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jenkinsci/gerrit-code-review-plugin/HEAD/src/main/webapp/icons/gerrit-logo-24x24.png -------------------------------------------------------------------------------- /src/main/webapp/icons/gerrit-logo-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jenkinsci/gerrit-code-review-plugin/HEAD/src/main/webapp/icons/gerrit-logo-32x32.png -------------------------------------------------------------------------------- /src/main/webapp/icons/gerrit-logo-48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jenkinsci/gerrit-code-review-plugin/HEAD/src/main/webapp/icons/gerrit-logo-48x48.png -------------------------------------------------------------------------------- /src/main/resources/jenkins/plugins/gerrit/GerritSCMNavigator/config_en.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jenkinsci/gerrit-code-review-plugin/HEAD/src/main/resources/jenkins/plugins/gerrit/GerritSCMNavigator/config_en.properties -------------------------------------------------------------------------------- /BUILD.md: -------------------------------------------------------------------------------- 1 | ## Building the Plugin 2 | 3 | ```bash 4 | $ java -version # Need Java 1.8, earlier versions are unsupported for build 5 | $ mvn -version # Need a modern maven version; maven 3.2.5 and 3.5.0 are known to work 6 | $ mvn clean install 7 | ``` 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | bin 3 | .classpath 4 | .settings 5 | .project 6 | *.iml 7 | *.ipr 8 | *.iws 9 | work 10 | nbactions.xml 11 | nb-configuration.xml 12 | release.properties 13 | pom.xml.releaseBackup 14 | .idea 15 | *.sublime-project 16 | *.sublime-workspace 17 | *.pem 18 | 19 | # vim 20 | *.swp 21 | Session.vim 22 | /nbproject/ 23 | .DS_Store 24 | -------------------------------------------------------------------------------- /src/main/java/jenkins/plugins/gerrit/RefUpdateProjectName.java: -------------------------------------------------------------------------------- 1 | package jenkins.plugins.gerrit; 2 | 3 | public class RefUpdateProjectName { 4 | String project; 5 | 6 | public RefUpdateProjectName(String project) { 7 | this.project = project; 8 | } 9 | 10 | @Override 11 | public String toString() { 12 | return project; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/resources/jenkins/plugins/gerrit/GerritSCMSource/config-detail_en.properties: -------------------------------------------------------------------------------- 1 | # Copyright (C) 2018 GerritForge Ltd 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | Behaviours=Behaviours 16 | -------------------------------------------------------------------------------- /src/main/resources/jenkins/plugins/gerrit/GerritSCMSource/help-insecureHttps.html: -------------------------------------------------------------------------------- 1 | 16 | 17 |
This status is a property of the checker's configuration; not to be confused with {@code
21 | * CheckState}, which is the state of an individual check performed by a checker against a specific
22 | * change.
23 | */
24 | public enum CheckerStatus {
25 | /** The checker is enabled. */
26 | ENABLED,
27 |
28 | /**
29 | * The checker is disabled, meaning its checks are not displayed alongside any changes, and the
30 | * results are not considered when determining submit requirements.
31 | */
32 | DISABLED
33 | }
34 |
--------------------------------------------------------------------------------
/src/main/resources/jenkins/plugins/gerrit/GerritSCMSource/config-detail.jelly:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 | Provide an additional query string to search for open changes. The status:open is
20 | implicitly added and does not need to be specified.
21 | See Gerrit
23 | search operators documentation
24 | for a detailed list of the supported search operators.
25 |
29 | Checks are pending if they are in a non-final state and the external checker system intends to
25 | * post further updates on them. Which states these are depends on the external checker system, by
26 | * default we only consider checks in state {@link CheckState#NOT_STARTED} as pending.
27 | */
28 | @SuppressFBWarnings("UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD")
29 | public class PendingCheckInfo {
30 | /** State of the check. */
31 | public CheckState state;
32 |
33 | public PendingCheckInfo(CheckState state) {
34 | this.state = state;
35 | }
36 |
37 | @Override
38 | public int hashCode() {
39 | return Objects.hash(state);
40 | }
41 |
42 | @Override
43 | public boolean equals(Object obj) {
44 | if (!(obj instanceof PendingCheckInfo)) {
45 | return false;
46 | }
47 | PendingCheckInfo o = (PendingCheckInfo) obj;
48 | return Objects.equals(state, o.state);
49 | }
50 |
51 | @Override
52 | public String toString() {
53 | return MoreObjects.toStringHelper(this).add("state", state).toString();
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/test/java/jenkins/plugins/gerrit/AbstractGerritSCMSourceTest.java:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2025 GerritForge Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 | package jenkins.plugins.gerrit;
15 |
16 | import java.util.List;
17 | import jenkins.plugins.git.GitSCMBuilder;
18 | import jenkins.scm.api.SCMHead;
19 | import jenkins.scm.impl.mock.MockSCMRevision;
20 | import org.junit.Assert;
21 | import org.junit.Test;
22 |
23 | public class AbstractGerritSCMSourceTest {
24 |
25 | @Test
26 | public void providedRefSpecsAreNotRemoved() {
27 |
28 | SCMHead head = new SCMHead("52/47452/3");
29 | GitSCMBuilder> gitSCMBuilder =
30 | new GitSCMBuilder<>(head, new MockSCMRevision(head, "foo"), "origin", "secret");
31 | gitSCMBuilder.withRefSpec("foo");
32 |
33 | MyGerritSCMSource gerritSCMSource = new MyGerritSCMSource();
34 | gerritSCMSource.decorate(gitSCMBuilder);
35 |
36 | List This state applies to a single check; for the aggregated state associated with a change, see
21 | * CombinedCheckState.
22 | *
23 | * Ordering is not significant in this class, but for consistency's sake the ordering matches
24 | * {@code CombinedCheckState} where applicable.
25 | */
26 | public enum CheckState {
27 | /**
28 | * The check terminated and failed.
29 | *
30 | * Failure may include the following cases:
31 | *
32 | * A check is in progress if the checker is relevant to the change, and the checker system has
69 | * not yet completed the check.
70 | *
71 | * @return whether the state represents an in-progress state.
72 | */
73 | public boolean isInProgress() {
74 | return inProgress;
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/src/main/java/jenkins/plugins/gerrit/GerritLogo.java:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2018 GerritForge Ltd
2 | //
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | //
7 | // http://www.apache.org/licenses/LICENSE-2.0
8 | //
9 | // Unless required by applicable law or agreed to in writing, software
10 | // distributed under the License is distributed on an "AS IS" BASIS,
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | // See the License for the specific language governing permissions and
13 | // limitations under the License.
14 |
15 | package jenkins.plugins.gerrit;
16 |
17 | import jenkins.scm.api.metadata.AvatarMetadataAction;
18 | import org.jenkins.ui.icon.Icon;
19 | import org.jenkins.ui.icon.IconSet;
20 |
21 | /** Gerrit Code Review Logo */
22 | public class GerritLogo extends AvatarMetadataAction {
23 | public static final String ICONS_PREFIX = "plugin/gerrit-code-review/icons/";
24 | public static final String ICON_CLASS_NAME = "icon-gerrit-logo";
25 |
26 | static {
27 | IconSet.icons.addIcon(
28 | new Icon(
29 | "icon-gerrit-logo icon-sm",
30 | ICONS_PREFIX + "gerrit-logo-16x16.png",
31 | Icon.ICON_SMALL_STYLE));
32 | IconSet.icons.addIcon(
33 | new Icon(
34 | "icon-gerrit-logo icon-md",
35 | ICONS_PREFIX + "gerrit-logo-24x24.png",
36 | Icon.ICON_MEDIUM_STYLE));
37 | IconSet.icons.addIcon(
38 | new Icon(
39 | "icon-gerrit-logo icon-lg",
40 | ICONS_PREFIX + "/gerrit-logo-32x32.png",
41 | Icon.ICON_LARGE_STYLE));
42 | IconSet.icons.addIcon(
43 | new Icon(
44 | "icon-gerrit-logo icon-xlg",
45 | ICONS_PREFIX + "/gerrit-logo-48x48.png",
46 | Icon.ICON_XLARGE_STYLE));
47 | }
48 |
49 | /** {@inheritDoc} */
50 | @Override
51 | public String getAvatarIconClassName() {
52 | return ICON_CLASS_NAME;
53 | }
54 |
55 | /** {@inheritDoc} */
56 | @Override
57 | public String getAvatarDescription() {
58 | return Messages.GerritAvatar_IconDescription();
59 | }
60 |
61 | /** {@inheritDoc} */
62 | @Override
63 | public boolean equals(Object o) {
64 | if (this == o) {
65 | return true;
66 | }
67 | if (o == null || getClass() != o.getClass()) {
68 | return false;
69 | }
70 | return true;
71 | }
72 |
73 | /** {@inheritDoc} */
74 | @Override
75 | public int hashCode() {
76 | return 0;
77 | }
78 |
79 | /** {@inheritDoc} */
80 | @Override
81 | public String toString() {
82 | return "GerritLogo{}";
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/src/test/java/jenkins/plugins/gerrit/PagedCodeProjectsRequestTest.java:
--------------------------------------------------------------------------------
1 | // Copyright (C) 2022 Réda Housni Alaoui Those optimizations should also allow to reduce the pressure on the Gerrit instance resources.
32 | */
33 | public class PagedCodeProjectsRequest implements IterableExamples:
28 |
30 |
39 |
40 | -is:wip
32 | does not include work-in-progress changes
33 | is:private
36 | includes private changes
37 |
33 | *
38 | */
39 | FAILED(false),
40 |
41 | /** The check is relevant to the change, but the checker has not started work. */
42 | NOT_STARTED(true),
43 |
44 | /**
45 | * The checker has acknowledged that it has work to do on the change, and will start work in the
46 | * future.
47 | */
48 | SCHEDULED(true),
49 |
50 | /** The checker is currently running the check. */
51 | RUNNING(true),
52 |
53 | /** The check terminated and succeeded. */
54 | SUCCESSFUL(false),
55 |
56 | /** The check is not relevant for the change. */
57 | NOT_RELEVANT(false);
58 |
59 | private final boolean inProgress;
60 |
61 | CheckState(boolean inProgress) {
62 | this.inProgress = inProgress;
63 | }
64 |
65 | /**
66 | * Returns whether the state represents an in-progress state.
67 | *
68 | * >() {}.getType());
66 | }
67 | throw new RestApiException(
68 | String.format(
69 | "Request failed with status: %d", response.getStatusLine().getStatusCode()));
70 | }
71 | } catch (Exception e) {
72 | throw new RestApiException("Failed to list pending checks: ", e);
73 | }
74 | }
75 |
76 | private URI buildRequestUrl() throws URISyntaxException {
77 | if (!queries.isEmpty()) {
78 | StringBuffer queryString = new StringBuffer();
79 | for (Map.Entry
>() {}.getType());
89 | }
90 | throw new RestApiException(
91 | String.format(
92 | "Request failed with status: %d", response.getStatusLine().getStatusCode()));
93 | }
94 | } catch (Exception e) {
95 | throw new RestApiException("Failed to list checks: ", e);
96 | }
97 | }
98 |
99 | public CheckInfo rerun(String checkerUuid) throws RestApiException {
100 | return rerun(checkerUuid, new RerunInput());
101 | }
102 |
103 | public CheckInfo rerun(String checkerUuid, RerunInput input) throws RestApiException {
104 | try {
105 | HttpPost request = new HttpPost(buildRequestUrl(checkerUuid + "/rerun"));
106 | String inputString =
107 | JsonBodyParser.createRequestBody(input, new TypeToken