Skip to content

fix: pass credentials to skopeo list-tags for private OCI registries#192

Merged
michaelvl merged 12 commits intokrm-functions:mainfrom
mane-tv2:fix/skopeo-list-tags-auth
Mar 23, 2026
Merged

fix: pass credentials to skopeo list-tags for private OCI registries#192
michaelvl merged 12 commits intokrm-functions:mainfrom
mane-tv2:fix/skopeo-list-tags-auth

Conversation

@mane-tv2
Copy link
Contributor

@mane-tv2 mane-tv2 commented Mar 23, 2026

Problem

When using helm-upgrader with Helm charts hosted in private OCI registries (e.g. ghcr.io), the version upgrade check fails with:

error running skopeo command: ["list-tags" "docker://ghcr.io/example/charts/my-chart"]: "exit status 1"

Root Cause

SearchRepo() in pkg/helm/helm.go receives username and password from the auth Secret lookup in main.go, but when the chart is from an OCI registry, it calls skopeo.ListTags(chart) without forwarding credentials.

The ListTags() function in pkg/skopeo/skopeo.go runs skopeo list-tags docker://... without --creds, so the request is unauthenticated — which fails on private registries.

Note that PullChart() already handles OCI auth correctly (via helm registry login), so this is only a gap in the tag listing path.

Fix

  • skopeo.ListTags() now accepts username, password string parameters and passes --creds user:pass to skopeo when credentials are provided.
  • helm.SearchRepo() forwards the credentials it receives to skopeo.ListTags().

Testing

This was discovered and validated against a private ghcr.io OCI registry (ghcr.io/tv2/ccs-helm-charts/argocd-config) used in a GitHub Actions CI workflow.

Added Go 1.24 as a build input for the project.
When using helm-upgrader with charts from private OCI registries
(e.g. ghcr.io), the SearchRepo function correctly receives credentials
from the auth Secret but never passes them to skopeo.ListTags().

This causes skopeo to fail with "exit status 1" when listing tags
on private registries, since the request is unauthenticated.

Changes:
- skopeo.ListTags() now accepts username and password parameters
  and passes them via --creds to skopeo when provided
- helm.SearchRepo() now forwards credentials to skopeo.ListTags()
@mane-tv2 mane-tv2 marked this pull request as draft March 23, 2026 09:38
When using helm-upgrader with charts from private OCI registries
(e.g. ghcr.io), the SearchRepo function correctly receives credentials
from the auth Secret but never passes them to skopeo.ListTags().

This causes skopeo to fail with "exit status 1" when listing tags
on private registries, since the request is unauthenticated.

Changes:
- skopeo.ListTags() now accepts username and password parameters
  and passes them via --creds to skopeo when provided
- helm.SearchRepo() now forwards credentials to skopeo.ListTags()
bump version in test
@mane-tv2 mane-tv2 force-pushed the fix/skopeo-list-tags-auth branch from dc3c7b4 to 945921e Compare March 23, 2026 10:31
@michaelvl michaelvl marked this pull request as ready for review March 23, 2026 11:01
@michaelvl michaelvl merged commit b813f4c into krm-functions:main Mar 23, 2026
1 check passed
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.

2 participants