Skip to content

Conversation

gaius-qi
Copy link
Member

Description

This pull request introduces significant refactoring and modularization of the preheat functionality for container images, primarily by moving the image-related logic to a new internal package and simplifying the preheat job implementation. Additionally, it introduces OpenTelemetry tracing for better observability.

Refactoring and Modularization

  • Moved the image-related logic, including manifest parsing, authentication, and layer extraction, to the new internal/job/image.go file. This includes functions like CreatePreheatRequestsByManifestURL, resolveManifests, and buildPreheatRequestFromManifests as well as supporting types like preheatImage and imageAuthClient.

  • Removed the redundant GetImageLayers function and related logic from manager/job/preheat.go, replacing it with a call to internaljob.GetImageLayers, which encapsulates the same functionality in the new internal module. [1] [2]

Observability

  • Introduced a global OpenTelemetry tracer (tracer) in internal/job/job.go for the job package, enabling distributed tracing for preheat-related operations.

Code Simplification

  • Removed unused imports and redundant HTTP transport configuration from manager/job/preheat.go, as these are now handled within the new internal module. [1] [2]

Related Issue

Motivation and Context

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation Update (if none of the other choices apply)

Checklist

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.

@gaius-qi gaius-qi self-assigned this Jul 29, 2025
@gaius-qi gaius-qi requested a review from a team as a code owner July 29, 2025 07:46
@gaius-qi gaius-qi added the enhancement New feature or request label Jul 29, 2025
@gaius-qi gaius-qi added this to the v2.4.0 milestone Jul 29, 2025
@gaius-qi gaius-qi force-pushed the feature/image branch 3 times, most recently from 42a73ee to 3646f17 Compare July 29, 2025 08:02
Copy link

codecov bot commented Jul 29, 2025

Codecov Report

❌ Patch coverage is 66.04651% with 73 lines in your changes missing coverage. Please review.
✅ Project coverage is 32.50%. Comparing base (1de067f) to head (6b36dc1).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/job/image.go 67.29% 48 Missing and 21 partials ⚠️
manager/service/job.go 0.00% 3 Missing ⚠️
manager/job/preheat.go 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #4243   +/-   ##
=======================================
  Coverage   32.50%   32.50%           
=======================================
  Files         350      350           
  Lines       41382    41382           
=======================================
  Hits        13453    13453           
  Misses      27038    27038           
  Partials      891      891           
Flag Coverage Δ
unittests 32.50% <66.04%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
internal/job/job.go 13.75% <ø> (ø)
manager/job/preheat.go 0.00% <0.00%> (-43.19%) ⬇️
manager/service/job.go 0.00% <0.00%> (ø)
internal/job/image.go 67.29% <67.29%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

chlins
chlins previously approved these changes Jul 29, 2025
Copy link
Member

@chlins chlins left a comment

Choose a reason for hiding this comment

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

lgtm

BruceAko
BruceAko previously approved these changes Jul 29, 2025
…/types.go to internal/job/image.go for better encapsulation

Signed-off-by: Gaius <gaius.qi@gmail.com>
@gaius-qi gaius-qi dismissed stale reviews from BruceAko and chlins via 6b36dc1 July 29, 2025 08:41
Copy link
Member

@chlins chlins left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@LunaWhispers LunaWhispers left a comment

Choose a reason for hiding this comment

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

lgtm

@LunaWhispers LunaWhispers enabled auto-merge (squash) July 29, 2025 08:52
@LunaWhispers LunaWhispers merged commit 9641c3e into main Jul 29, 2025
16 checks passed
@LunaWhispers LunaWhispers deleted the feature/image branch July 29, 2025 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants