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

chore(dockerMetadata): adding commit id, build number for docker images #853

Merged
merged 6 commits into from
Sep 8, 2020

Conversation

gal-yardeni
Copy link
Contributor

ֿ

@@ -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],)
Copy link
Contributor

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)

Copy link
Contributor Author

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"
Copy link
Contributor

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
Copy link
Contributor

@emjburns emjburns Sep 8, 2020

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep! changed to containsKey.

@gal-yardeni gal-yardeni added the ready to merge Approved and ready for merge label Sep 8, 2020
@mergify mergify bot merged commit e51066e into spinnaker:master Sep 8, 2020
@mergify mergify bot added the auto merged label Sep 8, 2020
@gal-yardeni gal-yardeni deleted the dockerImage branch September 8, 2020 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants