From bcc9a162253087f279d19db4fbf254c79394e962 Mon Sep 17 00:00:00 2001 From: luvarqpp Date: Tue, 10 Oct 2023 07:36:18 +0200 Subject: [PATCH] Add erased_at attribute to Job class (#1040) This adds possibility to identify erased jobs. --- .../java/org/gitlab4j/api/models/Job.java | 23 +++++++++++++++++++ src/test/resources/org/gitlab4j/api/job.json | 1 + 2 files changed, 24 insertions(+) diff --git a/src/main/java/org/gitlab4j/api/models/Job.java b/src/main/java/org/gitlab4j/api/models/Job.java index c22759de0..f4ffdb877 100644 --- a/src/main/java/org/gitlab4j/api/models/Job.java +++ b/src/main/java/org/gitlab4j/api/models/Job.java @@ -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; @@ -64,6 +65,23 @@ public void setFinishedAt(Date finishedAt) { this.finishedAt = finishedAt; } + /** + * When someone deletes job using + * job erase api, 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; } @@ -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; diff --git a/src/test/resources/org/gitlab4j/api/job.json b/src/test/resources/org/gitlab4j/api/job.json index e64b8cf97..cf54fe9d3 100644 --- a/src/test/resources/org/gitlab4j/api/job.json +++ b/src/test/resources/org/gitlab4j/api/job.json @@ -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": {