Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/test_integration_spcs.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: SPCS Integration testing

on:
pull_request:
branches:
- release*
push:
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
Expand Down
30 changes: 30 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,43 @@

## Deprecations

## New additions

## Fixes and improvements


# v3.7.2

## Deprecations

## New additions

## Fixes and improvements
* Fix error appearing on help messages after click BCR update.


# v3.7.1

## Deprecations

## New additions

## Fixes and improvements
* Fix certificate connection issues.
* Fix `snow spcs image-registry login` slow query problem.

# v3.7.0

## Deprecations

## New additions
* Added `--prune` flag to `deploy` commands, which removes files that exist in the stage,
but not in the local filesystem.
* Added `snow logs` command for retrieving and streaming logs from the server.
* Added `snow helper check-snowsql-env-vars` which reports environment variables from SnowSQL with replacements in CLI.

## Fixes and improvements
* Updated MacOS postinstall script to update PATH if snow not exist.


# v3.6.0
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ requires-python = ">=3.10"
description = "Snowflake CLI"
readme = "README.md"
dependencies = [
"click==8.1.8",
"GitPython==3.1.44",
"jinja2==3.1.6",
"packaging",
Expand All @@ -36,7 +37,7 @@ dependencies = [
"requirements-parser==0.11.0",
"rich==14.0.0",
"setuptools==78.1.0",
"snowflake-connector-python[secure-local-storage]==3.14.0",
"snowflake-connector-python[secure-local-storage]==3.15.0",
'snowflake-snowpark-python>=1.15.0,<1.26.0;python_version < "3.12"',
'snowflake.core==1.2.0; python_version < "3.12"',
"tomlkit==0.13.2",
Expand Down Expand Up @@ -108,7 +109,6 @@ features = ["development", "packaging"]
build-isolated-binary = ["python scripts/packaging/build_isolated_binary_with_hatch.py"]
build-binaries = ["./scripts/packaging/build_binaries.sh"]
build-packages = ["./scripts/packaging/build_packages.sh"]
package-darwin-binaries = ["./scripts/packaging/build_darwin_package.sh"]
build-all = [
"./scripts/packaging/build_binaries.sh",
"./scripts/packaging/build_packages.sh",
Expand Down
69 changes: 40 additions & 29 deletions scripts/packaging/build_darwin_package.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,52 @@
#!/usr/bin/env bash
set -xeuo pipefail

git config --global --add safe.directory /snowflake-cli
brew install -q tree

ROOT_DIR=$(git rev-parse --show-toplevel)
PACKAGING_DIR=$ROOT_DIR/scripts/packaging

SYSTEM=$(uname -s | tr '[:upper:]' '[:lower:]')
MACHINE=$(uname -m | tr '[:upper:]' '[:lower:]')
PLATFORM="${SYSTEM}-${MACHINE}"

echo "--- creating virtualenv ---"
python3.11 -m venv venv
. venv/bin/activate
python --version

echo "--- installing dependencies ---"
pip install hatch

# install cargo
if [[ ${MACHINE} == "arm64" ]]; then
echo "installing cargo on arm64"
curl https://sh.rustup.rs -sSf | bash -s -- -y
elif [[ ${MACHINE} == "x86_64" ]]; then
echo "installing cargo on x86_64"
curl https://sh.rustup.rs -sSf | bash -s -- -y --no-modify-path
source $HOME/.cargo/env
else
echo "Unsupported machine: ${MACHINE}"
exit 1
fi
rustup default stable


echo "--- setup variables ---"
BRANCH=${branch}
REVISION=$(git rev-parse ${svnRevision})
CLI_VERSION=$(hatch version)

STAGE_URL="s3://sfc-eng-jenkins/repository/snowflake-cli/${releaseType}/${SYSTEM}_${MACHINE}/${REVISION}/"

ROOT_DIR=$(git rev-parse --show-toplevel)
PACKAGING_DIR=$ROOT_DIR/scripts/packaging
DIST_DIR=$ROOT_DIR/dist

BINARY_NAME="snow-${CLI_VERSION}"
APP_NAME="SnowflakeCLI.app"
APP_DIR=$DIST_DIR/app
APP_SCRIPTS=$APP_DIR/scripts
CODESIGN_IDENTITY="Developer ID Application: Snowflake Computing INC. (W4NT6CRQ7U)"
PRODUCTSIGN_IDENTITY="Developer ID Installer: Snowflake Computing INC. (W4NT6CRQ7U)"


loginfo() {
logger -s -p INFO -- $1
}
Expand All @@ -29,26 +55,6 @@ clean_build_workspace() {
rm -rf $DIST_DIR || true
}

install_cargo() {
curl https://sh.rustup.rs -sSf > rustup-init.sh

if [[ ${MACHINE} == "arm64" ]]; then
sudo bash rustup-init.sh -y
. $HOME/.cargo/env
elif [[ ${MACHINE} == "x86_64" ]]; then
export CARGO_HOME="$HOME/.cargo"
export RUSTUP_HOME="$HOME/.rustup"
bash -s rustup-init.sh -y
. $HOME/.cargo/env
rustup default stable
else
echo "Unsupported machine: ${MACHINE}"
exit 1
fi

rm rustup-init.sh
}

create_app_template() {
rm -r ${APP_DIR}/${APP_NAME} || true
mkdir -p ${APP_DIR}/${APP_NAME}/Contents/MacOS
Expand All @@ -61,9 +67,9 @@ loginfo "---------------------------------"
security find-identity -v -p codesigning
loginfo "---------------------------------"

clean_build_workspace
install_cargo
echo "--- build binary ---"

clean_build_workspace
hatch -e packaging run build-isolated-binary
create_app_template
mv $DIST_DIR/binary/${BINARY_NAME} ${APP_DIR}/${APP_NAME}/Contents/MacOS/snow
Expand Down Expand Up @@ -118,7 +124,6 @@ prepare_postinstall_script() {
prepare_postinstall_script

ls -l $DIST_DIR
tree -d $DIST_DIR

chmod +x $APP_SCRIPTS/postinstall

Expand Down Expand Up @@ -209,3 +214,9 @@ validate_installation() {
}

validate_installation $DIST_DIR/snowflake-cli-${CLI_VERSION}-${SYSTEM}-${MACHINE}.pkg

echo "--- Upload artifacts to AWS ---"
ls -la ./dist/
echo "${STAGE_URL}"
command -v aws
aws s3 cp ./dist/ ${STAGE_URL} --recursive --exclude "*" --include="snowflake-cli-${CLI_VERSION}*.pkg"
31 changes: 17 additions & 14 deletions scripts/packaging/macos/postinstall
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# $2 is the install location
#
SNOWFLAKE_CLI_COMMENT="# added by Snowflake SnowflakeCLI installer v1.0"
RC_FILES=(~/.zprofile ~/.zshrc ~/.profile ~/.bash_profile ~/.bashrc)

function add_dest_path_to_profile() {
local dest=$1
Expand All @@ -18,19 +19,21 @@ export PATH=$dest:\$PATH" >>$profile
echo "[DEBUG] Parameters: $1 $2"
SNOWFLAKE_CLI_DEST=$2/SnowflakeCLI.app/Contents/MacOS/

SNOWFLAKE_CLI_LOGIN_SHELL=~/.profile
if [[ -e ~/.zprofile ]]; then
SNOWFLAKE_CLI_LOGIN_SHELL=~/.zprofile
elif [[ -e ~/.zshrc ]]; then
SNOWFLAKE_CLI_LOGIN_SHELL=~/.zshrc
elif [[ -e ~/.profile ]]; then
SNOWFLAKE_CLI_LOGIN_SHELL=~/.profile
elif [[ -e ~/.bash_profile ]]; then
SNOWFLAKE_CLI_LOGIN_SHELL=~/.bash_profile
elif [[ -e ~/.bashrc ]]; then
SNOWFLAKE_CLI_LOGIN_SHELL=~/.bashrc
fi
# List of potential login shell RC files

# Check if the path is already in the PATH variable
if [[ ":$PATH:" == *":$SNOWFLAKE_CLI_DEST:"* ]]; then
echo "[INFO] Path $SNOWFLAKE_CLI_DEST is already in PATH. No changes needed."
else
for rc_file in "${RC_FILES[@]}"; do
# Expand tilde (~) to the user's home directory
rc_file_expanded=$(eval echo "$rc_file")

if ! grep -q -E "^$SNOWFLAKE_CLI_COMMENT" $SNOWFLAKE_CLI_LOGIN_SHELL; then
add_dest_path_to_profile $SNOWFLAKE_CLI_DEST $SNOWFLAKE_CLI_LOGIN_SHELL
if [[ -e "$rc_file_expanded" ]]; then
# Add the PATH update to the file
add_dest_path_to_profile "$SNOWFLAKE_CLI_DEST" "$rc_file_expanded"
else
echo "[INFO] $rc_file_expanded does not exist, skipping..."
fi
done
fi
39 changes: 0 additions & 39 deletions scripts/packaging/setup_darwin.sh

This file was deleted.

3 changes: 2 additions & 1 deletion snyk/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
click==8.1.8
GitPython==3.1.44
jinja2==3.1.6
packaging
Expand All @@ -9,7 +10,7 @@ requests==2.32.3
requirements-parser==0.11.0
rich==14.0.0
setuptools==78.1.0
snowflake-connector-python[secure-local-storage]==3.14.0
snowflake-connector-python[secure-local-storage]==3.15.0
snowflake-snowpark-python>=1.15.0,<1.26.0;python_version < "3.12"
snowflake.core==1.2.0; python_version < "3.12"
tomlkit==0.13.2
Expand Down
2 changes: 1 addition & 1 deletion src/snowflake/cli/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from enum import Enum, unique

VERSION = "3.7.0.dev0"
VERSION = "3.8.0.dev+projects0"


@unique
Expand Down
17 changes: 16 additions & 1 deletion src/snowflake/cli/_plugins/logs/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@

import typer
from click import ClickException
from snowflake.cli._plugins.logs.manager import LogsManager, LogsQueryRow
from snowflake.cli._plugins.logs.manager import LogsManager
from snowflake.cli._plugins.logs.utils import LOG_LEVELS, LogsQueryRow
from snowflake.cli._plugins.object.commands import NameArgument, ObjectArgument
from snowflake.cli.api.commands.snow_typer import SnowTyperFactory
from snowflake.cli.api.exceptions import CliArgumentError
from snowflake.cli.api.identifiers import FQN
from snowflake.cli.api.output.types import (
CommandResult,
Expand Down Expand Up @@ -41,11 +43,22 @@ def get_logs(
"--table",
help="The table to query for logs. If not provided, the default table will be used",
),
log_level: Optional[str] = typer.Option(
"INFO",
"--log-level",
help="The log level to filter by. If not provided, INFO will be used",
),
**options,
):
"""
Retrieves logs for a given object.
"""

if log_level and not log_level.upper() in LOG_LEVELS:
raise CliArgumentError(
f"Invalid log level. Please choose from {', '.join(LOG_LEVELS)}"
)

if refresh_time and to:
raise ClickException(
"You cannot set both --refresh and --to parameters. Please check the values"
Expand All @@ -61,6 +74,7 @@ def get_logs(
from_time=from_time,
refresh_time=refresh_time,
event_table=event_table,
log_level=log_level,
)
logs = itertools.chain(
(MessageResult(log.log_message) for logs in logs_stream for log in logs)
Expand All @@ -72,6 +86,7 @@ def get_logs(
from_time=from_time,
to_time=to_time,
event_table=event_table,
log_level=log_level,
)
logs = (MessageResult(log.log_message) for log in logs_iterable) # type: ignore

Expand Down
Loading