Skip to content

Conversation

@pgodowski
Copy link

@pgodowski pgodowski commented Oct 25, 2025

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Title of the PR
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.
  • Optional. My organization is added to USERS.md.
  • Optional. For bug fixes, I've indicated what older releases this fix should be cherry-picked into (this may or may not happen depending on risk/complexity).

Fixes #25078

In my organisation, we install Helm charts packaged into OCI repository, by pointing them via digest, e.g.

helm install example-registry-quay-openshift-operators.apps.quay-gori.cp.example.com/piotr/charts/test-nginx-chart/nginx@sha256:4b5007efa6ea560d18fb7cb7d4f268e180ef8f8e577861abeb8db38ad39a49eb

However, prior to the fix, one couldn't create Application with Helm OCI repository, when targetRevision is sha256 digest value, and not the image tag.

The underlying problem is with the Helm CLI commands produced by Argo, when image digest is being used, i.e.: the usage of --version flag, which Helm CLI tries to parse as a semver version, which obviously would fail when sha256 digest value is provided.

The Helm community discussed options what should be the proper helm CLI arguments, when image digests are used:

With the conclusion, that whenever digest is used, the flag --version must not be used, and image digest must be specified as part of the helm chart name reference.

The fix is implemented in such a way that it detects whether targetRevision is either digest (sha256: prefix) or not and used different variant of Helm CLI flags depending on the actual condition.

Evidence from the ArgoUI that now both Helm charts pointed by semver or by digest work just fine (before the fix, only semver in targetRevision worked fine).

image

summary of make test:

DONE 6360 tests, 5 skipped in 137.957s

@pgodowski pgodowski requested a review from a team as a code owner October 25, 2025 19:28
@bunnyshell
Copy link

bunnyshell bot commented Oct 25, 2025

❗ Preview Environment deployment failed on Bunnyshell

See: Environment Details | Pipeline Logs

Available commands (reply to this comment):

  • 🚀 /bns:deploy to redeploy the environment
  • /bns:delete to remove the environment

@pgodowski pgodowski force-pushed the fix/helm-charts-oci-digests branch from a8fc622 to 90c7b21 Compare October 25, 2025 19:49
@codecov
Copy link

codecov bot commented Oct 25, 2025

Codecov Report

❌ Patch coverage is 63.63636% with 8 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (master@0d0cec6). Learn more about missing BASE report.

Files with missing lines Patch % Lines
util/helm/cmd.go 40.00% 2 Missing and 4 partials ⚠️
reposerver/repository/repository.go 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master   #25079   +/-   ##
=========================================
  Coverage          ?   62.22%           
=========================================
  Files             ?      352           
  Lines             ?    49229           
  Branches          ?        0           
=========================================
  Hits              ?    30633           
  Misses            ?    15662           
  Partials          ?     2934           

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

util/helm/cmd.go Outdated
func (c *Cmd) Fetch(repo, chartName, version, destination string, creds Creds, passCredentials bool) (string, error) {
args := []string{"pull", "--destination", destination}
if version != "" {
if version != "" && !strings.HasPrefix(version, "sha256:") {
Copy link
Contributor

Choose a reason for hiding this comment

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

Will be easier to read formatted as:

if version != "" {
    if strings.HasPrefix(version, "sha256:") {
        // ...
    } else {
        // ...
    }
}

Copy link
Author

Choose a reason for hiding this comment

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

I added versions.IsDigest function to make the code look cleaner.

// constraint.
// If the revision is a constraint, but no tag satisfies that constraint, then it returns an error.
func MaxVersion(revision string, tags []string) (string, error) {
// Check if the revision is a SHA256 digest (used in OCI repositories)
Copy link
Contributor

Choose a reason for hiding this comment

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

For these general purpose functions, is there any other use for digests except for this helm use-case? If not, I would argue the fix does not belong to util/versions/tags.go.

Copy link
Author

@pgodowski pgodowski Oct 28, 2025

Choose a reason for hiding this comment

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

created versions.IsDigest in util/versions/digest.go

util/helm/cmd.go Outdated
args := []string{"pull", "--destination", destination}
if version != "" {
if version != "" && !strings.HasPrefix(version, "sha256:") {
// it is ok to use version flag
Copy link
Member

Choose a reason for hiding this comment

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

please write detailed comment on the changes behind it. Why is it okay to use the version flag? You can possibly link the issue as well so any dev who reads this code understand why this was set.

Copy link
Author

@pgodowski pgodowski Oct 28, 2025

Choose a reason for hiding this comment

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

added comments and refactored the code introducing versions.IsDigest function call

util/helm/cmd.go Outdated
Comment on lines 231 to 238
if version != "" && !strings.HasPrefix(version, "sha256:") {
// it is ok to use version flag
args = append(args, "--version", version)
} else if version != "" && strings.HasPrefix(version, "sha256:") {
// For sha256 digest, append it to the chart name
chartName = fmt.Sprintf("%s@%s", chartName, version)
}

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if version != "" && !strings.HasPrefix(version, "sha256:") {
// it is ok to use version flag
args = append(args, "--version", version)
} else if version != "" && strings.HasPrefix(version, "sha256:") {
// For sha256 digest, append it to the chart name
chartName = fmt.Sprintf("%s@%s", chartName, version)
}
if version != "" {
if strings.HasPrefix(version, "sha256:") {
chartName = fmt.Sprintf("%s@%s", chartName, version)
} else {
args = append(args, "--version", version)
}
}

Please write comments too.

Copy link
Author

Choose a reason for hiding this comment

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

refactored with introduction of IsDigest function.

Copy link
Member

@nitishfy nitishfy left a comment

Choose a reason for hiding this comment

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

The code looks good to me. Tagging @blakepettersson for reviews!

@blakepettersson
Copy link
Member

Something to keep in mind (which I informed you of in #24970) is that this already exists with the OCI support in 3.1. Is there any particular reason you want to duplicate this with the Helm client?

@blakepettersson
Copy link
Member

It might make sense to have this with the Helm client as well, but I'd like to hold off to see what Helm 4 is going to do in terms of OCI support.

@pgodowski
Copy link
Author

Thank you all for the comments - will respond within the next 2 days.

@pgodowski pgodowski force-pushed the fix/helm-charts-oci-digests branch from b0d1879 to 18b896a Compare October 28, 2025 10:15
@pgodowski
Copy link
Author

pgodowski commented Oct 28, 2025

@blakepettersson

Something to keep in mind (which I informed you of in #24970) is that this already exists with the OCI support in 3.1. Is there any particular reason you want to duplicate this with the Helm client?

We would like to make it working with Helm client, due to the already existing investement in Helm based repos and relative low energy required to make Argo working fine with Helm/OCI/digests.

It might make sense to have this with the Helm client as well, but I'd like to hold off to see what Helm 4 is going to do in terms of OCI support.

Based on my study of Helm4 alpha content, it will further evolve OCI repositories support in slightly different aspects, i.e. to be able to discover Helm charts from OCI repositories (which does not exist with Helm3 - there is no helm chart repos/index.yaml support in Helm3/OCI).

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.

Cannot deploy Application with Helm chart pointed by digest

4 participants