Skip to content

helm registry login failing when updated cli to v3.18.0 #30873

Closed

Description

@athornton2012

In our CI we auth to a GCP artifact registry by running

gcloud auth print-access-token | helm registry login -u oauth2accesstoken --password-stdin https://us-docker.pkg.dev

When we bumped to the new version of the helm cli we started to see the error message

Error: invalid reference: invalid registry "https://us-docker.pkg.dev/"

Activity

  1. DmytroDerkach commented on May 20, 2025

    @DmytroDerkach

    I had the same issue with helm, just remove https://

    gcloud auth print-access-token | helm registry login -u oauth2accesstoken --password-stdin us-docker.pkg.dev

  2. benoittgt commented on May 20, 2025

    @benoittgt
    Contributor

    Hello

    It seems related to oras ref requirement in oras-go, and OCI repository requirement.

    But I think the error could be clearer.

  3. gershonkoral commented on May 20, 2025

    @gershonkoral

    I had the same issue with helm, just remove https://

    Unfortunately this did not work. Rolled back to v17

  4. added
    bug
    on May 20, 2025
  5. gjenkins8 commented on May 20, 2025

    @gjenkins8
    Member

    ACR also seems to be affected, from #30883


    since 3.18.0 our pipeline stopped working on helm repo authentication. I can reproduce that locally from the 3.18.0 tag

    helm 3.18.0:

    az acr login -n REDACTED.azurecr.io --expose-token -o tsv --query accessToken 2>/dev/null | go run ./cmd/helm registry login REDACTED.azurecr.io  --password-stdin 
    Error: authenticating to "REDACTED.azurecr.io": GET "https://REDACTED.azurecr.io/v2/": GET "https://REDACTED.azurecr.io/oauth2/token?service=REDACTED.azurecr.io": response status code 401: unauthorized: authentication required, visit https://aka.ms/acr/authorization for more information. CorrelationId: b65a8fc5-6038-4ca3-aa92-46b2b6976849
    exit status 1
    

    helm 3.17.3:

    az acr login -n REDACTED.azurecr.io --expose-token -o tsv --query accessToken 2>/dev/null | helm registry login REDACTED.azurecr.io  --password-stdin
    Login Succeeded
    
  6. gjenkins8 commented on May 20, 2025

    @gjenkins8
    Member

    The underlying change was an update from ORAS v1 -> v2: #30296

    Investigating why this change has broken registry login

  7. gjenkins8 commented on May 20, 2025

    @gjenkins8
    Member

    If someone could post the output of helm registry login --debug ... for both Helm v3.17 (suceeding) and v3.18 (failing), that would be very useful please.

  8. gjenkins8 commented on May 20, 2025

    @gjenkins8
    Member

    One change in behavior looks to be that Helm no longer accepts registries prefixed with a URL protocol/scheme:

    $ echo foo | ./bin/helm-3.17 registry login -u oauth2accesstoken --password-stdin https://us-docker.pkg.dev
    Error: Get "https://us-docker.pkg.dev/v2/": unauthorized: authentication failed
    
    $ echo foo | ./bin/helm-3.18 registry login -u oauth2accesstoken --password-stdin https://us-docker.pkg.dev
    Error: invalid reference: invalid registry "https://us-docker.pkg.dev"
    

    While technically it is incorrect to specify a URL scheme for a registry. Helm may/want need to revert this behavior to prevent break folks workflows (discussing how/and any impacts)

  9. gjenkins8 commented on May 20, 2025

    @gjenkins8
    Member

    There is potentially other issues reported in:
    #30881
    #30883

  10. TerryHowe commented on May 20, 2025

    @TerryHowe
    Contributor

    I thought ORAS v2 went out with 3.17, so I don't think it is that. ORAS v2 did go out for 3.18. I'm camping and only getting spoty Internet. I won't be back until late Thursday.

    There was a bump of oras-go to 2.6 in 3.18, but minor changes

  11. benoittgt commented on May 20, 2025

    @benoittgt
    Contributor

    While technically it is incorrect to specify a URL scheme for a registry.

    Is it a bad idea to handle the extra URL scheme in Helm and remove it ?

  12. scottrigby commented on May 21, 2025

    @scottrigby
    Member

    While technically it is incorrect to specify a URL scheme for a registry.

    Is it a bad idea to handle the extra URL scheme in Helm and remove it ?

    @benoittgt I agree. This is what I did for the fix in #30887

  13. MyChaOS87 commented on May 21, 2025

    @MyChaOS87

    If someone could post the output of helm registry login --debug ... for both Helm v3.17 (suceeding) and v3.18 (failing), that would be very useful please.

    In #30883, I put --debug output into the ticket for 3.18.0 - I did not really deem it useful, but here is the link:
    #30883 (comment)

    If you need more, I can look for it tmr when I am back at work

    on AzureCR setting --username=00000000-0000-0000-0000-000000000000 explicitly helps as a workaround

  14. MyChaOS87 commented on May 21, 2025

    @MyChaOS87

    I believe the problem could be that helm is always setting username and password (

    o.client.authorizer.Credential = auth.StaticCredential(o.host, auth.Credential{Username: username, Password: password})
    ) while oras-go since v2.0.0 now offers an additional field for tokens in the credentials (https://github.com/oras-project/oras-go/blob/05a2b09cbf2eab1df691411884dc4df741ec56ab/registry/remote/auth/credential.go#L39)

    also documented here: https://pkg.go.dev/oras.land/oras-go/v2@main/registry/remote/auth#example-Client.Do-WithAccessToken

  15. lrascao commented on May 21, 2025

    @lrascao

    was also getting it when running
    gcloud auth print-access-token | helm registry login -u oauth2accesstoken --password-stdin us-docker.pkg.dev/<projectid>/<chartpath>

  16. giautm commented on May 21, 2025

    @giautm

    TL/DR: Run the login command with the host only (for example: helm registry login ghcr.io)

    Root-cause: Helm upgrade the oras-go to v2, which including a validate that rejecting all components of URL except the hostname + port.

    https://github.com/oras-project/oras-go/blob/05a2b09cbf2eab1df691411884dc4df741ec56ab/registry/reference.go#L194-L199

  17. dbeilin commented on May 21, 2025

    @dbeilin

    Removing org/repo fixed it for me on 3.18, thanks @giautm
    Changed:

    $OCI_REGISTRY_TOKEN | helm registry login -u $OCI_REGISTRY_USER --password-stdin ghcr.io/org/repo
    

    to:

    $OCI_REGISTRY_TOKEN | helm registry login -u $OCI_REGISTRY_USER --password-stdin ghcr.io
    
  18. TerryHowe commented on May 21, 2025

    @TerryHowe
    Contributor

    Sounds like there is another potential issue with repo specified on login.

  19. added 5 commits that reference this issue on May 22, 2025
  20. scottrigby commented on May 23, 2025

    @scottrigby
    Member

    Removing org/repo fixed it for me on 3.18, thanks @giautm Changed:

    $OCI_REGISTRY_TOKEN | helm registry login -u $OCI_REGISTRY_USER --password-stdin ghcr.io/org/repo
    

    to:

    $OCI_REGISTRY_TOKEN | helm registry login -u $OCI_REGISTRY_USER --password-stdin ghcr.io
    

    @athornton2012 @lrascao @dbeilin now that #30887 is merged, both the scheme and path will be stripped automatically, and operate as it was in 3.17.3, in order to keep Helm's backwards compatibility promise within the same MAJOR version. This fix will be released in 3.18.1.

    For Helm 4, we can require a properly formatted host string, and document that in the migration guide.

  21. TerryHowe commented on May 23, 2025

    @TerryHowe
    Contributor

    For Helm 4, we can require a properly formatted host string, and document that in the migration guide.

    Is there a migration guide started or somewhere to record these items?

  22. scottrigby commented on May 23, 2025

    @scottrigby
    Member

    For Helm 4, we can require a properly formatted host string, and document that in the migration guide.

    Is there a migration guide started or somewhere to record these items?

    we can make an issue in the helm-www repo and tag v4

  23. StianOvrevage commented on May 28, 2025

    @StianOvrevage

    Can confirm that removing protocol (https://) when using Google Artifact Registry fixes the issue.

    Works:

    gcloud auth application-default print-access-token | helm registry login -u oauth2accesstoken --password-stdin europe-docker.pkg.dev
    
  24. bijoy26 commented on Jun 2, 2025

    @bijoy26

    Removing org/repo fixed it for me on 3.18, thanks @giautm Changed:

    $OCI_REGISTRY_TOKEN | helm registry login -u $OCI_REGISTRY_USER --password-stdin ghcr.io/org/repo
    

    to:

    $OCI_REGISTRY_TOKEN | helm registry login -u $OCI_REGISTRY_USER --password-stdin ghcr.io
    

    @athornton2012 @lrascao @dbeilin now that #30887 is merged, both the scheme and path will be stripped automatically, and operate as it was in 3.17.3, in order to keep Helm's backwards compatibility promise within the same MAJOR version. This fix will be released in 3.18.1.

    For Helm 4, we can require a properly formatted host string, and document that in the migration guide.

    We bumped into the same issue (we're using GCP artifact registry as helm repository source) and upgrading to the patch v3.18.1 solved the problem. Apparently, GitHub Actions service is still using the impacted version baked in the runner image, causing the build failures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions