Skip to content

Conversation

@clay-lake
Copy link

This PR is part of Rockcraft's pro_sources feature set and includes the following features:

  • A chroot sub command for craftctl to enable modification to the overlay during the overlay-script

@clay-lake
Copy link
Author

@tigarmo @canonical/starcraft-reviewers Need a review when you can 👀

raise invalid_control_api_call(
message=(
f"invalid arguments to command {cmd_name!r} (want key=value)"
f"invalid arguments. {cmd_name!r} expected format <key>=<value>"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update test_craftctl_set_argument_error for this

message=f"{cmd_name!r} can only run in overlay step",
)

if len(cmd_args) < 1:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if len(cmd_args) < 1:
if not cmd_args:

assert lf.project_info.get_project_var("myvar2") == "val2"


def test_craftctl_chroot(new_dir, partitions, mocker):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patching out chroot etc. makes this look like a unit test to me. Could you make an integration test that runs a real command inside the chroot?

Copy link
Contributor

@medubelko medubelko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggested some polish for the release note. :)

Comment on lines +28 to +29
- Introduced a new sub command called ``chroot`` to ``craftctl`` which allows users to
run a command inside the overlay of a part.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Introduced a new sub command called ``chroot`` to ``craftctl`` which allows users to
run a command inside the overlay of a part.
- Add ``craftctl chroot`` sub-command, for running a command inside a part's overlay.

@jahn-junior jahn-junior removed their request for review October 7, 2025 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants