Skip to content

Commit 7a5fab0

Browse files
committed
gitea commit status as copy of gitlab
1 parent 75699df commit 7a5fab0

File tree

12 files changed

+836
-0
lines changed

12 files changed

+836
-0
lines changed

commit-status-publisher-server/src/main/java/jetbrains/buildServer/commitPublisher/Constants.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ public class Constants {
7373
public static final String STATUSES_TO_LOAD_THRESHOLD_PROPERTY = "teamcity.commitStatusPubliser.statusesToLoad.threshold";
7474
public static final int STATUSES_TO_LOAD_THRESHOLD_DEFAULT_VAL = 50;
7575

76+
public static final String GITEA_PUBLISHER_ID = "giteaStatusPublisher";
77+
public static final String GITEA_API_URL = "giteaApiUrl";
78+
public static final String GITEA_TOKEN = "secure:giteaAccessToken";
79+
7680

7781
@NotNull
7882
public String getVcsRootIdParam() {
@@ -178,4 +182,19 @@ public String getGitlabServer() {
178182
public String getGitlabToken() {
179183
return GITLAB_TOKEN;
180184
}
185+
186+
@NotNull
187+
public String getGiteaPublisherId() {
188+
return GITEA_PUBLISHER_ID;
189+
}
190+
191+
@NotNull
192+
public String getGiteaServer() {
193+
return GITEA_API_URL;
194+
}
195+
196+
@NotNull
197+
public String getGiteaToken() {
198+
return GITEA_TOKEN;
199+
}
181200
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* Copyright 2000-2022 JetBrains s.r.o.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package jetbrains.buildServer.commitPublisher.gitea;
18+
19+
import org.jetbrains.annotations.NotNull;
20+
import org.jetbrains.annotations.Nullable;
21+
22+
import java.util.Arrays;
23+
import java.util.Map;
24+
import java.util.function.Function;
25+
import java.util.stream.Collectors;
26+
27+
public enum GiteaBuildStatus {
28+
PENDING("pending"),
29+
RUNNING("running"),
30+
SUCCESS("success"),
31+
FAILED("failed"),
32+
CANCELED("canceled");
33+
34+
private static final Map<String, GiteaBuildStatus> INDEX = Arrays.stream(values()).collect(Collectors.toMap(GiteaBuildStatus::getName, Function.identity()));
35+
36+
private final String myName;
37+
38+
GiteaBuildStatus(@NotNull String name) {
39+
myName = name;
40+
}
41+
42+
@NotNull
43+
public String getName() {
44+
return myName;
45+
}
46+
47+
@Nullable
48+
public static GiteaBuildStatus getByName(@NotNull String name) {
49+
return INDEX.get(name);
50+
}
51+
}

0 commit comments

Comments
 (0)