-
Notifications
You must be signed in to change notification settings - Fork 655
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
chore(dockerMetadata): adding commit id, build number for docker images #853
Conversation
@@ -199,7 +205,7 @@ class DockerMonitor extends CommonPollingMonitor<ImageDelta, DockerPollingDelta> | |||
.version(image.tag) | |||
.location(image.account) | |||
.reference(imageId) | |||
.metadata([fullname: imageReference, registry: image.account, tag: image.tag],) | |||
.metadata([fullname: imageReference, registry: image.account, tag: image.tag, buildNumber: buildNumber, commitId: commitId],) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should construct the metadata object up above, and then only add the build and commit data if it exists in the image data (just like for saving it in the clouddriver cache)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call!
@@ -125,6 +126,8 @@ class DockerMonitorSpec extends Specification { | |||
assert artifacts.size() == 1 | |||
assert artifacts[0].name == "repository" | |||
assert artifacts[0].type == "DOCKER" | |||
assert artifacts[0].metadata.buildNumber == "111" | |||
assert artifacts[0].metadata.commitId == "ab12c3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it might be good to have a test to make sure that the keys aren't present if the newt metadata doesn't exist
assert artifacts[0].name == "repository" | ||
assert artifacts[0].type == "DOCKER" | ||
assert artifacts[0].metadata.tag == "new-tag" | ||
assert artifacts[0].metadata.buildNumber == null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a way to assert the key isn't present instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep! changed to containsKey
.
ֿ