From 4198548f9b89cc5758763b7e215e8d377bbf9c13 Mon Sep 17 00:00:00 2001 From: Guy Bloom Date: Fri, 15 Mar 2024 11:25:14 -0400 Subject: [PATCH] poc: app deploy command --- .../cli/plugins/nativeapp/commands.py | 23 +++++++++++++++++++ .../cli/plugins/nativeapp/run_processor.py | 6 +++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/snowflake/cli/plugins/nativeapp/commands.py b/src/snowflake/cli/plugins/nativeapp/commands.py index bdff1a2ebc..f1b50a8c4e 100644 --- a/src/snowflake/cli/plugins/nativeapp/commands.py +++ b/src/snowflake/cli/plugins/nativeapp/commands.py @@ -224,3 +224,26 @@ def app_teardown( ) processor.process(force) return MessageResult(f"Teardown is now complete.") + + +@app.command("deploy", requires_connection=True) +@with_project_definition("native_app") +def app_deploy( + **options, +) -> CommandResult: + """ + Syncs the local changes to the stage without creating or updating the application. + """ + + processor = NativeAppRunProcessor( + project_definition=cli_context.project_definition, + project_root=cli_context.project_root, + ) + + processor.build_bundle() + processor.process( + policy=DenyAlwaysPolicy(), + skip_app_update=True, + ) + + return MessageResult(f"Deployed successfully.") diff --git a/src/snowflake/cli/plugins/nativeapp/run_processor.py b/src/snowflake/cli/plugins/nativeapp/run_processor.py index 8c13310ee0..ae9c557402 100644 --- a/src/snowflake/cli/plugins/nativeapp/run_processor.py +++ b/src/snowflake/cli/plugins/nativeapp/run_processor.py @@ -356,6 +356,7 @@ def process( patch: Optional[str] = None, from_release_directive: bool = False, is_interactive: bool = False, + skip_app_update: bool = True, *args, **kwargs, ): @@ -395,5 +396,6 @@ def process( # 3. Upload files from deploy root local folder to the above stage diff = self.sync_deploy_root_with_stage(self.package_role) - # 4. Create an application if none exists, else upgrade the application - self._create_dev_app(diff) + if not skip_app_update: + # 4. Create an application if none exists, else upgrade the application + self._create_dev_app(diff)