← Back to issue list

5.5.0 changes pack semantics if the project file has different metadata

View original Github issue

Metadata

Project
craft-application
Number
#821
Type
issue
State
open
Author
javierdelapuente
Labels
Status: Triaged Type: Bug
Created
Updated
Closed

Current evaluation

Charmcraft pack skips repacking when only charmcraft.yaml metadata (e.g. summary, config, platforms) changes, leaving a stale .charm. Triaged and moved to craft-application; workaround is clean. Conditional repacking support added in #1111.

Suggested action: keep open

Reason: Maintainer lengau triaged it (Status: Triaged, Type: Bug), moved it to craft-application, and noted a testcraft spread test should be added when fixed. The root cause is in craft-application's pack-skip logic (needs_packing in services/package.py), where metadata-only changes to the project file are not detected as requiring a repack. Related work #1111 (conditional repacking) and #829 (gate around skipping repack) show active development in this area, but no commit explicitly closes this issue.

Impact: 60 Quick Win: 27.0 Staleness: 55 Complexity: 55 Confidence: 70 Support Request: 5

Issue body

### Bug Description Before `3.5.2.post40+g5e0dd360` changing `charmcraft.yaml` and running `charmcraft pack` would result in a new .charm file. In `3.5.2.post40+g5e0dd360`, changing `charmcraft.yaml` and packing will not change the .charm file. A log message like the following will be issued: ``` ubuntu@paas-tests-iam:~/abc$ charmcraft pack Launching managed ubuntu 22.04 instance... :: Starting instance - (4.4s)chown: invalid user: ‘a+rwx’ Already packed: flask-framework_ubuntu-22.04-amd64.charm ``` and the .charm file will not change to the new changes in charmcraft.yaml. ### To Reproduce Install the latest edge as of today: ``` ubuntu@paas-tests-iam:~/abc$ sudo snap refresh charmcraft --channel=edge charmcraft (edge) 3.5.2.post40+g5e0dd360 from Canonical✓ refreshed ``` Init the charm directory: ``` ubuntu@paas-tests-iam:~/abc$ charmcraft init --profile flask-framework --name flask-framework Charmed operator package file and directory tree initialised. Now edit the following package files to provide fundamental charm metadata and other information: charmcraft.yaml src/charm.py README.md ``` Pack: ``` ubuntu@paas-tests-iam:~/abc$ charmcraft pack WARNING: Cannot get a keyring. Every store interaction that requires authentication will require you to log in again. Launching managed ubuntu 22.04 instance... :: Starting instance - (22.1s)chown: invalid user: ‘a+rwx’ Packed flask-framework_ubuntu-22.04-amd64.charm ``` The .cham is there: ``` ubuntu@paas-tests-iam:~/abc$ ls -lrht total 12M -rw-rw-r-- 1 ubuntu ubuntu 1.4K Jul 24 12:43 charmcraft.yaml -rw-rw-r-- 1 ubuntu ubuntu 31 Jul 24 12:43 requirements.txt -rw-rw-r-- 1 ubuntu ubuntu 766 Jul 24 12:43 pyproject.toml drwxrwxr-x 2 ubuntu ubuntu 4.0K Jul 24 12:43 src -rw-rw-r-- 1 ubuntu ubuntu 1.9K Jul 24 12:43 tox.ini drwxrwxr-x 3 ubuntu ubuntu 4.0K Jul 24 12:44 lib -rw-r--r-- 1 ubuntu ubuntu 12M Jul 24 12:46 flask-framework_ubuntu-22.04-amd64.charm ``` Edit the charmcraft.yaml file (adding for example a config option): ``` ubuntu@paas-tests-iam:~/abc$ echo "config:" >> charmcraft.yaml ubuntu@paas-tests-iam:~/abc$ echo " options:" >> charmcraft.yaml ubuntu@paas-tests-iam:~/abc$ echo " greeting:" >> charmcraft.yaml ubuntu@paas-tests-iam:~/abc$ echo ' default: "Hello, world!"' >> charmcraft.yaml ubuntu@paas-tests-iam:~/abc$ echo ' type: string' >> charmcraft.yaml ubuntu@paas-tests-iam:~/abc$ echo ' description: nothing' >> charmcraft.yaml ``` Pack again: ``` ubuntu@paas-tests-iam:~/abc$ charmcraft pack Launching managed ubuntu 22.04 instance... :: Starting instance - (4.4s)chown: invalid user: ‘a+rwx’ Already packed: flask-framework_ubuntu-22.04-amd64.charm ``` No change in the .charm file: ``` ubuntu@paas-tests-iam:~/abc$ ls -lrhta total 12M -rw-rw-r-- 1 ubuntu ubuntu 75 Jul 24 12:43 .gitignore -rw-rw-r-- 1 ubuntu ubuntu 31 Jul 24 12:43 requirements.txt -rw-rw-r-- 1 ubuntu ubuntu 766 Jul 24 12:43 pyproject.toml drwxrwxr-x 2 ubuntu ubuntu 4.0K Jul 24 12:43 src -rw-rw-r-- 1 ubuntu ubuntu 1.9K Jul 24 12:43 tox.ini drwxrwxr-x 3 ubuntu ubuntu 4.0K Jul 24 12:44 lib drwxrwxr-x 4 ubuntu ubuntu 4.0K Jul 24 12:46 . -rw-r--r-- 1 ubuntu ubuntu 12M Jul 24 12:46 flask-framework_ubuntu-22.04-amd64.charm -rw-rw-r-- 1 ubuntu ubuntu 1.5K Jul 24 12:49 charmcraft.yaml drwxr-x--- 11 ubuntu ubuntu 4.0K Jul 24 12:49 .. ``` Refreshing charmcraft to the latest version and running pack will overwrite the .charm file. ### Environment I have tried in a new 24.04 multipass machine. I think the relevant part is the release of charmcraft `3.5.2.post40+g5e0dd360` ### charmcraft.yaml ```yaml ubuntu@paas-tests-iam:~/abc$ cat charmcraft.yaml # This file configures Charmcraft. # See https://juju.is/docs/sdk/charmcraft-config for guidance. name: flask-framework type: charm bases: - build-on: - name: ubuntu channel: "22.04" run-on: - name: ubuntu channel: "22.04" # (Required) summary: A very short one-line summary of the Flask application. # (Required) description: | A comprehensive overview of your Flask application. extensions: - flask-framework # Uncomment the integrations used by your application # Integrations set to "optional: false" will block the charm # until the applications are integrated. # requires: # mysql: # interface: mysql_client # optional: false # limit: 1 # postgresql: # interface: postgresql_client # optional: false # limit: 1 # mongodb: # interface: mongodb_client # optional: false # limit: 1 # redis: # interface: redis # optional: false # limit: 1 # s3: # interface: s3 # optional: false # limit: 1 # saml: # interface: saml # optional: false # limit: 1 # rabbitmq: # interface: rabbitmq # optional: false # limit: 1 # tracing: # interface: tracing # optional: true # limit: 1 # smtp: # interface: smtp # optional: false # limit: 1 # openfga: # interface: openfga # optional: false # limit: 1 ``` ### Relevant log output ```shell Already packed: flask-framework_ubuntu-22.04-amd64.charm ```

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 60
Quick Win: 27.0
Staleness: 55
Complexity: 55
Confidence: 70
Support Request: 5
keep open Charmcraft pack skips repacking when only charmcraft.yaml metadata (e.g. summary, config, platforms) changes, leaving a stale .charm. Triaged and moved to craft-application; workaround is clean. Conditional repacking support added in #1111.
qwen/qwen3.6-35b-a3b
Staleness: 85
Complexity: 55
Confidence: 85
Support Request: 10
keep open charmcraft pack skips rebuilding when charmcraft.yaml metadata changes, incorrectly reporting Already packed. Issue is triaged, moved to craft-application, and awaiting resolution.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 50
Confidence: 80
Support Request: 10
keep open Pack commands skip rebuilding when project metadata changes, outputting Already packed. Triaged, moved to craft-application, and has a clean command workaround, but has been inactive for over 345 days.
qwen3.6-35b-a3b-mtp-q6
Staleness: 75
Complexity: 55
Confidence: 85
Support Request: 10
keep open Pack skips rebuilding when project metadata changes, incorrectly reporting "Already packed". Triaged and moved to craft-application for a fix. Users can run clean to force a rebuild.

