Skip to content

Commit

Permalink
feat(dockerBranch): add branch info for docker images (#887)
Browse files Browse the repository at this point in the history
  • Loading branch information
gal-yardeni authored Oct 8, 2020
1 parent 7b34d8f commit e87a629
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ class DockerMonitor extends CommonPollingMonitor<ImageDelta, DockerPollingDelta>
.ifPresent({ commitId -> metadata.put("commitId", commitId.toString()) })
Optional.ofNullable(image.date)
.ifPresent({ date -> metadata.put("date", date.toString()) })
Optional.ofNullable(image.branch)
.ifPresent({ branch -> metadata.put("branch", branch.toString()) })


Artifact artifact = Artifact.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ class TaggedImage {
String buildNumber
String commitId
String date
String branch
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ class DockerMonitorSpec extends Specification {
repository: "repository",
digest: "digest",
buildNumber: "111",
commitId: "ab12c3"
commitId: "ab12c3",
date: "1598707355157",
branch: "master"
)

when:
Expand All @@ -127,6 +129,8 @@ class DockerMonitorSpec extends Specification {
assert artifacts[0].metadata.tag == "tag"
assert artifacts[0].metadata.buildNumber == "111"
assert artifacts[0].metadata.commitId == "ab12c3"
assert artifacts[0].metadata.date == "1598707355157"
assert artifacts[0].metadata.branch == "master"
return true
})
}
Expand Down

0 comments on commit e87a629

Please sign in to comment.