canonical / rockcraft

Tool to create OCI Images using the language from Snapcraft and Charmcraft.
GNU General Public License v3.0
35 stars 43 forks source link

Location of managed rockcraft instance's log file is shown #135

Closed mr-cal closed 1 year ago

mr-cal commented 1 year ago

When rockcraft starts, the location of the log file is shown twice, from the the outer rockcraft and managed rockcraft processes:

  1. Outer process: Logging execution to '/home/developer/.cache/rockcraft/log/rockcraft-20221103-105727.504666.log'
  2. Inner/managed process: Logging execution to '/tmp/rockcraft.log'

This also occurs when rockcraft fails, the location of the two log files appear:

  1. Full execution log: '/tmp/rockcraft.log' from inside the instance
  2. Full execution log: '/home/developer/.cache/rockcraft/log/rockcraft-20221103-105727.504666.log' from outside the instance

Only the outer instance's log location should be displayed.

The collection of log files from the managed rockcraft instance is recent feature (I added it here and here).

I recall that snapcraft or charmcraft had a similar issue recently (I haven't searched for the bug or PR), so the solution from one of those projects can be leveraged.

rockcraft --verbose
Starting Rockcraft 0.0.1.dev1
Logging execution to '/home/developer/.cache/rockcraft/log/rockcraft-20221103-105727.504666.log'
Launching instance...
Starting Rockcraft 0.0.1.dev1
Logging execution to '/tmp/rockcraft.log'
Retrieving base ubuntu:20.04
Retrieved base ubuntu:20.04 for amd64
Extracting ubuntu:20.04
Extracted ubuntu:20.04
Initializing parts lifecycle
Executing parts lifecycle
Executing parts lifecycle: skip pull hello (already ran)
Executing action
Executed: skip pull hello (already ran)
Executing parts lifecycle: skip pull pebble (already ran)
Executing action
Executed: skip pull pebble (already ran)
Executing parts lifecycle: skip overlay hello (already ran)
Executing action
Executed: skip overlay hello (already ran)
Executing parts lifecycle: skip overlay pebble (already ran)
Executing action
Executed: skip overlay pebble (already ran)
Executing parts lifecycle: rebuild hello ('override-build' property changed)
Executing action
:: + exit 1
'override-build' in part 'hello' failed with code 1.
Review the scriptlet and make sure it's correct.
Full execution log: '/tmp/rockcraft.log'
craft-providers error: Failed to execute pack in instance.
Full execution log: '/home/developer/.cache/rockcraft/log/rockcraft-20221103-105727.504666.log'
SamirPS commented 1 year ago

Hello,

Do you talk about this PR:https://github.com/snapcore/snapcraft/pull/3891 ?

SamirPS commented 1 year ago

@mr-cal I managed to display only the outer instance's log when Rockcraft fails.

I think it's normal for the other one since we use the verbose mode. WDYT

mr-cal commented 1 year ago

Do you talk about this PR:https://github.com/snapcore/snapcraft/pull/3891 ?

Yep, that looks like the right PR!

I think it's normal for the other one since we use the verbose mode. WDYT

I'm interpreting this as "the outer log location is always logged when running rockcraft, since the default verbosity is verbose". If that's what you mean, then I agree that it is the correct behavior.

SamirPS commented 1 year ago

This issue needs to be closed, no?

tigarmo commented 1 year ago

True, thanks! closed by #170