Update history

No update history recorded yet.

Related work

  • Related To: craft-application#1111 (confidence 75%)

    feat: add conditional repacking support — directly touches the repack-decision logic in services/package.py that this issue is about.

  • Related To: craft-application#829 (confidence 70%)

    fix(pack): put a gate around skipping repack — earlier fix in the same skip-repack code path.

  • Caused By: craft-application#810 (confidence 65%)

    feat(lifecycle): only pack files if not already packed — introduced the 'Already packed' skip behavior the reporter identified as the regression.

Related issues

Issue Project State Summary Similarity
#1530 Changing charmcraft.yaml doesn't update the resulting charm's metadata.yaml charmcraft open Bug: editing charmcraft.yaml then re-running `charmcraft pack` does not update the resulting charm's metadata.yaml. Filed by a maintainer (lengau); last comment (2024-09-09) says it's unclear if still reproducible. Related open craft-application#821 describes the same 'Already packed' skip behavior.
78%
#777 Do not modify the charm's project when packing using the reactive plugin (CRAFT-928). charmcraft merged Merged to resolve issue #693. The change prevents the reactive plugin from modifying the charm's project during packing. Approved by one reviewer with zero unresolved comments. Two files modified, netting a 21-line reduction.
74%
#2498 fix: `charmcraft pack --project-dir` with metadata.yaml charmcraft closed Merged fix for charmcraft pack --project-dir failing with legacy metadata.yaml. Resolved by changing the working directory to the project directory before loading and preprocessing configuration files. Resolves issue #2493.
73%
#710 `charmcraft pack` retains no longer existing files from previous packs charmcraft open charmcraft pack includes files deleted from the working directory in the charm archive; clean fixes it. Triaged as a known bug, re-confirmed present in Oct 2024, upstream craft-parts bug filed, per-part clean workaround documented.
73%
#1160 `charmcraft pack` does not recognize updated `charmcraft.yaml` file charmcraft open charmcraft pack ignores updated build-snaps channel in charmcraft.yaml without a clean; tracked as a craft-parts bug (canonical/craft-parts#496, still open) awaiting a dependency patch release to pull into charmcraft.
72%
#2341 Packing a bundle produces a zip that is rejected by charmhub charmcraft open charmcraft 3.x pack produces a bundle zip with metadata.yaml instead of bundle.yaml, so charmcraft upload is rejected by charmhub. A maintainer asked for the charmcraft.yaml on 2025-06-27; no further activity since.
71%
#2705 docs(pack): refer to inline charmcraft.yaml metadata in pack help charmcraft merged Merged documentation update to pack help that replaces legacy metadata.yaml references with modern inline charmcraft.yaml metadata guidance. Approved by two reviewers and passed CI checks.
71%