Skip to content

Conversation

@blampe
Copy link
Contributor

@blampe blampe commented May 30, 2025

This is a continuation of #3314.

The bulk of the new work went into crafting a failing test case. In short it:

  1. Creates a private OCI registry on ECR.
  2. Authenticates to the private registry using a standalone go-oras client.
  3. Copies an nginx chart over to the private registry.
  4. Executes a Pulumi program configured to point at the now-private chart.

Testing revealed that setting registry.ClientOptBasicAuth(username, password) on the client is insufficient. This sorta makes sense to me -- Helm doesn't want to blindly pass that username and password to any registry the client might interact with.

The solution I came up with isn't super satisfying but essentially performs the helm login we're currently asking users to perform manually. This can fail for a number of reasons, for example if we're already logged in, so we optimistically ignore errors here.

Chart v4 and Release v3 are both confirmed to be working. The Release provider's client setup is awkwardly separate from our Chart handling (Chart being more correct), but consolidating those two flows is a separate work item.

Fixes #2911.
Fixes #1914.

@blampe blampe marked this pull request as draft May 30, 2025 17:50
@github-actions
Copy link

Does the PR have any schema changes?

Looking good! No breaking changes found.
No new resources/functions.

@codecov
Copy link

codecov bot commented May 30, 2025

Codecov Report

Attention: Patch coverage is 12.98701% with 67 lines in your changes missing coverage. Please review.

Project coverage is 42.26%. Comparing base (ad44c6d) to head (ce1c6c9).

Files with missing lines Patch % Lines
provider/pkg/helm/tlsutil.go 0.00% 28 Missing ⚠️
provider/pkg/helm/tool.go 27.77% 25 Missing and 1 partial ⚠️
provider/pkg/provider/helm_release.go 0.00% 13 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3661      +/-   ##
==========================================
- Coverage   42.36%   42.26%   -0.11%     
==========================================
  Files          87       88       +1     
  Lines       12669    12709      +40     
==========================================
+ Hits         5367     5371       +4     
- Misses       6907     6944      +37     
+ Partials      395      394       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@blampe blampe marked this pull request as ready for review May 30, 2025 23:30
@blampe blampe requested a review from EronWright May 30, 2025 23:30
@blampe blampe self-assigned this Jun 2, 2025
Copy link
Contributor

@EronWright EronWright left a comment

Choose a reason for hiding this comment

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

For discussion:

  1. is this change affecting Release or Chart or both?
  2. does it have the same side-effect that helm install would normally?
  3. tool.go seems to be drifting away from the upstream, e.g. refactored tls. how close can we stick to upstream?
  4. is this affecting oci registries or also helm registries?

// Login can fail for harmless reasons like already being
// logged in. Optimistically ignore those errors.
if err := c.Login(u.Host, registry.LoginOptBasicAuth(i.Username, i.Password)); err != nil {
logger.V(6).Infof("[helm] %s", fmt.Sprintf("login error: %s", err))
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: use a lower verbosity for this important message.

Also, consider writing a log message when login was successful, maybe mentioning that the user's environment was modified.

@blampe blampe added this to the 0.123 milestone Jul 15, 2025
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.

Per-resource authentication support for OCI registries Helm OCI registry support is missing authentication

2 participants