Skip to content

Commit c3512c0

Browse files
committed
gitea commit status as copy of gitlab
1 parent 47502a7 commit c3512c0

File tree

12 files changed

+837
-1
lines changed

12 files changed

+837
-1
lines changed

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

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ public class Constants {
8585
public static final int STATUSES_TO_LOAD_THRESHOLD_DEFAULT_VAL = 50;
8686
public static final String GITLAB_FEATURE_TOGGLE_MERGE_RESULTS = "commitStatusPubliser.gitlab.supportMergeResults";
8787

88+
public static final String GITEA_PUBLISHER_ID = "giteaStatusPublisher";
89+
public static final String GITEA_API_URL = "giteaApiUrl";
90+
public static final String GITEA_TOKEN = "secure:giteaAccessToken";
91+
8892
@NotNull
8993
public String getVcsRootIdParam() {
9094
return VCS_ROOT_ID_PARAM;
@@ -219,4 +223,19 @@ public String getGitlabServer() {
219223
public String getGitlabToken() {
220224
return GITLAB_TOKEN;
221225
}
222-
}
226+
227+
@NotNull
228+
public String getGiteaPublisherId() {
229+
return GITEA_PUBLISHER_ID;
230+
}
231+
232+
@NotNull
233+
public String getGiteaServer() {
234+
return GITEA_API_URL;
235+
}
236+
237+
@NotNull
238+
public String getGiteaToken() {
239+
return GITEA_TOKEN;
240+
}
241+
}
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)