Skip to content

Commit

Permalink
Merge branch 'work/add-remotebuild-hooks/CRAFT-4044' into feature/sna…
Browse files Browse the repository at this point in the history
…pcraft-remote-build-upstream
  • Loading branch information
bepri committed Feb 6, 2025
2 parents ce7459f + 05eeeac commit b5d526b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
14 changes: 13 additions & 1 deletion craft_application/commands/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ class RemoteBuild(ExtensibleCommand):
overview = OVERVIEW
always_load_project = True

def _pre_build(self, parsed_args: argparse.Namespace) -> None:
"""Run steps to take before building, e.g. validations."""

def _get_build_args(
self, parsed_args: argparse.Namespace # noqa: ARG002 (unused parameter)
) -> dict[str, Any]:
"""Get arguments to pass to the builder."""
return {}

@override
def _fill_parser(self, parser: argparse.ArgumentParser) -> None:
parser.add_argument(
Expand Down Expand Up @@ -125,6 +134,9 @@ def _run(
if parsed_args.project:
self._services.remote_build.set_project(parsed_args.project)

self._pre_build(parsed_args)
build_args = self._get_build_args(parsed_args)

builder = self._services.remote_build
project = cast(models.Project, self._services.project)
config = cast(dict[str, Any], self.config)
Expand All @@ -147,7 +159,7 @@ def _run(
emit.progress(
"Starting new build. It may take a while to upload large projects."
)
builds = builder.start_builds(project_dir)
builds = builder.start_builds(project_dir, **build_args)

try:
returncode = self._monitor_and_complete(builds=builds)
Expand Down
1 change: 1 addition & 0 deletions docs/reference/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ X.X.X (YYYY-MMM-DD)
Remote build
============

- Add hooks to further customize functionality
- Add a ``--project`` parameter for finer-tuned safety for potentially
uploading private content to a public Launchpad project.

Expand Down

0 comments on commit b5d526b

Please sign in to comment.