Skip to content

Commit de4de39

Browse files
committed
Add erased_at attribute to Job class
This adds possibility to identify erased jobs.
1 parent 764ce78 commit de4de39

File tree

2 files changed

+24
-0
lines changed
  • src
    • main/java/org/gitlab4j/api/models
    • test/resources/org/gitlab4j/api

2 files changed

+24
-0
lines changed

src/main/java/org/gitlab4j/api/models/Job.java

+23
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public class Job {
1212
private String coverage;
1313
private Date createdAt;
1414
private Date finishedAt;
15+
private Date erasedAt;
1516
private Date artifactsExpireAt;
1617
private String name;
1718
private Pipeline pipeline;
@@ -64,6 +65,23 @@ public void setFinishedAt(Date finishedAt) {
6465
this.finishedAt = finishedAt;
6566
}
6667

68+
/**
69+
* When someone deletes job using
70+
* <a href="https://docs.gitlab.com/ee/api/jobs.html#erase-a-job">job erase api</a>, you can
71+
* detect it using this field. Normally erasing job does mean only that job artifacts and
72+
* a job logs gets removed. Job metadata (started_at, duration, ....) stays in place.
73+
*
74+
* You can use this attribute to filter out such jobs, that have erased at non-null if you need
75+
* to.
76+
*/
77+
public Date getErasedAt() {
78+
return erasedAt;
79+
}
80+
81+
public void setErasedAt(Date erasedAt) {
82+
this.erasedAt = erasedAt;
83+
}
84+
6785
public Date getArtifactsExpireAt() {
6886
return artifactsExpireAt;
6987
}
@@ -248,6 +266,11 @@ public Job withFinishedAt(Date finishedAt) {
248266
return this;
249267
}
250268

269+
public Job withErasedAt(Date erasedAt) {
270+
this.erasedAt = erasedAt;
271+
return this;
272+
}
273+
251274
public Job withName(String name) {
252275
this.name = name;
253276
return this;

src/test/resources/org/gitlab4j/api/job.json

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"tag": false,
3838
"web_url": "https://example.com/foo/bar/-/jobs/7",
3939
"allow_failure": false,
40+
"erased_at": "2016-01-11T11:30:19.914Z",
4041
"duration": 0.465,
4142
"queued_duration": 0.010,
4243
"user": {

0 commit comments

Comments
 (0)