Juju does not honor --channel latest/* option

Bug #1984061 reported by DUFOUR Olivier
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
High
Heather Lanigan

Bug Description

This was tested and reproduced on Juju 2.9.29 and 2.9.33 (latest stable)

Juju seems to be stripping the "latest/" name in the channel selection when querying Charmhub for a charm to be deployed/downloaded.
This was okay for Charmstore but is not with Charmhub and in particular it fails silently and provide the default branch charm instead without alerting the user.
(See the logs attached)

This is in particular visible with mysql-router charm where the default channel is 8.0/stable but it fails silently to download the "latest/stable" or "latest/edge" channel release.
As another example, it was reproduced as well with nova-cloud-controller charm.

In this situation this can block any deployments that needs to resort to latest/* branches of any charm.

It doesn't seem to come from Charmhub since querying Charmhub's API to get the "latest/edge" or "latest/stable" does in fact return the proper version of the charm to download.

--> This is what Juju currently sends with "juju download --channel latest/edge mysql-router"
--> This will return the default charm for mysql-router which is 8.0/stable currently
--> channel is currently set as "edge", it shouldn't be the case
--> if latest/stable, the channel would be set as "stable" by Juju
{"context":[],"actions":[{"action":"install","instance-key":"2637e4fa-ad9f-4215-8f07-f5c35ce291d7","name":"mysql-router","channel":"edge","base":{"architecture":"amd64","name":"ubuntu","channel":"20.04"}}],"fields":["bases","config-yaml","download","id","license","metadata-yaml","name","publisher","resources","revision","summary","type","version"]}

--> testing with Curl
--> With channel set manually to "latest/edge", Charmhub does in fact return the right values
curl -i -X POST -H 'Content-Type: application/json' -d '{"context":[],"actions":[{"action":"install","instance-key":"2637e4fa-ad9f-4215-8f07-f5c35ce291d7","name":"mysql-router","channel":"latest/edge","base":{"architecture":"amd64","name":"ubuntu","channel":"20.04"}}],"fields":["bases","config-yaml","download","id","license","metadata-yaml","name","publisher","resources","revision","summary","type","version"]}' https://api.charmhub.io/v2/charms/refresh

The only workaround available found so far is :
* poke at Charmhub API's to locate the charm
* download the charm indicated in its response
* deploy the charm locally

Revision history for this message
DUFOUR Olivier (odufourc) wrote :
Revision history for this message
John A Meinel (jameinel) wrote :

Confirmed.
`juju deploy mysql-router --channel=latest/stable`
does indeed end up with 8.0/stable
And with `juju model-config -m controller logging-config="<root>=INFO;#charmhub=TRACE"`
I see the same request:

The very first request is just for channel "stable" not for the channel "latest/stable":
machine-0: 16:58:43 TRACE juju.apiserver.charms.charmhubrepo.client charmhub Refresh(charmhub.executeOne{
    ID: "",
    Name: "mysql-router",
    Revision: (*int)(nil),
    Channel: &"stable",
    Base: charmhub.RefreshBase{Architecture:"amd64", Name:"", Channel:""},
    action: "install",
    instanceKey: "acf0fe64-9aa7-4c9c-8ce5-38f45c930e1b",
    resourceRevisions: nil,
    fields: {"bases", "config-yaml", "download", "id", "license", "metadata-yaml", "name", "publisher", "resources", "revision", "summary", "type", "version"},
})
machine-0: 16:58:43 TRACE juju.apiserver.charms.charmhubrepo.client charmhub POST request POST /v2/charms/refresh HTTP/1.1^M
Host: api.charmhub.io^M
Accept: application/json^M
Content-Type: application/json^M
User-Agent: Juju/2.9.33^M
^M
{"context":[],"actions":[{"action":"install","instance-key":"acf0fe64-9aa7-4c9c-8ce5-38f45c930e1b","name":"mysql-router","channel":"stable","base":{"architecture":"amd64","name":"NA","channel":"NA"}}],"fields":["bases","config-yaml","download","id","license","metadata-yaml","name","publisher","resources","revision","summary","type","version"]}

Changed in juju:
importance: Undecided → High
milestone: none → 2.9.34
status: New → Triaged
Changed in juju:
assignee: nobody → Heather Lanigan (hmlanigan)
status: Triaged → In Progress
Revision history for this message
Heather Lanigan (hmlanigan) wrote :
Changed in juju:
status: In Progress → Fix Committed
Changed in juju:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.