Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add erased_at attribute to Job class #1040

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading