Skip to content

Commit

Permalink
Add erased_at attribute to Job class
Browse files Browse the repository at this point in the history
This adds possibility to identify erased jobs.
  • Loading branch information
luvarqpp authored and jmini committed Oct 9, 2023
1 parent fac578c commit ebd0fb5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/main/java/org/gitlab4j/api/models/Job.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class Job {
private String coverage;
private Date createdAt;
private Date finishedAt;
private Date erasedAt;
private Date artifactsExpireAt;
private String name;
private Pipeline pipeline;
Expand Down Expand Up @@ -64,6 +65,23 @@ public void setFinishedAt(Date finishedAt) {
this.finishedAt = finishedAt;
}

/**
* When someone deletes job using
* <a href="https://docs.gitlab.com/ee/api/jobs.html#erase-a-job">job erase api</a>, you can
* detect it using this field. Normally erasing job does mean only that job artifacts and
* a job logs gets removed. Job metadata (started_at, duration, ....) stays in place.
*
* You can use this attribute to filter out such jobs, that have erased at non-null if you need
* to.
*/
public Date getErasedAt() {
return erasedAt;
}

public void setErasedAt(Date erasedAt) {
this.erasedAt = erasedAt;
}

public Date getArtifactsExpireAt() {
return artifactsExpireAt;
}
Expand Down Expand Up @@ -248,6 +266,11 @@ public Job withFinishedAt(Date finishedAt) {
return this;
}

public Job withErasedAt(Date erasedAt) {
this.erasedAt = erasedAt;
return this;
}

public Job withName(String name) {
this.name = name;
return this;
Expand Down
1 change: 1 addition & 0 deletions src/test/resources/org/gitlab4j/api/job.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"tag": false,
"web_url": "https://example.com/foo/bar/-/jobs/7",
"allow_failure": false,
"erased_at": "2016-01-11T11:30:19.914Z",
"duration": 0.465,
"queued_duration": 0.010,
"user": {
Expand Down

0 comments on commit ebd0fb5

Please sign in to comment.