pack: fetch logs from managed instance on error (CRAFT-333)
Metadata
Current evaluation
Merged in charmcraft#420 via fae2d7e8, adding managed-instance log capture on pack failures and per-run logs at /tmp/charmcraft.log.
Resolution: closed resolved
Reason: PR #420 was merged into the main branch as merge commit 504bdb72. It implemented log capture and retrieval for Charm pack failures.
Evaluated by: mr-cal-bot
No scores available.
Issue body
Catch error when failing to pack a Charm, retrieving the logs from
the managed instance for easier inspection by the user.
- Update logger to write to /tmp/charmcraft.log so that it can be
readily retrieved by the host Charmcraft instance. Provide this
path with a new env.get_managed_environment_log_path() interface.
Additionally, ensure the log file is truncated with mode='w' so
the instance logs are only for the last run.
- prefix logs in managed instance with "mm "
- add providers.capture_logs_from_instance() to providers to retrieve
logs and send them to logger.debug()
- update build to use this mechanism
Signed-off-by: Chris Patterson <chris.patterson@canonical.com>
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged in charmcraft#420 via fae2d7e8, adding managed-instance log capture on pack failures and per-run logs at /tmp/charmcraft.log. | |
| stealth/space-bunny-alpha | — | closed resolved | PR #420 merged (commit fae2d7e8, merge 504bdb72): pack failures now capture managed-instance logs via providers.capture_logs_from_instance(), writing to /tmp/charmcraft.log with mode='w' and "mm " prefix. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged in charmcraft#420: pack failures now capture managed-instance logs, overwrite charmcraft.log per run, and prefix instance log messages with "mm ". | |
| qwen/qwen3.6-35b-a3b | — | — | Merged changes to retrieve managed instance logs upon charm packing failures. Introduces a log path interface, provider log capture method, and log prefixing. Approved by two reviewers and passed CI. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Adds error handling to fetch logs from managed instances when Charm packing fails. Updates the logger to write to /tmp/charmcraft.log, introduces a provider log retrieval method, and prefixes logs with mm. Merged after minor formatting feedback. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #707 The logs from the instance's charmcraft run are only retrieved if pack crashed | charmcraft | closed | Fixed in canonical/charmcraft#726 (cc7d9ee0, merged as 6a05a07a): instance logs are now retrieved after both successful and failed charmcraft pack runs. |