Skip to content

Commit

Permalink
convert snow app deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-fcampbell committed Oct 1, 2024
1 parent c7990a7 commit 701b845
Showing 1 changed file with 10 additions and 24 deletions.
34 changes: 10 additions & 24 deletions src/snowflake/cli/_plugins/nativeapp/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@
ApplicationPackageEntityModel,
)
from snowflake.cli._plugins.nativeapp.manager import NativeAppManager
from snowflake.cli._plugins.nativeapp.policy import (
AllowAlwaysPolicy,
AskAlwaysPolicy,
DenyAlwaysPolicy,
)
from snowflake.cli._plugins.nativeapp.teardown_processor import (
NativeAppTeardownProcessor,
)
Expand Down Expand Up @@ -315,7 +310,7 @@ def app_teardown(

@app.command("deploy", requires_connection=True)
@with_project_definition()
@nativeapp_definition_v2_to_v1()
@single_app_and_package()
def app_deploy(
prune: Optional[bool] = typer.Option(
default=None,
Expand Down Expand Up @@ -347,16 +342,6 @@ def app_deploy(
Creates an application package in your Snowflake account and syncs the local changes to the stage without creating or updating the application.
Running this command with no arguments at all, as in `snow app deploy`, is a shorthand for `snow app deploy --prune --recursive`.
"""

assert_project_type("native_app")

if force:
policy = AllowAlwaysPolicy()
elif interactive:
policy = AskAlwaysPolicy()
else:
policy = DenyAlwaysPolicy()

has_paths = paths is not None and len(paths) > 0
if prune is None and recursive is None and not has_paths:
prune = True
Expand All @@ -371,19 +356,20 @@ def app_deploy(
raise IncompatibleParametersError(["paths", "--prune"])

cli_context = get_cli_context()
manager = NativeAppManager(
project_definition=cli_context.project_definition.native_app,
ws = WorkspaceManager(
project_definition=cli_context.project_definition,
project_root=cli_context.project_root,
)

bundle_map = manager.build_bundle()
manager.deploy(
bundle_map=bundle_map,
package_id = options["package_entity_id"]
ws.perform_action(
package_id,
EntityActions.DEPLOY,
prune=prune,
recursive=recursive,
local_paths_to_sync=paths,
paths=paths,
validate=validate,
policy=policy,
interactive=interactive,
force=force,
)

return MessageResult(
Expand Down

0 comments on commit 701b845

Please sign in to comment.