Populate the 'version' file as part of 'charmcraft build'
Metadata
Current evaluation
Automatic version-file generation was rejected; maintainers directed authors to create version in their build pipeline, which Charmcraft preserves in packed charms.
Resolution: closed not a bug
Reason: Facundobatista explicitly decided Charmcraft would not create the file when absent (2022-05-30). jameinel later confirmed that authors can generate it in their build pipeline and Charmcraft will preserve it (2023-10-17).
Evaluated by: mr-cal-bot
No scores available.
Issue body
When Juju creates a charm .zip file from a directory, one of the steps is to populate the version file:
https://github.com/juju/charm/blob/master/charmdir.go#L268
https://github.com/juju/charm/blob/5fe646695e8585e7a6b9fedb0d10cc7fbc598e48/charmdir.go#L521
That allows for a nice way to track back what content is running on a given server, tied back into the source tree that it was generated from.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed not a bug | Automatic version-file generation was rejected; maintainers directed authors to create version in their build pipeline, which Charmcraft preserves in packed charms. | |
| stealth/space-bunny-alpha | — | closed not a bug | Automatic version-file generation was rejected pending a design for Charmhub/Juju versioning. Authors may generate a version file in their build pipeline; Charmcraft preserves it. | |
| qwen/qwen3.6-35b-a3b | — | — | Rejected. The team decided against auto-generating a version file due to evolving Juju/Charmhub versioning semantics. Developers must create the file in their build pipeline; charmcraft preserves existing version files during packaging. | |
| qwen/qwen3.6-35b-a3b | — | — | Automatically populating a version file during build was abandoned. Implementation deferred pending Charmhub and Juju versioning design. Developers must manually include the file. | |
| qwen/qwen3.6-35b-a3b | — | — | Rejected. Auto-generating a version file during build was abandoned due to unresolved Juju and Charmhub versioning semantics. Users should generate it in their build pipeline, as charmcraft preserves existing version files. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Abandoned. The team declined to auto-generate a version file during build, awaiting upstream Charmhub and Juju versioning semantics. Developers should manually include a version file in their build pipeline, which charmcraft preserves. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #358 How to set the charm version? | charmcraft | closed | Usage question resolved: Charmcraft reads the charm version from a file named "version"; no code fix was needed. | |
| #1101 add a "version" option on charmcraft release cli | charmcraft | closed | Rejected: Charmhub only obtains a charm’s version from the built artifact, so Charmcraft did not add a release version option; metadata-based versioning remains separate work. | |
| #1790 Set a charm version from `charmcraft.yaml` | charmcraft | open | Maintainer request to accept a `version` field in charmcraft.yaml and store it in the built charm. Unimplemented: the model accepts `version` but it is hidden from the schema and unused. Blocked on design of where version lives. |