Skip to content

Commit

Permalink
Support project definition v2 in "app validate" and "app deploy" (#1339)
Browse files Browse the repository at this point in the history
support v2 in validate and deploy
  • Loading branch information
sfc-gh-gbloom authored Jul 18, 2024
1 parent 6770f67 commit 5d495a4
Show file tree
Hide file tree
Showing 20 changed files with 247 additions and 145 deletions.
2 changes: 2 additions & 0 deletions src/snowflake/cli/plugins/nativeapp/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ def app_teardown(

@app.command("deploy", requires_connection=True)
@with_project_definition()
@nativeapp_definition_v2_to_v1
def app_deploy(
prune: Optional[bool] = typer.Option(
default=None,
Expand Down Expand Up @@ -351,6 +352,7 @@ def app_deploy(

@app.command("validate", requires_connection=True)
@with_project_definition()
@nativeapp_definition_v2_to_v1
def app_validate(**options):
"""
Validates a deployed Snowflake Native App's setup script.
Expand Down
122 changes: 114 additions & 8 deletions tests_integration/nativeapp/__snapshots__/test_deploy.ambr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# serializer version: 1
# name: test_nativeapp_deploy
# name: test_nativeapp_deploy[v1]
'''
Creating new application package myapp_pkg_@@USER@@ in account.
Checking if stage myapp_pkg_@@USER@@.app_src.stage exists, or creating a new one if none exists.
Expand All @@ -14,7 +14,7 @@

'''
# ---
# name: test_nativeapp_deploy_dot
# name: test_nativeapp_deploy[v2]
'''
Creating new application package myapp_pkg_@@USER@@ in account.
Checking if stage myapp_pkg_@@USER@@.app_src.stage exists, or creating a new one if none exists.
Expand All @@ -29,20 +29,78 @@

'''
# ---
# name: test_nativeapp_deploy_files
# name: test_nativeapp_deploy_dot[v1]
'''
Creating new application package myapp_pkg_@@USER@@ in account.
Checking if stage myapp_pkg_@@USER@@.app_src.stage exists, or creating a new one if none exists.
Performing a diff between the Snowflake stage and your local deploy_root ('@@DEPLOY_ROOT@@') directory.
Local changes to be deployed:
added: app/README.md -> README.md
added: app/manifest.yml -> manifest.yml
added: app/setup_script.sql -> setup_script.sql
Updating the Snowflake stage from your local @@DEPLOY_ROOT@@ directory.
Validating Snowflake Native App setup script.
Deployed successfully. Application package and stage are up-to-date.

'''
# ---
# name: test_nativeapp_deploy_dot[v2]
'''
Creating new application package myapp_pkg_@@USER@@ in account.
Checking if stage myapp_pkg_@@USER@@.app_src.stage exists, or creating a new one if none exists.
Performing a diff between the Snowflake stage and your local deploy_root ('@@DEPLOY_ROOT@@') directory.
Local changes to be deployed:
added: app/README.md -> README.md
added: app/manifest.yml -> manifest.yml
added: app/setup_script.sql -> setup_script.sql
Updating the Snowflake stage from your local @@DEPLOY_ROOT@@ directory.
Validating Snowflake Native App setup script.
Deployed successfully. Application package and stage are up-to-date.

'''
# ---
# name: test_nativeapp_deploy_files[v1]
'''
Creating new application package myapp_pkg_@@USER@@ in account.
Checking if stage myapp_pkg_@@USER@@.app_src.stage exists, or creating a new one if none exists.
Performing a diff between the Snowflake stage and your local deploy_root ('@@DEPLOY_ROOT@@') directory.
Local changes to be deployed:
added: app/manifest.yml -> manifest.yml
added: app/setup_script.sql -> setup_script.sql
Updating the Snowflake stage from your local @@DEPLOY_ROOT@@ directory.
Deployed successfully. Application package and stage are up-to-date.

'''
# ---
# name: test_nativeapp_deploy_files[v2]
'''
Creating new application package myapp_pkg_@@USER@@ in account.
Checking if stage myapp_pkg_@@USER@@.app_src.stage exists, or creating a new one if none exists.
Performing a diff between the Snowflake stage and your local deploy_root ('@@DEPLOY_ROOT@@') directory.
Local changes to be deployed:
added: app/manifest.yml -> manifest.yml
added: app/setup_script.sql -> setup_script.sql
Updating the Snowflake stage from your local @@DEPLOY_ROOT@@ directory.
Deployed successfully. Application package and stage are up-to-date.

'''
# ---
# name: test_nativeapp_deploy_looks_for_prefix_matches[v1]
'''
Creating new application package myapp_pkg_@@USER@@ in account.
Checking if stage myapp_pkg_@@USER@@.app_src.stage exists, or creating a new one if none exists.
Performing a diff between the Snowflake stage and your local deploy_root ('@@DEPLOY_ROOT@@') directory.
Local changes to be deployed:
added: app/README.md -> README.md
added: app/manifest.yml -> manifest.yml
added: app/setup_script.sql -> setup_script.sql
Updating the Snowflake stage from your local @@DEPLOY_ROOT@@ directory.
Validating Snowflake Native App setup script.
Deployed successfully. Application package and stage are up-to-date.

'''
# ---
# name: test_nativeapp_deploy_looks_for_prefix_matches
# name: test_nativeapp_deploy_looks_for_prefix_matches[v2]
'''
Creating new application package myapp_pkg_@@USER@@ in account.
Checking if stage myapp_pkg_@@USER@@.app_src.stage exists, or creating a new one if none exists.
Expand All @@ -57,7 +115,7 @@

'''
# ---
# name: test_nativeapp_deploy_nested_directories
# name: test_nativeapp_deploy_nested_directories[v1]
'''
Creating new application package myapp_pkg_@@USER@@ in account.
Checking if stage myapp_pkg_@@USER@@.app_src.stage exists, or creating a new one if none exists.
Expand All @@ -69,7 +127,55 @@

'''
# ---
# name: test_nativeapp_deploy_prune[app deploy --no-prune-contains2-not_contains2]
# name: test_nativeapp_deploy_nested_directories[v2]
'''
Creating new application package myapp_pkg_@@USER@@ in account.
Checking if stage myapp_pkg_@@USER@@.app_src.stage exists, or creating a new one if none exists.
Performing a diff between the Snowflake stage and your local deploy_root ('@@DEPLOY_ROOT@@') directory.
Local changes to be deployed:
added: app/nested/dir/file.txt -> nested/dir/file.txt
Updating the Snowflake stage from your local @@DEPLOY_ROOT@@ directory.
Deployed successfully. Application package and stage are up-to-date.

'''
# ---
# name: test_nativeapp_deploy_prune[v1-app deploy --no-prune-contains2-not_contains2]
'''
Checking if stage myapp_pkg_@@USER@@.app_src.stage exists, or creating a new one if none exists.
Performing a diff between the Snowflake stage and your local deploy_root ('@@DEPLOY_ROOT@@') directory.
The following files exist only on the stage:
README.md

Use the --prune flag to delete them from the stage.
Your stage is up-to-date with your local deploy root.
Validating Snowflake Native App setup script.
Deployed successfully. Application package and stage are up-to-date.

'''
# ---
# name: test_nativeapp_deploy_prune[v1-app deploy --no-validate-contains1-not_contains1]
'''
Checking if stage myapp_pkg_@@USER@@.app_src.stage exists, or creating a new one if none exists.
Performing a diff between the Snowflake stage and your local deploy_root ('@@DEPLOY_ROOT@@') directory.
Deleted paths to be removed from your stage:
deleted: README.md
Updating the Snowflake stage from your local @@DEPLOY_ROOT@@ directory.
Deployed successfully. Application package and stage are up-to-date.

'''
# ---
# name: test_nativeapp_deploy_prune[v1-app deploy --prune --no-validate-contains0-not_contains0]
'''
Checking if stage myapp_pkg_@@USER@@.app_src.stage exists, or creating a new one if none exists.
Performing a diff between the Snowflake stage and your local deploy_root ('@@DEPLOY_ROOT@@') directory.
Deleted paths to be removed from your stage:
deleted: README.md
Updating the Snowflake stage from your local @@DEPLOY_ROOT@@ directory.
Deployed successfully. Application package and stage are up-to-date.

'''
# ---
# name: test_nativeapp_deploy_prune[v2-app deploy --no-prune-contains2-not_contains2]
'''
Checking if stage myapp_pkg_@@USER@@.app_src.stage exists, or creating a new one if none exists.
Performing a diff between the Snowflake stage and your local deploy_root ('@@DEPLOY_ROOT@@') directory.
Expand All @@ -83,7 +189,7 @@

'''
# ---
# name: test_nativeapp_deploy_prune[app deploy --no-validate-contains1-not_contains1]
# name: test_nativeapp_deploy_prune[v2-app deploy --no-validate-contains1-not_contains1]
'''
Checking if stage myapp_pkg_@@USER@@.app_src.stage exists, or creating a new one if none exists.
Performing a diff between the Snowflake stage and your local deploy_root ('@@DEPLOY_ROOT@@') directory.
Expand All @@ -94,7 +200,7 @@

'''
# ---
# name: test_nativeapp_deploy_prune[app deploy --prune --no-validate-contains0-not_contains0]
# name: test_nativeapp_deploy_prune[v2-app deploy --prune --no-validate-contains0-not_contains0]
'''
Checking if stage myapp_pkg_@@USER@@.app_src.stage exists, or creating a new one if none exists.
Performing a diff between the Snowflake stage and your local deploy_root ('@@DEPLOY_ROOT@@') directory.
Expand Down
Loading

0 comments on commit 5d495a4

Please sign in to comment.