Skip to content

CLOUDP-318984: Print image digest SHA256 in build logs #126

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

Merged
merged 4 commits into from
May 16, 2025

Conversation

SimonBaeumer
Copy link
Member

Summary

CLOUDP-318984: Print image digest SHA256 in build logs

Proof of Work

[2025/05/15 10:18:10.029] INFO     2025-05-15 08:18:10,028 [docker]  path: .
[2025/05/15 10:18:10.029] INFO     2025-05-15 08:18:10,029 [docker]  dockerfile: /data/mci/29b9d13cde870de4a9f51dadb28d48e9/tmp/tmpczprlyge
[2025/05/15 10:18:10.029] INFO     2025-05-15 08:18:10,029 [docker]  tag: sonar-docker-build-9574
[2025/05/15 10:18:10.029] INFO     2025-05-15 08:18:10,029 [docker]  buildargs: {'imagebase': '268558157000.dkr.ecr.us-east-1.amazonaws.com/dev/ops-manager-context:6825a2b7cba4af0007d7845c'}
[2025/05/15 10:18:10.029] INFO     2025-05-15 08:18:10,029 [docker]  labels: {}
[2025/05/15 10:18:10.029] INFO     2025-05-15 08:18:10,029 [docker]  executing cli docker build: docker buildx build --load --progress plain . -f /data/mci/29b9d13cde870de4a9f51dadb28d48e9/tmp/tmpczprlyge -t sonar-docker-build-9574 --build-arg imagebase=<...>.amazonaws.com/dev/ops-manager-context:6825a2b7cba4af0007d7845c --platform linux/amd64
[2025/05/15 10:20:17.794] INFO     2025-05-15 08:20:17,794 [docker]  Successfully build docker-image, SHA256: sha256:2a686352db2cb409f23d17da71ece6f9308ad89ead6daa118dbb24e0a915dc5c
[2025/05/15 10:20:17.794] [ops-manager-build/docker_build] docker-image-push: <...>.amazonaws.com/dev/mongodb-enterprise-ops-manager-ubi:8.0.7

Checklist

  • Have you linked a jira ticket and/or is the ticket in the title?
  • Have you checked whether your jira ticket required DOCSP changes?
  • Have you checked for release_note changes?

@SimonBaeumer SimonBaeumer requested a review from a team as a code owner May 15, 2025 08:27
@SimonBaeumer SimonBaeumer requested review from nammn and Julien-Ben May 15, 2025 08:27
@@ -47,7 +47,10 @@ def docker_build(
)

client = docker_client()
return client.images.get(image_name)
image = client.images.get(image_name)
logger.info("Successfully build docker-image, SHA256: {}".format(image.id))
Copy link
Collaborator

Choose a reason for hiding this comment

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

lets add the sha as an attribute in the trace - unfortunately logs are not saved globally for search.

https://ui.honeycomb.io/mongodb-4b/environments/production/datasets/evergreen-agent/trace/e8Wt6WdtQ26?fields[]=s_name&fields[]=s_serviceName&span=166e96577d7e3ad8

example:

"""Calls sonar to build `image_name` with arguments defined in `args`."""
span = trace.get_current_span()
span.set_attribute("mck.image_name", image_name)
span.set_attribute("mck.inventory", inventory)
if args:
span.set_attribute("mck.build_args", str(args))

then you can see it under your linked trace in the build

Copy link
Member Author

@SimonBaeumer SimonBaeumer May 15, 2025

Choose a reason for hiding this comment

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

Added digest to trace: a7332a2

Waiting for pipeline to validate my changes in Honeycomb.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@SimonBaeumer SimonBaeumer requested a review from nammn May 15, 2025 13:59
@SimonBaeumer SimonBaeumer force-pushed the cloudp-318984/print-sha256-in-builds branch from a7332a2 to 2f47415 Compare May 16, 2025 09:03
@SimonBaeumer SimonBaeumer enabled auto-merge (squash) May 16, 2025 09:29
@SimonBaeumer SimonBaeumer merged commit 28bf672 into master May 16, 2025
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants