Charm Deployed or Upgrade from Dir Ignores "version"

Bug #1848149 reported by Joseph Phillips
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
Medium
Nam Nguyen

Bug Description

As part of the charm build step, if the source directory is under version control, a "version" file is generated as part of the build output.

For charms deployed and upgraded from a charm store, this is included in the archive, is stored in state and is reported as "charm-version" in the output of "juju-status".

This behaviour is consistent when deploying a charm archive. I.e. if one zips the charm source folder including the version file and uses the archive as the path when deploying or upgrading a charm, the charm will report "charm-version".

However, if the source *directory* is used to deploy a local charm, the version file is ignored and the version of the charm is neither stored or reported.

This should be made consistent with the archive behaviour.

Changed in juju:
importance: Undecided → Medium
milestone: none → 2.7-beta1
status: New → Triaged
Revision history for this message
Richard Harding (rharding) wrote :

To be clear, this is a case where the local charm is used and the deploy command is not issued from the cwd?

Revision history for this message
Richard Harding (rharding) wrote :

This seems related/but not the same as this bug we've addressed for 2.7

https://bugs.launchpad.net/juju/+bug/1789447

Revision history for this message
Nam Nguyen (nammn) wrote :

Running and debugging through the error can be related to the following case:

The charm dir did not have a VCS, which leads to the debug message:
`20:41:30 DEBUG juju.charm charmdir.go:429 charm is not in revision control directory`

Currently it seems that we expect local charm to have a vcs configured and under it.

The problem is that some charms do not use vcs and their last version are safed under a "version" file in the root of the charm.
Like here: https://jaas.ai/designate/33

Following up this leads to the following: https://pastebin.canonical.com/p/qVjYqK2dVd/

A fix probably needs to be added around here: https://github.com/juju/charm/blob/v6/charmdir.go#L419
to check for a local file called version and parse it.

Revision history for this message
Edward Hope-Morley (hopem) wrote :

Hi @manadart, does this also apply to non-reactive ("classic") charms? i.e. charms that are not built.

Revision history for this message
Richard Harding (rharding) wrote :

@hopem the idea is that for classic charms, if they were deployed from a directory that had a .git directory in them the Juju client would append that information during deploy. In investigation Nam seems to have found that's not working appropriately.

Revision history for this message
Nam Nguyen (nammn) wrote :

pr should fix that from charm perspective. With a good testing I will update the main version link
https://github.com/juju/charm/pull/294

Changed in juju:
assignee: nobody → Nam Nguyen (nammn)
Nam Nguyen (nammn)
Changed in juju:
status: Triaged → 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.