Skip to content
Merged
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
6 changes: 3 additions & 3 deletions .github/workflows/daily_precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ jobs:
.tox/coverage.xml

test-fips:
name: Test FIPS py-linux-3.10-${{ matrix.cloud-provider }}
name: Test FIPS py-linux-3.11-${{ matrix.cloud-provider }}
needs: build
runs-on: ubuntu-latest-64-cores
strategy:
Expand All @@ -257,15 +257,15 @@ jobs:
- name: Run tests
run: ./ci/test_fips_docker.sh
env:
PYTHON_VERSION: '3.10'
PYTHON_VERSION: '3.11'
cloud_provider: ${{ matrix.cloud-provider }}
PYTEST_ADDOPTS: --color=yes --tb=short
TOX_PARALLEL_NO_SPINNER: 1
shell: bash
- uses: actions/upload-artifact@v4
with:
include-hidden-files: true
name: coverage_linux-fips-3.10-${{ matrix.cloud-provider }}
name: coverage_linux-fips-3.11-${{ matrix.cloud-provider }}
path: |
.coverage
coverage.xml
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ jobs:
# matrix is empty for pre-commit, tests are only added
# through the include directive
include:
# run py 3.10 tests on aws/ubuntu
- python-version: "3.10"
cloud-provider: aws
os: ubuntu-latest-64-cores
# run py 3.11 tests on azure/windows
- python-version: "3.11"
cloud-provider: azure
os: windows-latest-64-cores
# only run azure tests with latest python and ubuntu
- cloud-provider: azure
python-version: "3.12"
Expand Down
35 changes: 14 additions & 21 deletions ci/docker/snowpark_test_fips/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM centos:8
FROM rockylinux:9

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

snowflake python connector uses rocklinux:9 for their CI base image in the public repo


# This is to solve permission issue, read https://denibertovic.com/posts/handling-permissions-with-docker-volumes/
RUN curl -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.14/gosu-amd64"
Expand All @@ -12,31 +12,24 @@ RUN chmod 777 /home/user

ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo && \
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo && \
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
RUN dnf clean all && \
dnf groupinstall -y "Development Tools" && \
dnf install -y redhat-rpm-config gcc libffi-devel wget && \
dnf install -y perl perl-IPC-Cmd perl-Digest-SHA perl-Test-Simple perl-Pod-Html python3.11 python3.11-devel python3.11-pip && \
dnf clean all && \
rm -rf /var/cache/dnf

RUN yum clean all && \
yum groupinstall -y "Development Tools" && \
yum install -y redhat-rpm-config gcc libffi-devel wget && \
yum install -y perl-IPC-Cmd perl-Digest-SHA perl-Test-Simple perl-Pod-Html python310 python310-devel && \
yum clean all && \
rm -rf /var/cache/yum

# build openssl 3.0.0
# build, install, and enable openssl 3.0.0 FIPS
RUN wget https://www.openssl.org/source/openssl-3.0.0.tar.gz && \
tar -zxf openssl-3.0.0.tar.gz && \
cd openssl-3.0.0 && \
./Configure enable-fips && \
make > /dev/null

# install openssl 3.0.0
RUN cd openssl-3.0.0 && \
make > /dev/null && \
make install > /dev/null && \
make install_fips > /dev/null

# enable openssl fips mode
RUN LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64 openssl fipsinstall -out /usr/local/ssl/fipsmodule.cnf -module /usr/local/lib64/ossl-modules/fips.so
make install_fips > /dev/null && \
FIPS_MODULE="$(find /usr/local -path '*/ossl-modules/fips.so' | head -1)" && \
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64:/usr/local/lib /usr/local/bin/openssl fipsinstall \
-out /usr/local/ssl/fipsmodule.cnf -module "$FIPS_MODULE"
RUN cat <<EOF >> /usr/local/ssl/openssl.cnf
openssl_conf = openssl_init

Expand All @@ -53,4 +46,4 @@ base = base_sect
activate = 1
EOF

RUN python3 -m pip install --user --upgrade pip setuptools wheel
RUN python3.11 -m pip install --upgrade pip setuptools wheel
20 changes: 14 additions & 6 deletions ci/test_fips.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,28 @@ THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SNOWPARK_DIR="$( dirname "${THIS_DIR}")"
SNOWPARK_WHL="$(ls $SNOWPARK_DIR/dist/*.whl | sort -r | head -n 1)"

python3.10 -m venv fips_env
FIPS_LD="/usr/local/lib64:/usr/local/lib"

openssl_fips() {
env LD_LIBRARY_PATH="${FIPS_LD}${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" PATH="/usr/local/bin:$PATH" \
openssl "$@"
}

python3.11 -m venv fips_env
source fips_env/bin/activate
export PATH=/usr/local/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/lib64/:/usr/local/lib/:$LD_LIBRARY_PATH

# Install dependencies against the system OpenSSL (3.5 on Rocky 9). Python 3.11's
# _hashlib is linked against OPENSSL_3.4.0 symbols and cannot load OpenSSL 3.0.0
# from /usr/local via LD_LIBRARY_PATH.
pip install -U setuptools pip
pip install protoc-wheel-0==21.1
pip install "${SNOWPARK_WHL}[pandas,secure-local-storage,development,opentelemetry]"
pip install "pytest-timeout"

echo "!!! Environment description !!!"
echo "Default installed OpenSSL version"
openssl version
openssl md5 <<< "12345" || echo "OpenSSL md5 test fails (this is GOOD)"
echo "Custom FIPS OpenSSL CLI version"
openssl_fips version
openssl_fips md5 <<< "12345" || echo "OpenSSL md5 test fails (this is GOOD)"
python -c "import ssl; print('Python openssl library: ' + ssl.OPENSSL_VERSION)"
python -c "from cryptography.hazmat.backends.openssl import backend; print('Cryptography openssl library: ' + backend.openssl_version_text())"
python -c "import hashlib; print(hashlib.md5('test_str'.encode('utf-8')).hexdigest());"
Expand Down
8 changes: 4 additions & 4 deletions src/snowflake/snowpark/dataframe_ai_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,7 @@ def transcribe(
>>> result = json.loads(result_df.collect()[0]["TRANSCRIPT"])
>>> len(result["segments"]) > 0
True
>>> result["segments"][0]["text"].lower()
>>> result["segments"][0]["text"].lower() # doctest: +SKIP
'the'
>>> 'start' in result["segments"][0] and 'end' in result["segments"][0]
True
Expand All @@ -1125,11 +1125,11 @@ def transcribe(
>>> result = json.loads(result_df.collect()[0]["TRANSCRIPT"])
>>> result["audio_duration"] > 100 and len(result["segments"]) > 0
True
>>> result["segments"][0]["speaker_label"]
>>> result["segments"][0]["speaker_label"] # doctest: +SKIP
'SPEAKER_00'
>>> 'jenny' in result["segments"][0]["text"].lower()
>>> 'jenny' in result["segments"][0]["text"].lower() # doctest: +SKIP
True
>>> 'start' in result["segments"][0] and 'end' in result["segments"][0]
>>> 'start' in result["segments"][0] and 'end' in result["segments"][0] # doctest: +SKIP
True
"""
output_column_name = output_column or "AI_TRANSCRIBE_OUTPUT"
Expand Down
8 changes: 4 additions & 4 deletions src/snowflake/snowpark/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -13567,7 +13567,7 @@ def ai_transcribe(
>>> result = json.loads(df.collect()[0][0])
>>> len(result["segments"]) > 0
True
>>> result["segments"][0]["text"].lower()
>>> result["segments"][0]["text"].lower() # doctest: +SKIP
'the'
>>> 'start' in result["segments"][0] and 'end' in result["segments"][0]
True
Expand All @@ -13585,11 +13585,11 @@ def ai_transcribe(
True
>>> len(result["segments"]) > 0
True
>>> result["segments"][0]["speaker_label"]
>>> result["segments"][0]["speaker_label"] # doctest: +SKIP
'SPEAKER_00'
>>> 'jenny' in result["segments"][0]["text"].lower()
>>> 'jenny' in result["segments"][0]["text"].lower() # doctest: +SKIP
True
>>> 'start' in result["segments"][0] and 'end' in result["segments"][0]
>>> 'start' in result["segments"][0] and 'end' in result["segments"][0] # doctest: +SKIP
True
"""
sql_func_name = "ai_transcribe"
Expand Down
9 changes: 8 additions & 1 deletion tests/integ/test_trace_sql_errors_to_df.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
# Copyright (c) 2012-2025 Snowflake Computing Inc. All rights reserved.
#

import os
import sys

import pytest
import snowflake.snowpark.context as context
import sys

from snowflake.snowpark._internal.utils import set_ast_state, AstFlagSource
from snowflake.snowpark.exceptions import SnowparkSQLException
Expand All @@ -27,6 +29,11 @@
reason="Line numbers are flaky before Python 3.11",
run=False,
),
pytest.mark.skipif(
"FIPS_TEST" in os.environ,
reason="SNOW-2204213: Reading source file location is not correct in FIPS mode",
run=False,
),
]


Expand Down
2 changes: 1 addition & 1 deletion tests/resources/test_environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dependencies: # List of packages and versions to include in the environment
- python=3.10.0 # Python version
- numpy=1.24.3
- pandas
- scikit-learn=1.0.1
- scikit-learn=1.2.0
- matplotlib=3.7.1
- pip=23.1.2
- pip:
Expand Down
Loading