Skip to content

Conversation

@derekhjray
Copy link
Contributor

Description

Passing global context to docker/podman image save function to ensure timeout from cmdline works for image save, otherwise, scanning operation cannot be interrupted by '--timeout' arg if large image using too much time to save image

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

@derekhjray derekhjray changed the title feat(image-save): pass global context to docker/podman image save func feat(image): pass global context to docker/podman image save func Oct 31, 2025
@github-actions github-actions bot added the apidiff Indicates Go API changes relevant to library consumers (CLI compatibility may be unaffected) label Oct 31, 2025
@github-actions
Copy link

github-actions bot commented Oct 31, 2025

📊 API Changes Detected

Semver impact: major

github.com/aquasecurity/trivy/pkg/fanal/image/daemon
  Incompatible changes:
  - DockerImage: changed from func(github.com/google/go-containerregistry/pkg/name.Reference, string) (Image, func(), error) to func(context.Context, github.com/google/go-containerregistry/pkg/name.Reference, string) (Image, func(), error)
  - PodmanImage: changed from func(string, string) (Image, func(), error) to func(context.Context, string, string) (Image, func(), error)

@aqua-bot aqua-bot requested a review from a team October 31, 2025 08:54
require.NoError(t, err)

_, cleanup, err := DockerImage(ref, "")
_, cleanup, err := DockerImage(context.Background(), ref, "")
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use t.Context()

Suggested change
_, cleanup, err := DockerImage(context.Background(), ref, "")
_, cleanup, err := DockerImage(t.Context(), ref, "")

Copy link
Contributor

Choose a reason for hiding this comment

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

same for other test files

@DmitriyLewen
Copy link
Contributor

@derekhjray Thanks for your contribution!
Can you fix linter errors?

@derekhjray
Copy link
Contributor Author

@derekhjray Thanks for your contribution! Can you fix linter errors?

I've fixed linter issues as recommended

@DmitriyLewen
Copy link
Contributor

@derekhjray
Copy link
Contributor Author

Copy link
Collaborator

@knqyf263 knqyf263 left a comment

Choose a reason for hiding this comment

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

LGTM

@DmitriyLewen DmitriyLewen added this pull request to the merge queue Nov 4, 2025
Merged via the queue into aquasecurity:main with commit 2690ac9 Nov 4, 2025
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

apidiff Indicates Go API changes relevant to library consumers (CLI compatibility may be unaffected)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants