Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-1773537: Use the patch number specified in manifest.yaml in snow app create version command #1820

Open
sfc-gh-kolszewski opened this issue Oct 29, 2024 · 2 comments
Labels
enhancement New feature or request native apps

Comments

@sfc-gh-kolszewski
Copy link

Description

Native Apps added the functionality of specifying patch number in the manifest.yaml file. This together with ALTER VERSION query syntax allows to add a patch with a specific number, not just increment the last patch by 1. AFAIK, the initial patch for each new version must always be 0 though.

We would like snow app create version command to utilize patch number from manifest.yaml. This would however require several validations like:

  1. if the version does not exist, the patch number either should not be provided in manifest.yaml or be set to 0
  2. if the patch with provided number already exists for given version, the snow app create version should fail
  3. if the patch is not provided, the current behaviour should be used (ie not providing number after ADD PATCH clause)

Context

No response

@github-actions github-actions bot changed the title Use the patch number specified in manifest.yaml in snow app create version command SNOW-1773537: Use the patch number specified in manifest.yaml in snow app create version command Oct 29, 2024
@sfc-gh-astus sfc-gh-astus added enhancement New feature or request native apps labels Oct 30, 2024
@sfc-gh-fcampbell
Copy link
Contributor

sfc-gh-fcampbell commented Oct 30, 2024

I tested this with an example app, and this behaviour already exists.

Using an app that already has a version called V1 and a patch 0:

> snow app version list
+--------------------------------------------------------------------------------------------------------------------------------------------+
| version | patch | label        | comment           | created_on             | dropped_on | log_level | trace_level | state | review_status |
|---------+-------+--------------+-------------------+------------------------+------------+-----------+-------------+-------+---------------|
| V1      | 0     | FirstVersion | The first version | 2024-08-13             | None       | INFO      | OFF         | READY | NOT_REVIEWED  |
|         |       |              |                   | 07:29:38.054000-07:00  |            |           |             |       |               |
+--------------------------------------------------------------------------------------------------------------------------------------------+

Defining patch: 0 in the manifest:

> snow app version create --skip-git-check
Version was not provided through the Snowflake CLI. Checking version in the manifest.yml instead.
This step will bundle your app artifacts to determine the location of the manifest.yml file.

Checking if stage logs_pkg_fcampbell.app_src.stage exists, or creating a new one if none exists.
Performing a diff between the Snowflake stage and your local deploy_root ('/Users/fcampbell/Software/snowflakedb/nade-experiments/apps/logs/output/deploy') directory.
Local changes to be deployed:
  modified: app/manifest.yml -> manifest.yml
Updating the Snowflake stage from your local /Users/fcampbell/Software/snowflakedb/nade-experiments/apps/logs/output/deploy directory.
Validating Snowflake Native App setup script.
Version V1 already defined in application package logs_pkg_fcampbell and in release directive(s): DEFAULT.

Are you sure you want to create a new patch for version V1 in application package logs_pkg_fcampbell? Once added, this operation cannot be undone. [y/N]: y
Adding new patch to version V1 defined in application package logs_pkg_fcampbell
╭─ Error ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ 093168 (22000): 01b80975-0502-fcd6-0000-1ca10054ee9e: Version 'V1', patch 0 of application package 'LOGS_PKG_FCAMPBELL' already exists.    │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Defining patch: 1 in the manifest:

> snow app version create --skip-git-check
Version was not provided through the Snowflake CLI. Checking version in the manifest.yml instead.
This step will bundle your app artifacts to determine the location of the manifest.yml file.

Checking if stage logs_pkg_fcampbell.app_src.stage exists, or creating a new one if none exists.
Performing a diff between the Snowflake stage and your local deploy_root ('/Users/fcampbell/Software/snowflakedb/nade-experiments/apps/logs/output/deploy') directory.
Local changes to be deployed:
  modified: app/manifest.yml -> manifest.yml
Updating the Snowflake stage from your local /Users/fcampbell/Software/snowflakedb/nade-experiments/apps/logs/output/deploy directory.
Validating Snowflake Native App setup script.
Version V1 already defined in application package logs_pkg_fcampbell and in release directive(s): DEFAULT.

Are you sure you want to create a new patch for version V1 in application package logs_pkg_fcampbell? Once added, this operation cannot be undone. [y/N]: y
Adding new patch to version V1 defined in application package logs_pkg_fcampbell
Patch 1 created for version V1 defined in application package logs_pkg_fcampbell.
Version create is now complete.

