Skip to content

Commit 47f7b36

Browse files
committed
Revert JobEvent and update BuildEvent
1 parent 180b8bc commit 47f7b36

File tree

4 files changed

+67
-180
lines changed

4 files changed

+67
-180
lines changed

gitlab4j-models/src/main/java/org/gitlab4j/api/webhook/BuildEvent.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import java.util.Date;
44

5+
import org.gitlab4j.api.models.Runner;
56
import org.gitlab4j.models.utils.JacksonJson;
67

78
/**
@@ -18,10 +19,12 @@ public class BuildEvent extends AbstractEvent {
1819
private Boolean tag;
1920
private String beforeSha;
2021
private String sha;
22+
private Integer retriesCount;
2123
private Long buildId;
2224
private String buildName;
2325
private String buildStage;
2426
private String buildStatus;
27+
private Date buildCreatedAt;
2528
private Date buildStartedAt;
2629
private Date buildFinishedAt;
2730
private Float buildDuration;
@@ -36,6 +39,8 @@ public class BuildEvent extends AbstractEvent {
3639
private EventUser user;
3740
private BuildCommit commit;
3841
private EventRepository repository;
42+
private EventProject project;
43+
private Runner runner;
3944

4045
@Override
4146
public String getObjectKind() {
@@ -79,6 +84,14 @@ public void setSha(String sha) {
7984
this.sha = sha;
8085
}
8186

87+
public Integer getRetriesCount() {
88+
return retriesCount;
89+
}
90+
91+
public void setRetriesCount(Integer retriesCount) {
92+
this.retriesCount = retriesCount;
93+
}
94+
8295
public Long getBuildId() {
8396
return buildId;
8497
}
@@ -111,6 +124,14 @@ public void setBuildStatus(String buildStatus) {
111124
this.buildStatus = buildStatus;
112125
}
113126

127+
public Date getBuildCreatedAt() {
128+
return buildCreatedAt;
129+
}
130+
131+
public void setBuildCreatedAt(Date buildCreatedAt) {
132+
this.buildCreatedAt = buildCreatedAt;
133+
}
134+
114135
public Date getBuildStartedAt() {
115136
return buildStartedAt;
116137
}
@@ -207,6 +228,22 @@ public void setRepository(EventRepository repository) {
207228
this.repository = repository;
208229
}
209230

231+
public EventProject getProject() {
232+
return project;
233+
}
234+
235+
public void setProject(EventProject project) {
236+
this.project = project;
237+
}
238+
239+
public Runner getRunner() {
240+
return runner;
241+
}
242+
243+
public void setRunner(Runner runner) {
244+
this.runner = runner;
245+
}
246+
210247
@Override
211248
public String toString() {
212249
return (JacksonJson.toJsonString(this));

gitlab4j-models/src/main/java/org/gitlab4j/api/webhook/JobEvent.java

Lines changed: 1 addition & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22

33
import java.util.Date;
44

5-
import org.gitlab4j.api.models.Runner;
65
import org.gitlab4j.models.utils.JacksonJson;
76

87
public class JobEvent extends AbstractEvent {
98
private static final long serialVersionUID = 1L;
109

1110
public static final String JOB_HOOK_X_GITLAB_EVENT = "Job Hook";
12-
public static final String OBJECT_KIND = "build";
11+
public static final String OBJECT_KIND = "job";
1312

1413
private String ref;
1514
private Boolean tag;
@@ -24,26 +23,11 @@ public class JobEvent extends AbstractEvent {
2423
private Integer jobDuration;
2524
private Boolean jobAllowFailure;
2625
private String jobFailureReason;
27-
private Long buildId;
28-
private String buildName;
29-
private String buildStage;
30-
private String buildStatus;
31-
private Date buildCreatedAt;
32-
private Date buildStartedAt;
33-
private Date buildFinishedAt;
34-
private Integer buildDuration;
35-
private Double buildQueuedDuration;
36-
private Boolean buildAllowFailure;
37-
private String buildFailureReason;
38-
private Integer retriesCount;
39-
private Integer pipelineId;
4026
private Long projectId;
4127
private String projectName;
4228
private EventUser user;
4329
private BuildCommit commit;
4430
private EventRepository repository;
45-
private EventProject project;
46-
private Runner runner;
4731

4832
@Override
4933
public String getObjectKind() {
@@ -159,110 +143,6 @@ public void setJobFailureReason(String jobFailureReason) {
159143
this.jobFailureReason = jobFailureReason;
160144
}
161145

162-
public Long getBuildId() {
163-
return buildId;
164-
}
165-
166-
public void setBuildId(Long buildId) {
167-
this.buildId = buildId;
168-
}
169-
170-
public String getBuildName() {
171-
return buildName;
172-
}
173-
174-
public void setBuildName(String buildName) {
175-
this.buildName = buildName;
176-
}
177-
178-
public String getBuildStage() {
179-
return buildStage;
180-
}
181-
182-
public void setBuildStage(String buildStage) {
183-
this.buildStage = buildStage;
184-
}
185-
186-
public String getBuildStatus() {
187-
return buildStatus;
188-
}
189-
190-
public void setBuildStatus(String buildStatus) {
191-
this.buildStatus = buildStatus;
192-
}
193-
194-
public Date getBuildCreatedAt() {
195-
return buildCreatedAt;
196-
}
197-
198-
public void setBuildCreatedAt(Date buildCreatedAt) {
199-
this.buildCreatedAt = buildCreatedAt;
200-
}
201-
202-
public Date getBuildStartedAt() {
203-
return buildStartedAt;
204-
}
205-
206-
public void setBuildStartedAt(Date buildStartedAt) {
207-
this.buildStartedAt = buildStartedAt;
208-
}
209-
210-
public Date getBuildFinishedAt() {
211-
return buildFinishedAt;
212-
}
213-
214-
public void setBuildFinishedAt(Date buildFinishedAt) {
215-
this.buildFinishedAt = buildFinishedAt;
216-
}
217-
218-
public Integer getBuildDuration() {
219-
return buildDuration;
220-
}
221-
222-
public void setBuildDuration(Integer buildDuration) {
223-
this.buildDuration = buildDuration;
224-
}
225-
226-
public Double getBuildQueuedDuration() {
227-
return buildQueuedDuration;
228-
}
229-
230-
public void setBuildQueuedDuration(Double buildQueuedDuration) {
231-
this.buildQueuedDuration = buildQueuedDuration;
232-
}
233-
234-
public Boolean getBuildAllowFailure() {
235-
return buildAllowFailure;
236-
}
237-
238-
public void setBuildAllowFailure(Boolean buildAllowFailure) {
239-
this.buildAllowFailure = buildAllowFailure;
240-
}
241-
242-
public String getBuildFailureReason() {
243-
return buildFailureReason;
244-
}
245-
246-
public void setBuildFailureReason(String buildFailureReason) {
247-
this.buildFailureReason = buildFailureReason;
248-
}
249-
250-
public Integer getRetriesCount() {
251-
return retriesCount;
252-
}
253-
254-
public void setRetriesCount(Integer retriesCount) {
255-
this.retriesCount = retriesCount;
256-
}
257-
258-
public Integer getPipelineId() {
259-
return pipelineId;
260-
}
261-
262-
public void setPipelineId(Integer pipelineId) {
263-
this.pipelineId = pipelineId;
264-
}
265-
266146
public Long getProjectId() {
267147
return projectId;
268148
}
@@ -303,22 +183,6 @@ public void setRepository(EventRepository repository) {
303183
this.repository = repository;
304184
}
305185

306-
public EventProject getProject() {
307-
return project;
308-
}
309-
310-
public void setProject(EventProject project) {
311-
this.project = project;
312-
}
313-
314-
public Runner getRunner() {
315-
return runner;
316-
}
317-
318-
public void setRunner(Runner runner) {
319-
this.runner = runner;
320-
}
321-
322186
@Override
323187
public String toString() {
324188
return (JacksonJson.toJsonString(this));

gitlab4j-models/src/test/resources/org/gitlab4j/models/build-event.json

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@
44
"tag": false,
55
"before_sha": "8a49a94f1a7cd64985074cb11b1a42a7ab2d9b46",
66
"sha": "a890bee24574603c522c756b9346649fbec4c812",
7+
"retries_count": 2,
78
"build_id": 214655258,
89
"build_name": "build1",
910
"build_stage": "build",
1011
"build_status": "running",
12+
"build_created_at": "2019-05-17T17:09:21Z",
1113
"build_started_at": "2019-05-17T18:09:21Z",
14+
"build_finished_at": "2019-05-17T19:09:21Z",
1215
"build_duration": 0.05880817,
1316
"build_queued_duration": 1095.5887,
1417
"build_allow_failure": false,
1518
"build_failure_reason": "unknown_failure",
16-
"pipeline_id": 2366,
19+
"pipeline_id": 2366,
1720
"project_id": 3115610,
1821
"project_name": "GitLab4J / test-project",
1922
"user": {
@@ -38,5 +41,28 @@
3841
"git_http_url": "https://gitlab.com/gitlab4j/test-project.git",
3942
"git_ssh_url": "[email protected]:gitlab4j/test-project.git",
4043
"visibility_level": 20
44+
},
45+
"project":{
46+
"id": 380,
47+
"name": "Gitlab Test",
48+
"description": "Atque in sunt eos similique dolores voluptatem.",
49+
"web_url": "http://192.168.64.1:3005/gitlab-org/gitlab-test",
50+
"git_ssh_url": "[email protected]:gitlab-org/gitlab-test.git",
51+
"git_http_url": "http://192.168.64.1:3005/gitlab-org/gitlab-test.git",
52+
"namespace": "Gitlab Org",
53+
"visibility_level": 20,
54+
"path_with_namespace": "gitlab-org/gitlab-test",
55+
"default_branch": "master"
56+
},
57+
"runner": {
58+
"active": true,
59+
"runner_type": "project_type",
60+
"is_shared": false,
61+
"id": 380987,
62+
"description": "shared-runners-manager-6.gitlab.com",
63+
"tags": [
64+
"linux",
65+
"docker"
66+
]
4167
}
42-
}
68+
}

gitlab4j-models/src/test/resources/org/gitlab4j/models/job-event.json

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,6 @@
1010
"job_status": "created",
1111
"job_allow_failure": false,
1212
"job_failure_reason": "script_failure",
13-
"build_id": 1977,
14-
"build_name": "test",
15-
"build_stage": "test",
16-
"build_status": "created",
17-
"build_created_at": "2021-02-23T02:41:37.886Z",
18-
"build_started_at": "2021-02-23T02:41:37.886Z",
19-
"build_finished_at": "2021-02-23T02:41:37.886Z",
20-
"build_duration": 2224,
21-
"build_queued_duration": 1095.588715,
22-
"build_allow_failure": false,
23-
"build_failure_reason": "script_failure",
24-
"retries_count": 2,
25-
"pipeline_id": 2366,
2613
"project_id": 380,
2714
"project_name": "gitlab-org/gitlab-test",
2815
"user": {
@@ -32,15 +19,11 @@
3219
},
3320
"commit": {
3421
"id": 2366,
35-
"name": "Build pipeline",
3622
"sha": "2293ada6b400935a1378653304eaf6221e0fdb8f",
3723
"message": "test\n",
3824
"author_name": "User",
3925
"author_email": "[email protected]",
40-
"status": "created",
41-
"duration": 2264.0,
42-
"started_at": "2025-04-09T17:00:09.082Z",
43-
"finished_at": "2025-04-09T18:00:09.082Z"
26+
"status": "created"
4427
},
4528
"repository": {
4629
"name": "gitlab_test",
@@ -49,28 +32,5 @@
4932
"git_ssh_url": "[email protected]:gitlab-org/gitlab-test.git",
5033
"git_http_url": "http://192.168.64.1:3005/gitlab-org/gitlab-test.git",
5134
"visibility_level": 20
52-
},
53-
"project":{
54-
"id": 380,
55-
"name": "Gitlab Test",
56-
"description": "Atque in sunt eos similique dolores voluptatem.",
57-
"web_url": "http://192.168.64.1:3005/gitlab-org/gitlab-test",
58-
"git_ssh_url": "[email protected]:gitlab-org/gitlab-test.git",
59-
"git_http_url": "http://192.168.64.1:3005/gitlab-org/gitlab-test.git",
60-
"namespace": "Gitlab Org",
61-
"visibility_level": 20,
62-
"path_with_namespace": "gitlab-org/gitlab-test",
63-
"default_branch": "master"
64-
},
65-
"runner": {
66-
"active": true,
67-
"runner_type": "project_type",
68-
"is_shared": false,
69-
"id": 380987,
70-
"description": "shared-runners-manager-6.gitlab.com",
71-
"tags": [
72-
"linux",
73-
"docker"
74-
]
7535
}
7636
}

0 commit comments

Comments
 (0)