Skip to content

Move define.TempDirForURL() to pkg/tmpdir.ForURL(), unify its and Add()'s http client configurations - #6441

Open
nalind wants to merge 2 commits into
podman-container-tools:mainfrom
nalind:temp-dir-for-url-pkg
Open

nalind wants to merge 2 commits into
podman-container-tools:mainfrom
nalind:temp-dir-for-url-pkg

Conversation

@nalind

@nalind nalind commented Oct 20, 2025

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it:

The HTTP client configurations used by Add() and the logic that we use for pulling down build contexts that are specified using URLs differ in their setup, and the latter doesn't implement the --tls-verify=false flag.

How to verify it

New integration test!

Which issue(s) this PR fixes:

None

Special notes for your reviewer:

This is also a follow-up to #6274.

This moves the function that we use for retrieving things and putting them into temporary directories into its own package, but leaves behind an API-compatible wrapper function.

Does this PR introduce a user-facing change?

Retrieval of build contexts which are specified using HTTPS URLs now respect the value of the `--tls-verify` flag.

@openshift-ci openshift-ci Bot added the kind/bug Categorizes issue or PR as related to a bug. label Oct 20, 2025
@openshift-ci

openshift-ci Bot commented Oct 20, 2025

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nalind

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@TomSweeneyRedHat

Copy link
Copy Markdown
Contributor

@nalind, did you intend to use the name tmpdir for the new /pkg directory that you're putting the tls code into?

@nalind

nalind commented Oct 21, 2025

Copy link
Copy Markdown
Contributor Author

Yeah, it's used by tmpdir.ForURL(), which is meant to replace define.TempDirForURL().

@nalind
nalind force-pushed the temp-dir-for-url-pkg branch from 462f4f3 to 20c9435 Compare October 21, 2025 21:02
@nalind

nalind commented Oct 21, 2025

Copy link
Copy Markdown
Contributor Author

Moved those bits to a new internal/httpclient package.

@nalind
nalind force-pushed the temp-dir-for-url-pkg branch from 20c9435 to dedabe6 Compare October 22, 2025 18:52
@nalind

nalind commented Oct 22, 2025

Copy link
Copy Markdown
Contributor Author

Tweaked a bit to expose the proxy setting directly for callers.

@nalind
nalind force-pushed the temp-dir-for-url-pkg branch from dedabe6 to dd78138 Compare October 22, 2025 19:22
@github-actions

Copy link
Copy Markdown

A friendly reminder that this PR had no activity for 30 days.

Comment thread pkg/tmpdir/url.go Outdated
return fmt.Errorf("no contents in %q", url)
}
if err := chrootarchive.Untar(resp.Body, dir, nil); err != nil {
resp1, err := http.Get(url)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be here httpClient?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, fixing.

Comment thread internal/httpclient/httpclient.go Outdated
type URLOptions struct {
CertPath string // location of CA certificates, if not the system default
InsecureSkipTLSVerify types.OptionalBool
Proxy func(*http.Request) (*url.URL, error)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I am not sure about the behavior of not setting the Proxy option. Maybe it should be checked or documented.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Adding godoc for it.

@nalind
nalind force-pushed the temp-dir-for-url-pkg branch from 4f37ec2 to 97063cb Compare April 20, 2026 15:04
@dosubot dosubot Bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Apr 20, 2026

@Honny1 Honny1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@nalind
nalind force-pushed the temp-dir-for-url-pkg branch from 97063cb to 605059d Compare April 21, 2026 15:08
Move the generic "download a thing" function to a package that wasn't
originally intended to only include type definitions, but leave a
wrapper in the old location for compatibility's sake.

Fix a couple of stray spots where we still weren't using the version of
the original function that accepted a context.Context.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
@nalind
nalind force-pushed the temp-dir-for-url-pkg branch from 605059d to eb871fd Compare September 18, 2026 20:13
Make sure that tmpdir.ForURL() and Add() use the same HTTP client
configurations, both for TLS and proxies, so that we apply the same
settings when fetching build contexts that we do for ADD instructions.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
@nalind
nalind force-pushed the temp-dir-for-url-pkg branch from eb871fd to b1ca50b Compare September 18, 2026 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved kind/bug Categorizes issue or PR as related to a bug. size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants