Skip to content

Commit 6b7a1a2

Browse files
Merge branch 'main' into sshetkar-SNOW-2171791-add-platform-telemetry
2 parents 527efd9 + e34a73c commit 6b7a1a2

19 files changed

+394
-38
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,8 @@ src/snowflake/connector/nanoarrow_cpp/ArrowIterator/nanoarrow_arrow_iterator.cpp
129129
# Prober files
130130
prober/parameters.json
131131
prober/snowflake_prober.egg-info/
132+
133+
# SSH private key for WIF tests
134+
ci/wif/parameters/rsa_wif_aws_azure
135+
ci/wif/parameters/rsa_wif_gcp
136+
ci/wif/parameters/parameters_wif.json

DESCRIPTION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Source code is also available at: https://github.com/snowflakedb/snowflake-conne
1414
- Added in-band HTTP exception telemetry.
1515
- Fixed a bug where timezoned timestamps fetched as pandas.DataFrame or pyarrow.Table would overflow for the sake of unnecessary precision. In the case where an overflow cannot be prevented a clear error will be raised now.
1616
- Fix OAuth authenticator values.
17+
- Add `unsafe_skip_file_permissions_check` flag to skip file permissions check on cache and config.
1718

1819
- v3.16.0(July 04,2025)
1920
- Bumped numpy dependency from <2.1.0 to <=2.2.4.