Defining patch: 10 in the manifest:

> snow app version create --skip-git-check
Version was not provided through the Snowflake CLI. Checking version in the manifest.yml instead.
This step will bundle your app artifacts to determine the location of the manifest.yml file.

Checking if stage logs_pkg_fcampbell.app_src.stage exists, or creating a new one if none exists.
Performing a diff between the Snowflake stage and your local deploy_root ('/Users/fcampbell/Software/snowflakedb/nade-experiments/apps/logs/output/deploy') directory.
Local changes to be deployed:
  modified: app/manifest.yml -> manifest.yml
Updating the Snowflake stage from your local /Users/fcampbell/Software/snowflakedb/nade-experiments/apps/logs/output/deploy directory.
Validating Snowflake Native App setup script.
Version V1 already defined in application package logs_pkg_fcampbell and in release directive(s): DEFAULT.

Are you sure you want to create a new patch for version V1 in application package logs_pkg_fcampbell? Once added, this operation cannot be undone. [y/N]: y
Adding new patch to version V1 defined in application package logs_pkg_fcampbell
Patch 10 created for version V1 defined in application package logs_pkg_fcampbell.
Version create is now complete.

Removing patch from manifest entirely:

> snow app version create --skip-git-check
Version was not provided through the Snowflake CLI. Checking version in the manifest.yml instead.
This step will bundle your app artifacts to determine the location of the manifest.yml file.

Checking if stage logs_pkg_fcampbell.app_src.stage exists, or creating a new one if none exists.
Performing a diff between the Snowflake stage and your local deploy_root ('/Users/fcampbell/Software/snowflakedb/nade-experiments/apps/logs/output/deploy') directory.
Local changes to be deployed:
  modified: app/manifest.yml -> manifest.yml
Updating the Snowflake stage from your local /Users/fcampbell/Software/snowflakedb/nade-experiments/apps/logs/output/deploy directory.
Validating Snowflake Native App setup script.
Version V1 already defined in application package logs_pkg_fcampbell and in release directive(s): DEFAULT.

Are you sure you want to create a new patch for version V1 in application package logs_pkg_fcampbell? Once added, this operation cannot be undone. [y/N]: y
Adding new patch to version V1 defined in application package logs_pkg_fcampbell
Patch 11 created for version V1 defined in application package logs_pkg_fcampbell.
Version create is now complete.

Version info so far:

> snow app version list
+--------------------------------------------------------------------------------------------------------------------------------------------+
| version | patch | label        | comment           | created_on             | dropped_on | log_level | trace_level | state | review_status |
|---------+-------+--------------+-------------------+------------------------+------------+-----------+-------------+-------+---------------|
| V1      | 0     | FirstVersion | The first version | 2024-08-13             | None       | INFO      | OFF         | READY | NOT_REVIEWED  |
|         |       |              |                   | 07:29:38.054000-07:00  |            |           |             |       |               |
| V1      | 1     | FirstVersion | The first version | 2024-10-30             | None       | INFO      | OFF         | READY | NOT_REVIEWED  |
|         |       |              |                   | 06:41:54.352000-07:00  |            |           |             |       |               |
| V1      | 10    | FirstVersion | The first version | 2024-10-30             | None       | INFO      | OFF         | READY | NOT_REVIEWED  |
|         |       |              |                   | 06:42:08.885000-07:00  |            |           |             |       |               |
| V1      | 11    | FirstVersion | The first version | 2024-10-30             | None       | INFO      | OFF         | READY | NOT_REVIEWED  |
|         |       |              |                   | 06:50:01.436000-07:00  |            |           |             |       |               |
+--------------------------------------------------------------------------------------------------------------------------------------------+

Attempting to create a patch for a non-existent version V2:

> snow app version create --skip-git-check
Version was not provided through the Snowflake CLI. Checking version in the manifest.yml instead.
This step will bundle your app artifacts to determine the location of the manifest.yml file.

Usage: snow app version create [OPTIONS] [VERSION]
Try 'snow app version create --help' for help.
╭─ Error ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Cannot create a custom patch when version V2 is not defined in the application package logs_pkg_fcampbell. Try again without using         │
│ --patch.                                                                                                                                   │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

The error message should be updated, but otherwise this is supported already, unless there's a use-case I'm missing.

@sfc-gh-kolszewski
Copy link
Author

I must have missed something when I was doing the testing myself. Thanks for confirming this is already supported!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request native apps
Projects
None yet
Development

No branches or pull requests

3 participants