← Back to issue list

How to set the charm version?

View original Github issue

Metadata

Project
charmcraft
Number
#358
Type
issue
State
closed
Author
heitorPB
Labels
Created
Updated
Closed

Current evaluation

Closed after a maintainer explained that the charm version is set by creating a file named version containing the desired string. The user confirmed the solution, resolving the question without code changes.

Suggested action:

No scores available.

Issue body

Using the operator framework, I can set the workload version, that is displayed with `juju status`, which is not the same as the version when `charmcraft pack` runs. I can use an arbitrary string for the workload version, but how do I set the charm version using `charmcraft`? I see the `revision` is updated automatically on `charmcraft upload`, but it also automatically set my charm version to the same value.

Evaluation history

Date Model Scores Action Summary
qwen3.6-35b-a3b-mtp-q6 Closed after a maintainer explained that the charm version is set by creating a file named version containing the desired string. The user confirmed the solution, resolving the question without code changes.
qwen/qwen3.6-35b-a3b Resolved via maintainer clarification. To set the charm version in charmcraft, place the version string in a file named version. The issue was closed after the contributor acknowledged the solution.
qwen/qwen3.6-35b-a3b Resolved. Maintainers clarified that setting the charm version requires creating a file named version containing the desired string. The issue was closed after the author confirmed the solution.
qwen3.6-35b-a3b-mtp-q6 Resolved via maintainer guidance. The charm version is configured by placing a plain text file named version in the charm directory. No code modifications were needed.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#1790 Set a charm version from `charmcraft.yaml` charmcraft open Feature request to accept a version field in charmcraft.yaml and store it in the output charm. Open 755 days with no comments or labels; blocked on design decisions about where Juju should read the version from.
79%
#37 Populate the 'version' file as part of 'charmcraft build' charmcraft closed 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.
71%