Jenkinsfile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,18 @@ timestamps {
7171
'''.stripMargin()
7272
}
7373
}
74+
},
75+
'Test WIF': {
76+
stage('Test WIF') {
77+
withCredentials([
78+
string(credentialsId: 'sfctest0-parameters-secret', variable: 'PARAMETERS_SECRET')
79+
]) {
80+
sh '''\
81+
|#!/bin/bash -e
82+
|$WORKSPACE/ci/test_wif.sh
83+
'''.stripMargin()
84+
}
85+
}
7486
}
7587
)
7688
}

ci/container/test_authentication.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ set -o pipefail
66
export WORKSPACE=${WORKSPACE:-/mnt/workspace}
77
export SOURCE_ROOT=${SOURCE_ROOT:-/mnt/host}
88

9-
MVNW_EXE=$SOURCE_ROOT/mvnw
109
AUTH_PARAMETER_FILE=./.github/workflows/parameters/private/parameters_aws_auth_tests.json
1110
eval $(jq -r '.authtestparams | to_entries | map("export \(.key)=\(.value|tostring)")|.[]' $AUTH_PARAMETER_FILE)
1211

ci/test_wif.sh

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/bin/bash -e
2+
3+
set -o pipefail
4+
5+
export THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
6+
export RSA_KEY_PATH_AWS_AZURE="$THIS_DIR/wif/parameters/rsa_wif_aws_azure"
7+
export RSA_KEY_PATH_GCP="$THIS_DIR/wif/parameters/rsa_wif_gcp"
8+
export PARAMETERS_FILE_PATH="$THIS_DIR/wif/parameters/parameters_wif.json"
9+
10+
run_tests_and_set_result() {
11+
local provider="$1"
12+
local host="$2"
13+
local snowflake_host="$3"
14+
local rsa_key_path="$4"
15+
16+
ssh -i "$rsa_key_path" -o IdentitiesOnly=yes -p 443 "$host" env BRANCH="$BRANCH" SNOWFLAKE_TEST_WIF_HOST="$snowflake_host" SNOWFLAKE_TEST_WIF_PROVIDER="$provider" SNOWFLAKE_TEST_WIF_ACCOUNT="$SNOWFLAKE_TEST_WIF_ACCOUNT" bash << EOF
17+
set -e
18+
set -o pipefail
19+
docker run \
20+
--rm \
21+
-e BRANCH \
22+
-e SNOWFLAKE_TEST_WIF_PROVIDER \
23+
-e SNOWFLAKE_TEST_WIF_HOST \
24+
-e SNOWFLAKE_TEST_WIF_ACCOUNT \
25+
snowflakedb/client-python-test:1 \
26+
bash -c "
27+
echo 'Running tests on branch: \$BRANCH'
28+
if [[ \"\$BRANCH\" =~ ^PR-[0-9]+\$ ]]; then
29+
curl -L https://github.com/snowflakedb/snowflake-connector-python/archive/refs/pull/\$(echo \$BRANCH | cut -d- -f2)/head.tar.gz | tar -xz
30+
mv snowflake-connector-python-* snowflake-connector-python
31+
else
32+
curl -L https://github.com/snowflakedb/snowflake-connector-python/archive/refs/heads/\$BRANCH.tar.gz | tar -xz
33+
mv snowflake-connector-python-\$BRANCH snowflake-connector-python
34+
fi
35+
cd snowflake-connector-python
36+
bash ci/wif/test_wif.sh
37+
"
38+
EOF
39+
local status=$?
40+
41+
if [[ $status -ne 0 ]]; then
42+
echo "$provider tests failed with exit status: $status"
43+
EXIT_STATUS=1
44+
else
45+
echo "$provider tests passed"
46+
fi
47+
}
48+
49+
get_branch() {
50+
local branch
51+
branch=$(git rev-parse --abbrev-ref HEAD)
52+
if [[ "$branch" == "HEAD" ]]; then
53+
branch=$(git name-rev --name-only HEAD | sed 's#^remotes/origin/##;s#^origin/##')
54+
fi
55+
echo "$branch"
56+
}
57+
58+
setup_parameters() {
59+
gpg --quiet --batch --yes --decrypt --passphrase="$PARAMETERS_SECRET" --output "$RSA_KEY_PATH_AWS_AZURE" "${RSA_KEY_PATH_AWS_AZURE}.gpg"
60+
gpg --quiet --batch --yes --decrypt --passphrase="$PARAMETERS_SECRET" --output "$RSA_KEY_PATH_GCP" "${RSA_KEY_PATH_GCP}.gpg"
61+
chmod 600 "$RSA_KEY_PATH_AWS_AZURE"
62+
chmod 600 "$RSA_KEY_PATH_GCP"
63+
gpg --quiet --batch --yes --decrypt --passphrase="$PARAMETERS_SECRET" --output "$PARAMETERS_FILE_PATH" "${PARAMETERS_FILE_PATH}.gpg"
64+
eval $(jq -r '.wif | to_entries | map("export \(.key)=\(.value|tostring)")|.[]' $PARAMETERS_FILE_PATH)
65+
}
66+
67+
BRANCH=$(get_branch)
68+
export BRANCH
69+
setup_parameters
70+
71+
# Run tests for all cloud providers
72+
EXIT_STATUS=0
73+
set +e # Don't exit on first failure
74+
run_tests_and_set_result "AZURE" "$HOST_AZURE" "$SNOWFLAKE_TEST_WIF_HOST_AZURE" "$RSA_KEY_PATH_AWS_AZURE"
75+
run_tests_and_set_result "AWS" "$HOST_AWS" "$SNOWFLAKE_TEST_WIF_HOST_AWS" "$RSA_KEY_PATH_AWS_AZURE"
76+
run_tests_and_set_result "GCP" "$HOST_GCP" "$SNOWFLAKE_TEST_WIF_HOST_GCP" "$RSA_KEY_PATH_GCP"
77+
set -e # Re-enable exit on error
78+
echo "Exit status: $EXIT_STATUS"
79+
exit $EXIT_STATUS
294 Bytes
Binary file not shown.
344 Bytes
Binary file not shown.

ci/wif/parameters/rsa_wif_gcp.gpg

356 Bytes
Binary file not shown.

ci/wif/test_wif.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash -e
2+
3+
set -o pipefail
4+
5+
export SF_OCSP_TEST_MODE=true
6+
export SF_ENABLE_EXPERIMENTAL_AUTHENTICATION=true
7+
export RUN_WIF_TESTS=true
8+
9+
/opt/python/cp39-cp39/bin/python -m pip install --break-system-packages -e .
10+
/opt/python/cp39-cp39/bin/python -m pip install --break-system-packages pytest
11+
/opt/python/cp39-cp39/bin/python -m pytest test/wif/*

src/snowflake/connector/auth/_auth.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,9 @@ def _delete_temporary_credential(
548548

549549
def get_token_cache(self) -> TokenCache:
550550
if self._token_cache is None:
551-
self._token_cache = TokenCache.make()
551+
self._token_cache = TokenCache.make(
552+
skip_file_permissions_check=self._rest._connection._unsafe_skip_file_permissions_check
553+
)
552554
return self._token_cache
553555

554556

0 commit comments

Comments
 (0)